[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.50 and 1.51

version 1.50, 2002/03/19 00:08:31 version 1.51, 2002/06/12 06:07:16
Line 173 
Line 173 
  */   */
 #define JOB_BUFSIZE     1024  #define JOB_BUFSIZE     1024
 typedef struct Job_ {  typedef struct Job_ {
     int         pid;        /* The child's process ID */      pid_t       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 */
Line 469 
Line 469 
     int signo = *(int *)signop;      int signo = *(int *)signop;
     if (DEBUG(JOB)) {      if (DEBUG(JOB)) {
         (void)fprintf(stdout,          (void)fprintf(stdout,
                        "JobCondPassSig passing signal %d to child %d.\n",                         "JobCondPassSig passing signal %d to child %ld.\n",
                        signo, job->pid);                         signo, (long)job->pid);
         (void)fflush(stdout);          (void)fflush(stdout);
     }      }
     KILL(job->pid, signo);      KILL(job->pid, signo);
Line 569 
Line 569 
     void *job;  /* job to examine */      void *job;  /* job to examine */
     void *pid;  /* process id desired */      void *pid;  /* process id desired */
 {  {
     return *(int *)pid - ((Job *)job)->pid;      return *(pid_t *)pid - ((Job *)job)->pid;
 }  }
   
 /*-  /*-
Line 880 
Line 880 
   
         if (WIFEXITED(*status)) {          if (WIFEXITED(*status)) {
             if (DEBUG(JOB)) {              if (DEBUG(JOB)) {
                 (void)fprintf(stdout, "Process %d exited.\n", job->pid);                  (void)fprintf(stdout, "Process %ld exited.\n", (long)job->pid);
                 (void)fflush(stdout);                  (void)fflush(stdout);
             }              }
             if (WEXITSTATUS(*status) != 0) {              if (WEXITSTATUS(*status) != 0) {
Line 904 
Line 904 
             }              }
         } else if (WIFSTOPPED(*status)) {          } else if (WIFSTOPPED(*status)) {
             if (DEBUG(JOB)) {              if (DEBUG(JOB)) {
                 (void)fprintf(stdout, "Process %d stopped.\n", job->pid);                  (void)fprintf(stdout, "Process %ld stopped.\n", (long)job->pid);
                 (void)fflush(stdout);                  (void)fflush(stdout);
             }              }
             if (usePipes && job->node != lastNode) {              if (usePipes && job->node != lastNode) {
Line 933 
Line 933 
             if (!(job->flags & JOB_CONTINUING)) {              if (!(job->flags & JOB_CONTINUING)) {
                 if (DEBUG(JOB)) {                  if (DEBUG(JOB)) {
                     (void)fprintf(stdout,                      (void)fprintf(stdout,
                                    "Warning: process %d was not continuing.\n",                                     "Warning: process %ld was not continuing.\n",
                                    job->pid);                                     (long)job->pid);
                     (void)fflush(stdout);                      (void)fflush(stdout);
                 }                  }
 #ifdef notdef  #ifdef notdef
Line 952 
Line 952 
             nJobs += 1;              nJobs += 1;
             if (DEBUG(JOB)) {              if (DEBUG(JOB)) {
                 (void)fprintf(stdout,                  (void)fprintf(stdout,
                                "Process %d is continuing locally.\n",                                 "Process %ld is continuing locally.\n",
                                job->pid);                                 (long)job->pid);
                 (void)fflush(stdout);                  (void)fflush(stdout);
             }              }
             nLocal += 1;              nLocal += 1;
Line 1193 
Line 1193 
     Job           *job;         /* Job to execute */      Job           *job;         /* Job to execute */
     char          **argv;      char          **argv;
 {  {
     int           cpid;         /* ID of new child */      pid_t         cpid;         /* ID of new child */
   
     if (DEBUG(JOB)) {      if (DEBUG(JOB)) {
         int       i;          int       i;
Line 2045 
Line 2045 
 Job_CatchChildren(block)  Job_CatchChildren(block)
     bool          block;        /* true if should block on the wait. */      bool          block;        /* true if should block on the wait. */
 {  {
     int           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 */
     LstNode       jnode;        /* list element for finding job */      LstNode       jnode;        /* list element for finding job */
     int           status;       /* Exit/termination status */      int           status;       /* Exit/termination status */
Line 2061 
Line 2061 
                           (block?0:WNOHANG)|WUNTRACED)) > 0)                            (block?0:WNOHANG)|WUNTRACED)) > 0)
     {      {
         if (DEBUG(JOB)) {          if (DEBUG(JOB)) {
             (void)fprintf(stdout, "Process %d exited or stopped.\n", pid);              (void)fprintf(stdout, "Process %ld exited or stopped.\n", (long)pid);
             (void)fflush(stdout);              (void)fflush(stdout);
         }          }
   
Line 2072 
Line 2072 
             if (WIFSIGNALED(status) && (WTERMSIG(status) == SIGCONT)) {              if (WIFSIGNALED(status) && (WTERMSIG(status) == SIGCONT)) {
                 jnode = Lst_Find(&stoppedJobs, JobCmpPid, &pid);                  jnode = Lst_Find(&stoppedJobs, JobCmpPid, &pid);
                 if (jnode == NULL) {                  if (jnode == NULL) {
                     Error("Resumed child (%d) not in table", pid);                      Error("Resumed child (%ld) not in table", (long)pid);
                     continue;                      continue;
                 }                  }
                 job = (Job *)Lst_Datum(jnode);                  job = (Job *)Lst_Datum(jnode);
                 Lst_Remove(&stoppedJobs, jnode);                  Lst_Remove(&stoppedJobs, jnode);
             } else {              } else {
                 Error("Child (%d) not in table?", pid);                  Error("Child (%ld) not in table?", (long)pid);
                 continue;                  continue;
             }              }
         } else {          } else {
Line 2570 
Line 2570 
         if (job->pid) {          if (job->pid) {
             if (DEBUG(JOB)) {              if (DEBUG(JOB)) {
                 (void)fprintf(stdout,                  (void)fprintf(stdout,
                                "JobInterrupt passing signal to child %d.\n",                                 "JobInterrupt passing signal to child %ld.\n",
                                job->pid);                                 (long)job->pid);
                 (void)fflush(stdout);                  (void)fflush(stdout);
             }              }
             KILL(job->pid, signo);              KILL(job->pid, signo);
Line 2702 
Line 2702 
     /*      /*
      * Catch as many children as want to report in at first, then give up       * Catch as many children as want to report in at first, then give up
      */       */
     while (waitpid((pid_t) -1, &foo, WNOHANG) > 0)      while (waitpid(-1, &foo, WNOHANG) > 0)
         continue;          continue;
     (void)eunlink(tfile);      (void)eunlink(tfile);
 }  }

Legend:
Removed from v.1.50  
changed lines
  Added in v.1.51