[BACK]Return to job.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / make

Diff for /src/usr.bin/make/job.c between version 1.55 and 1.56

version 1.55, 2003/06/03 02:56:11 version 1.56, 2004/04/07 13:11:36
Line 457 
Line 457 
  *-----------------------------------------------------------------------   *-----------------------------------------------------------------------
  */   */
 static void  static void
 JobCondPassSig(jobp, signop)  JobCondPassSig(void *jobp,      /* Job to biff */
     void                *jobp;          /* Job to biff */      void *signop)               /* Signal to send it */
     void                *signop;        /* Signal to send it */  
 {  {
     Job *job = (Job *)jobp;      Job *job = (Job *)jobp;
     int signo = *(int *)signop;      int signo = *(int *)signop;
Line 483 
Line 482 
  *-----------------------------------------------------------------------   *-----------------------------------------------------------------------
  */   */
 static void  static void
 JobPassSig(signo)  JobPassSig(int signo) /* The signal number we've received */
     int     signo;      /* The signal number we've received */  
 {  {
     int save_errno = errno;      int save_errno = errno;
     sigset_t nmask, omask;      sigset_t nmask, omask;
Line 561 
Line 559 
  *-----------------------------------------------------------------------   *-----------------------------------------------------------------------
  */   */
 static int  static int
 JobCmpPid(job, pid)  JobCmpPid(void *job,    /* job to examine */
     void *job;  /* job to examine */      void *pid)          /* process id desired */
     void *pid;  /* process id desired */  
 {  {
     return *(pid_t *)pid - ((Job *)job)->pid;      return *(pid_t *)pid - ((Job *)job)->pid;
 }  }
Line 596 
Line 593 
  *-----------------------------------------------------------------------   *-----------------------------------------------------------------------
  */   */
 static int  static int
 JobPrintCommand(cmdp, jobp)  JobPrintCommand(void *cmdp,         /* command string to print */
     void        *cmdp;              /* command string to print */      void *jobp)                     /* job for which to print it */
     void        *jobp;              /* job for which to print it */  
 {  {
     bool          noSpecials;       /* true if we shouldn't worry about      bool          noSpecials;       /* true if we shouldn't worry about
                                      * inserting special commands into                                       * inserting special commands into
Line 750 
Line 746 
  *-----------------------------------------------------------------------   *-----------------------------------------------------------------------
  */   */
 static void  static void
 JobSaveCommand(cmd, gn)  JobSaveCommand(void *cmd, void *gn)
     void        *cmd;  
     void        *gn;  
 {  {
     GNode       *g = (GNode *)gn;      GNode       *g = (GNode *)gn;
     char        *result;      char        *result;
Line 772 
Line 766 
  *-----------------------------------------------------------------------   *-----------------------------------------------------------------------
  */   */
 static void  static void
 JobClose(job)  JobClose(Job *job)
     Job *job;  
 {  {
     if (usePipes) {      if (usePipes) {
         FD_CLR(job->inPipe, outputsp);          FD_CLR(job->inPipe, outputsp);
Line 810 
Line 803 
  */   */
 /*ARGSUSED*/  /*ARGSUSED*/
 static void  static void
 JobFinish(job, status)  JobFinish(Job *job,             /* job to finish */
     Job         *job;             /* job to finish */      int *status)                /* sub-why job went away */
     int         *status;          /* sub-why job went away */  
 {  {
     bool         done;      bool         done;
   
Line 1053 
Line 1045 
  *-----------------------------------------------------------------------   *-----------------------------------------------------------------------
  */   */
 void  void
 Job_Touch(gn, silent)  Job_Touch(GNode *gn,            /* the node of the file to touch */
     GNode         *gn;          /* the node of the file to touch */      bool silent)                /* true if should not print messages */
     bool          silent;       /* true if should not print messages */  
 {  {
     int           streamID;     /* ID of stream opened to do the touch */      int           streamID;     /* ID of stream opened to do the touch */
   
Line 1122 
Line 1113 
  *-----------------------------------------------------------------------   *-----------------------------------------------------------------------
  */   */
 bool  bool
 Job_CheckCommands(gn, abortProc)  Job_CheckCommands(GNode *gn,            /* The target whose commands need
     GNode          *gn;             /* The target whose commands need                                           * verifying */
                                      * verifying */      void (*abortProc)(char *, ...))     /* Function to abort with message */
     void         (*abortProc)(char *, ...);  
                         /* Function to abort with message */  
 {  {
     if (OP_NOP(gn->type) && Lst_IsEmpty(&gn->commands) &&      if (OP_NOP(gn->type) && Lst_IsEmpty(&gn->commands) &&
         (gn->type & OP_LIB) == 0) {          (gn->type & OP_LIB) == 0) {
Line 1185 
Line 1174 
  *-----------------------------------------------------------------------   *-----------------------------------------------------------------------
  */   */
 static void  static void
 JobExec(job, argv)  JobExec(Job *job, char **argv)
     Job           *job;         /* Job to execute */  
     char          **argv;  
 {  {
     pid_t         cpid;         /* ID of new child */      pid_t         cpid;         /* ID of new child */
   
Line 1326 
Line 1313 
  *-----------------------------------------------------------------------   *-----------------------------------------------------------------------
  */   */
 static void  static void
 JobMakeArgv(job, argv)  JobMakeArgv(Job *job, char **argv)
     Job           *job;  
     char          **argv;  
 {  {
     int           argc;      int           argc;
     static char   args[10];     /* For merged arguments */      static char   args[10];     /* For merged arguments */
Line 1378 
Line 1363 
  *-----------------------------------------------------------------------   *-----------------------------------------------------------------------
  */   */
 static void  static void
 JobRestart(job)  JobRestart(Job *job)
     Job           *job;         /* Job to restart */  
 {  {
     if (job->flags & JOB_RESTART) {      if (job->flags & JOB_RESTART) {
         /*          /*
Line 1506 
Line 1490 
  *-----------------------------------------------------------------------   *-----------------------------------------------------------------------
  */   */
 static int  static int
 JobStart(gn, flags, previous)  JobStart(GNode    *gn,        /* target to create */
     GNode         *gn;        /* target to create */      int            flags,      /* flags for the job to override normal ones.
     int            flags;      /* flags for the job to override normal ones.  
                                * e.g. JOB_SPECIAL or JOB_IGNDOTS */                                 * e.g. JOB_SPECIAL or JOB_IGNDOTS */
     Job           *previous;  /* The previous Job structure for this node,      Job           *previous)  /* The previous Job structure for this node,
                                * if any. */                                 * if any. */
 {  {
     Job           *job;       /* new job descriptor */      Job           *job;       /* new job descriptor */
Line 1776 
Line 1759 
 }  }
   
 static char *  static char *
 JobOutput(job, cp, endp, msg)  JobOutput(Job *job, char *cp, char *endp, int msg)
     Job *job;  
     char *cp, *endp;  
     int msg;  
 {  {
     char *ecp;      char *ecp;
   
Line 1846 
Line 1826 
  *-----------------------------------------------------------------------   *-----------------------------------------------------------------------
  */   */
 static void  static void
 JobDoOutput(job, finish)  JobDoOutput(Job           *job,   /* the job whose output needs printing */
     Job           *job;   /* the job whose output needs printing */      bool           finish)        /* true if this is the last time we'll be
     bool           finish;        /* true if this is the last time we'll be  
                                    * called for this job */                                     * called for this job */
 {  {
     bool          gotNL = false;  /* true if got a newline */      bool          gotNL = false;  /* true if got a newline */
Line 2038 
Line 2017 
  *-----------------------------------------------------------------------   *-----------------------------------------------------------------------
  */   */
 void  void
 Job_CatchChildren(block)  Job_CatchChildren(bool block)   /* true if should block on the wait. */
     bool          block;        /* true if should block on the wait. */  
 {  {
     pid_t         pid;          /* pid of dead child */      pid_t         pid;          /* pid of dead child */
     Job           *job;         /* job descriptor for dead child */      Job           *job;         /* job descriptor for dead child */
Line 2107 
Line 2085 
  * -----------------------------------------------------------------------   * -----------------------------------------------------------------------
  */   */
 void  void
 Job_CatchOutput()  Job_CatchOutput(void)
 {  {
     int                   nfds;      int                   nfds;
     struct timeval        timeout;      struct timeval        timeout;
Line 2153 
Line 2131 
  *-----------------------------------------------------------------------   *-----------------------------------------------------------------------
  */   */
 void  void
 Job_Make(gn)  Job_Make(GNode *gn)
     GNode   *gn;  
 {  {
     (void)JobStart(gn, 0, NULL);      (void)JobStart(gn, 0, NULL);
 }  }
Line 2169 
Line 2146 
  *-----------------------------------------------------------------------   *-----------------------------------------------------------------------
  */   */
 void  void
 Job_Init(maxproc, maxlocal)  Job_Init(int      maxproc,  /* the greatest number of jobs which may be
     int           maxproc;  /* the greatest number of jobs which may be  
                              * running at one time */                               * running at one time */
     int           maxlocal; /* the greatest number of local jobs which may      int           maxlocal) /* the greatest number of local jobs which may
                              * be running at once. */                               * be running at once. */
 {  {
     GNode         *begin;     /* node for commands to do at the very start */      GNode         *begin;     /* node for commands to do at the very start */
Line 2288 
Line 2264 
  *-----------------------------------------------------------------------   *-----------------------------------------------------------------------
  */   */
 bool  bool
 Job_Full()  Job_Full(void)
 {  {
     return aborting || jobFull;      return aborting || jobFull;
 }  }
Line 2306 
Line 2282 
  * -----------------------------------------------------------------------   * -----------------------------------------------------------------------
  */   */
 bool  bool
 Job_Empty()  Job_Empty(void)
 {  {
     if (nJobs == 0) {      if (nJobs == 0) {
         if (!Lst_IsEmpty(&stoppedJobs) && !aborting) {          if (!Lst_IsEmpty(&stoppedJobs) && !aborting) {
Line 2335 
Line 2311 
  *-----------------------------------------------------------------------   *-----------------------------------------------------------------------
  */   */
 static Shell *  static Shell *
 JobMatchShell(name)  JobMatchShell(char *name)     /* Final component of shell path */
     char          *name;      /* Final component of shell path */  
 {  {
     Shell         *sh;        /* Pointer into shells table */      Shell         *sh;        /* Pointer into shells table */
     Shell         *match;     /* Longest-matching shell */      Shell         *match;     /* Longest-matching shell */
Line 2406 
Line 2381 
  *-----------------------------------------------------------------------   *-----------------------------------------------------------------------
  */   */
 bool  bool
 Job_ParseShell(line)  Job_ParseShell(const char *line)        /* The shell spec */
     char          *line;  /* The shell spec */  
 {  {
     char          **words;      char          **words;
     int           wordCount;      int           wordCount;
Line 2541 
Line 2515 
  *-----------------------------------------------------------------------   *-----------------------------------------------------------------------
  */   */
 static void  static void
 JobInterrupt(runINTERRUPT, signo)  JobInterrupt(int runINTERRUPT,  /* Non-zero if commands for the .INTERRUPT
     int     runINTERRUPT;       /* Non-zero if commands for the .INTERRUPT  
                                  * target should be executed */                                   * target should be executed */
     int     signo;              /* signal received */      int     signo)              /* signal received */
 {  {
     LstNode       ln;           /* element in job table */      LstNode       ln;           /* element in job table */
     Job           *job;         /* job descriptor in that element */      Job           *job;         /* job descriptor in that element */
Line 2605 
Line 2578 
  *-----------------------------------------------------------------------   *-----------------------------------------------------------------------
  */   */
 int  int
 Job_Finish()  Job_Finish(void)
 {  {
     if (postCommands != NULL && !Lst_IsEmpty(&postCommands->commands)) {      if (postCommands != NULL && !Lst_IsEmpty(&postCommands->commands)) {
         if (errors) {          if (errors) {
Line 2634 
Line 2607 
  */   */
 #ifdef CLEANUP  #ifdef CLEANUP
 void  void
 Job_End()  Job_End(void)
 {  {
     efree(shellArgv);      efree(shellArgv);
 }  }
Line 2652 
Line 2625 
  *-----------------------------------------------------------------------   *-----------------------------------------------------------------------
  */   */
 void  void
 Job_Wait()  Job_Wait(void)
 {  {
     aborting = ABORT_WAIT;      aborting = ABORT_WAIT;
     while (nJobs != 0) {      while (nJobs != 0) {
Line 2674 
Line 2647 
  *-----------------------------------------------------------------------   *-----------------------------------------------------------------------
  */   */
 void  void
 Job_AbortAll()  Job_AbortAll(void)
 {  {
     LstNode             ln;     /* element in job table */      LstNode             ln;     /* element in job table */
     Job                 *job;   /* the job descriptor in that element */      Job                 *job;   /* the job descriptor in that element */
Line 2715 
Line 2688 
  *-----------------------------------------------------------------------   *-----------------------------------------------------------------------
  */   */
 static void  static void
 JobRestartJobs()  JobRestartJobs(void)
 {  {
     Job *job;      Job *job;
   

Legend:
Removed from v.1.55  
changed lines
  Added in v.1.56