version 1.8, 2000/09/14 13:32:07 |
version 1.9, 2001/05/03 13:41:06 |
|
|
|
/* $OpenPackages$ */ |
/* $OpenBSD$ */ |
/* $OpenBSD$ */ |
/* $NetBSD: job.h,v 1.5 1996/11/06 17:59:10 christos Exp $ */ |
/* $NetBSD: job.h,v 1.5 1996/11/06 17:59:10 christos Exp $ */ |
|
|
/* |
/* |
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California. |
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California. |
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
* |
* |
* from: @(#)job.h 8.1 (Berkeley) 6/6/93 |
* from: @(#)job.h 8.1 (Berkeley) 6/6/93 |
*/ |
*/ |
|
|
/*- |
/*- |
|
|
* before coming out to see if a child has finished. SEL_SEC is the number of |
* before coming out to see if a child has finished. SEL_SEC is the number of |
* seconds and SEL_USEC is the number of micro-seconds |
* seconds and SEL_USEC is the number of micro-seconds |
*/ |
*/ |
#define SEL_SEC 0 |
#define SEL_SEC 0 |
#define SEL_USEC 500000 |
#define SEL_USEC 500000 |
|
|
|
|
/*- |
/*- |
* Job Table definitions. |
* Job Table definitions. |
* |
* |
|
|
* traversal of the dependency graph. |
* traversal of the dependency graph. |
*/ |
*/ |
#define JOB_BUFSIZE 1024 |
#define JOB_BUFSIZE 1024 |
typedef struct Job { |
typedef struct Job_ { |
int pid; /* The child's process ID */ |
int pid; /* The child's process ID */ |
GNode *node; /* The target the child is making */ |
GNode *node; /* The target the child is making */ |
LstNode tailCmds; /* The node of the first command to be |
LstNode tailCmds; /* The node of the first command to be |
* saved when the job has been run */ |
* saved when the job has been run */ |
FILE *cmdFILE; /* When creating the shell script, this is |
FILE *cmdFILE; /* When creating the shell script, this is |
* where the commands go */ |
* where the commands go */ |
int rmtID; /* ID returned from Rmt module */ |
int rmtID; /* ID returned from Rmt module */ |
short flags; /* Flags to control treatment of job */ |
short flags; /* Flags to control treatment of job */ |
#define JOB_IGNERR 0x001 /* Ignore non-zero exits */ |
#define JOB_IGNERR 0x001 /* Ignore non-zero exits */ |
#define JOB_SILENT 0x002 /* no output */ |
#define JOB_SILENT 0x002 /* no output */ |
#define JOB_SPECIAL 0x004 /* Target is a special one. i.e. run it locally |
#define JOB_SPECIAL 0x004 /* Target is a special one. i.e. run it locally |
* if we can't export it and maxLocal is 0 */ |
* if we can't export it and maxLocal is 0 */ |
#define JOB_IGNDOTS 0x008 /* Ignore "..." lines when processing |
#define JOB_IGNDOTS 0x008 /* Ignore "..." lines when processing |
* commands */ |
* commands */ |
#define JOB_REMOTE 0x010 /* Job is running remotely */ |
#define JOB_REMOTE 0x010 /* Job is running remotely */ |
#define JOB_FIRST 0x020 /* Job is first job for the node */ |
#define JOB_FIRST 0x020 /* Job is first job for the node */ |
|
|
* JobFinish and JobRestart */ |
* JobFinish and JobRestart */ |
union { |
union { |
struct { |
struct { |
int op_inPipe; /* Input side of pipe associated |
int op_inPipe; /* Input side of pipe associated |
* with job's output channel */ |
* with job's output channel */ |
int op_outPipe; /* Output side of pipe associated with |
int op_outPipe; /* Output side of pipe associated with |
* job's output channel */ |
* job's output channel */ |
char op_outBuf[JOB_BUFSIZE + 1]; |
char op_outBuf[JOB_BUFSIZE + 1]; |
/* Buffer for storing the output of the |
/* Buffer for storing the output of the |
* job, line by line */ |
* job, line by line */ |
int op_curPos; /* Current position in op_outBuf */ |
int op_curPos; /* Current position in op_outBuf */ |
} o_pipe; /* data used when catching the output via |
} o_pipe; /* data used when catching the output via |
* a pipe */ |
* a pipe */ |
struct { |
struct { |
char of_outFile[sizeof(TMPPAT)]; |
char of_outFile[sizeof(TMPPAT)]; |
/* Name of file to which shell output |
/* Name of file to which shell output |
* was rerouted */ |
* was rerouted */ |
int of_outFd; /* Stream open to the output |
int of_outFd; /* Stream open to the output |
* file. Used to funnel all |
* file. Used to funnel all |
* from a single job to one file |
* from a single job to one file |
* while still allowing |
* while still allowing |
* multiple shell invocations */ |
* multiple shell invocations */ |
} o_file; /* Data used when catching the output in |
} o_file; /* Data used when catching the output in |
* a temporary file */ |
* a temporary file */ |
} output; /* Data for tracking a shell's output */ |
} output; /* Data for tracking a shell's output */ |
} Job; |
} Job; |
|
|
#define outPipe output.o_pipe.op_outPipe |
#define outPipe output.o_pipe.op_outPipe |
#define inPipe output.o_pipe.op_inPipe |
#define inPipe output.o_pipe.op_inPipe |
#define outBuf output.o_pipe.op_outBuf |
#define outBuf output.o_pipe.op_outBuf |
#define curPos output.o_pipe.op_curPos |
#define curPos output.o_pipe.op_curPos |
#define outFile output.o_file.of_outFile |
#define outFile output.o_file.of_outFile |
#define outFd output.o_file.of_outFd |
#define outFd output.o_file.of_outFd |
|
|
|
|
/*- |
/*- |
* Shell Specifications: |
* Shell Specifications: |
* Each shell type has associated with it the following information: |
* Each shell type has associated with it the following information: |
|
|
* strings is empty when hasErrCtl is FALSE, the command will be executed |
* strings is empty when hasErrCtl is FALSE, the command will be executed |
* anyway as is and if it causes an error, so be it. |
* anyway as is and if it causes an error, so be it. |
*/ |
*/ |
typedef struct Shell { |
typedef struct Shell_ { |
char *name; /* the name of the shell. For Bourne and C |
char *name; /* the name of the shell. For Bourne and C |
* shells, this is used only to find the |
* shells, this is used only to find the |
* shell description when used as the single |
* shell description when used as the single |
* source of a .SHELL target. For user-defined |
* source of a .SHELL target. For user-defined |
* shells, this is the full path of the shell. |
* shells, this is the full path of the shell. |
*/ |
*/ |
Boolean hasEchoCtl; /* True if both echoOff and echoOn defined */ |
Boolean hasEchoCtl; /* True if both echoOff and echoOn defined */ |
char *echoOff; /* command to turn off echo */ |
char *echoOff; /* command to turn off echo */ |
char *echoOn; /* command to turn it back on again */ |
char *echoOn; /* command to turn it back on again */ |
char *noPrint; /* command to skip when printing output from |
char *noPrint; /* command to skip when printing output from |
* shell. This is usually the command which |
* shell. This is usually the command which |
* was executed to turn off echoing */ |
* was executed to turn off echoing */ |
int noPLen; /* length of noPrint command */ |
int noPLen; /* length of noPrint command */ |
Boolean hasErrCtl; /* set if can control error checking for |
Boolean hasErrCtl; /* set if can control error checking for |
* individual commands */ |
* individual commands */ |
char *errCheck; /* string to turn error checking on */ |
char *errCheck; /* string to turn error checking on */ |
|
|
/* |
/* |
* command-line flags |
* command-line flags |
*/ |
*/ |
char *echo; /* echo commands */ |
char *echo; /* echo commands */ |
char *exit; /* exit on error */ |
char *exit; /* exit on error */ |
} Shell; |
} Shell; |
|
|
|
|
extern char *targFmt; /* Format string for banner that separates |
#ifdef REMOTE |
|
extern char *targFmt; /* Format string for banner that separates |
* output from multiple jobs. Contains a |
* output from multiple jobs. Contains a |
* single %s where the name of the node being |
* single %s where the name of the node being |
* made should be put. */ |
* made should be put. */ |
extern GNode *lastNode; /* Last node for which a banner was printed. |
extern GNode *lastNode; /* Last node for which a banner was printed. |
* If Rmt module finds it necessary to print |
* If Rmt module finds it necessary to print |
* a banner, it should set this to the node |
* a banner, it should set this to the node |
* for which the banner was printed */ |
* for which the banner was printed */ |
extern int nJobs; /* Number of jobs running (local and remote) */ |
extern int nJobs; /* Number of jobs running (local and remote) */ |
extern int nLocal; /* Number of jobs running locally */ |
extern int nLocal; /* Number of jobs running locally */ |
extern LIST jobs; /* List of active job descriptors */ |
extern LIST jobs; /* List of active job descriptors */ |
extern LIST stoppedJobs; /* List of jobs that are stopped or didn't |
extern Boolean jobFull; /* Non-zero if no more jobs should/will start*/ |
|
extern LIST stoppedJobs; /* List of jobs that are stopped or didn't |
* quite get started */ |
* quite get started */ |
extern Boolean jobFull; /* Non-zero if no more jobs should/will start*/ |
#endif |
|
|
|
|
extern void Job_Touch __P((GNode *, Boolean)); |
extern void Job_Touch(GNode *, Boolean); |
extern Boolean Job_CheckCommands __P((GNode *, void (*abortProc )(char *, ...))); |
extern Boolean Job_CheckCommands(GNode *, |
extern void Job_CatchChildren __P((Boolean)); |
void (*abortProc )(char *, ...)); |
extern void Job_CatchOutput __P((void)); |
extern void Job_CatchChildren(Boolean); |
extern void Job_Make __P((GNode *)); |
extern void Job_CatchOutput(void); |
extern void Job_Init __P((int, int)); |
extern void Job_Make(GNode *); |
extern Boolean Job_Full __P((void)); |
extern void Job_Init(int, int); |
extern Boolean Job_Empty __P((void)); |
extern Boolean Job_Full(void); |
extern ReturnStatus Job_ParseShell __P((char *)); |
extern Boolean Job_Empty(void); |
extern int Job_Finish __P((void)); |
extern ReturnStatus Job_ParseShell(char *); |
extern void Job_End __P((void)); |
extern int Job_Finish(void); |
extern void Job_Wait __P((void)); |
extern void Job_End(void); |
extern void Job_AbortAll __P((void)); |
extern void Job_Wait(void); |
extern void JobFlagForMigration __P((int)); |
extern void Job_AbortAll(void); |
|
extern void JobFlagForMigration(int); |
|
|
#endif /* _JOB_H_ */ |
#endif /* _JOB_H_ */ |