[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.67 and 1.68

version 1.67, 2007/09/17 08:36:57 version 1.68, 2007/09/17 09:28:36
Line 539 
Line 539 
 /*-  /*-
  *-----------------------------------------------------------------------   *-----------------------------------------------------------------------
  * JobPassSig --   * JobPassSig --
  *      Pass a signal to all local jobs if USE_PGRP is defined,   *      Pass a signal to all local jobs if USE_PGRP is defined,
  *      then die ourselves.   *      then die ourselves.
  *   *
  * Side Effects:   * Side Effects:
Line 787 
Line 787 
                  * echoOff command. Otherwise we issue it and pretend it was on                   * echoOff command. Otherwise we issue it and pretend it was on
                  * for the whole command...                   * for the whole command...
                  */                   */
                 if (!shutUp && !(job->flags & JOB_SILENT) &&                  if (!shutUp && !(job->flags & JOB_SILENT) &&
                     commandShell->hasEchoCtl){                      commandShell->hasEchoCtl){
                         DBPRINTF("%s\n", commandShell->echoOff);                          DBPRINTF("%s\n", commandShell->echoOff);
                         shutUp = true;                          shutUp = true;
Line 930 
Line 930 
   
                 if (WIFEXITED(*status)) {                  if (WIFEXITED(*status)) {
                         if (DEBUG(JOB)) {                          if (DEBUG(JOB)) {
                                 (void)fprintf(stdout, "Process %ld exited.\n",                                  (void)fprintf(stdout, "Process %ld exited.\n",
                                     (long)job->pid);                                      (long)job->pid);
                                 (void)fflush(stdout);                                  (void)fflush(stdout);
                         }                          }
Line 941 
Line 941 
                                 }                                  }
                                 (void)fprintf(out, "*** Error code %d%s\n",                                  (void)fprintf(out, "*** Error code %d%s\n",
                                     WEXITSTATUS(*status),                                      WEXITSTATUS(*status),
                                     (job->flags & JOB_IGNERR) ? "(ignored)" :                                      (job->flags & JOB_IGNERR) ? "(ignored)" :
                                     "");                                      "");
   
                                 if (job->flags & JOB_IGNERR) {                                  if (job->flags & JOB_IGNERR) {
Line 952 
Line 952 
                                         MESSAGE(out, job->node);                                          MESSAGE(out, job->node);
                                         lastNode = job->node;                                          lastNode = job->node;
                                 }                                  }
                                 (void)fprintf(out,                                  (void)fprintf(out,
                                     "*** Completed successfully\n");                                      "*** Completed successfully\n");
                         }                          }
                 } else if (WIFSTOPPED(*status)) {                  } else if (WIFSTOPPED(*status)) {
                         if (DEBUG(JOB)) {                          if (DEBUG(JOB)) {
                                 (void)fprintf(stdout, "Process %ld stopped.\n",                                  (void)fprintf(stdout, "Process %ld stopped.\n",
                                     (long)job->pid);                                      (long)job->pid);
                                 (void)fflush(stdout);                                  (void)fflush(stdout);
                         }                          }
Line 1016 
Line 1016 
                         if (nJobs == maxJobs) {                          if (nJobs == maxJobs) {
                                 jobFull = true;                                  jobFull = true;
                                 if (DEBUG(JOB)) {                                  if (DEBUG(JOB)) {
                                         (void)fprintf(stdout,                                          (void)fprintf(stdout,
                                             "Job queue is full.\n");                                              "Job queue is full.\n");
                                         (void)fflush(stdout);                                          (void)fflush(stdout);
                                 }                                  }
Line 1028 
Line 1028 
                                 MESSAGE(out, job->node);                                  MESSAGE(out, job->node);
                                 lastNode = job->node;                                  lastNode = job->node;
                         }                          }
                         (void)fprintf(out, "*** Signal %d\n",                          (void)fprintf(out, "*** Signal %d\n",
                             WTERMSIG(*status));                              WTERMSIG(*status));
                 }                  }
   
Line 1218 
Line 1218 
                                 int bytes, obytes;                                  int bytes, obytes;
                                 char *tmp;                                  char *tmp;
   
                                 bytes = howmany(job->inPipe+1, NFDBITS) *                                  bytes = howmany(job->inPipe+1, NFDBITS) *
                                     sizeof(fd_mask);                                      sizeof(fd_mask);
                                 obytes = outputsn ?                                  obytes = outputsn ?
                                     howmany(outputsn+1, NFDBITS) *                                      howmany(outputsn+1, NFDBITS) *
                                     sizeof(fd_mask) : 0;                                      sizeof(fd_mask) : 0;
   
                                 if (bytes != obytes) {                                  if (bytes != obytes) {
Line 1330 
Line 1330 
                 JobMakeArgv(job, argv);                  JobMakeArgv(job, argv);
   
                 if (DEBUG(JOB)) {                  if (DEBUG(JOB)) {
                         (void)fprintf(stdout, "Restarting %s...",                          (void)fprintf(stdout, "Restarting %s...",
                             job->node->name);                              job->node->name);
                         (void)fflush(stdout);                          (void)fflush(stdout);
                 }                  }
Line 1563 
Line 1563 
                          * sanity                           * sanity
                          */                           */
                         numCommands = 0;                          numCommands = 0;
                         Lst_ForEachNodeWhile(&gn->commands, JobPrintCommand,                          Lst_ForEachNodeWhile(&gn->commands, JobPrintCommand,
                             job);                              job);
   
                         /*                          /*
Line 1593 
Line 1593 
                  * good.                   * good.
                  */                   */
                 if (cmdsOK) {                  if (cmdsOK) {
                         Lst_ForEachNodeWhile(&gn->commands, JobPrintCommand,                          Lst_ForEachNodeWhile(&gn->commands, JobPrintCommand,
                             job);                              job);
                 }                  }
                 /*                  /*
Line 1633 
Line 1633 
                  */                   */
                 if (cmdsOK) {                  if (cmdsOK) {
                         if (aborting == 0) {                          if (aborting == 0) {
                                 Lst_ForEachFrom(job->tailCmds, JobSaveCommand,                                  Lst_ForEachFrom(job->tailCmds, JobSaveCommand,
                                     job->node);                                      job->node);
                                 Make_Update(job->node);                                  Make_Update(job->node);
                         }                          }
Line 1671 
Line 1671 
                 } else {                  } else {
                         (void)fprintf(stdout, "Remaking `%s'\n", gn->name);                          (void)fprintf(stdout, "Remaking `%s'\n", gn->name);
                         (void)fflush(stdout);                          (void)fflush(stdout);
                         (void)strlcpy(job->outFile, TMPPAT,                          (void)strlcpy(job->outFile, TMPPAT,
                             sizeof(job->outFile));                              sizeof(job->outFile));
                         if ((job->outFd = mkstemp(job->outFile)) == -1)                          if ((job->outFd = mkstemp(job->outFile)) == -1)
                                 Punt("Cannot create temp file: %s",                                  Punt("Cannot create temp file: %s",
                                     strerror(errno));                                      strerror(errno));
                         (void)fcntl(job->outFd, F_SETFD, 1);                          (void)fcntl(job->outFd, F_SETFD, 1);
                 }                  }
Line 1711 
Line 1711 
                          */                           */
                         jobFull = true;                          jobFull = true;
                         if (DEBUG(JOB)) {                          if (DEBUG(JOB)) {
                                 (void)fprintf(stdout,                                  (void)fprintf(stdout,
                                     "Local job queue is full.\n");                                      "Local job queue is full.\n");
                                 (void)fflush(stdout);                                  (void)fflush(stdout);
                         }                          }
Line 1753 
Line 1753 
                                  * non-printable command....                                   * non-printable command....
                                  */                                   */
                                 cp++;                                  cp++;
                                 while (*cp == ' ' || *cp == '\t' ||                                  while (*cp == ' ' || *cp == '\t' ||
                                     *cp == '\n') {                                      *cp == '\n') {
                                         cp++;                                          cp++;
                                 }                                  }
Line 1885 
Line 1885 
                         if (i >= job->curPos) {                          if (i >= job->curPos) {
                                 char *cp;                                  char *cp;
   
                                 cp = JobOutput(job, job->outBuf,                                  cp = JobOutput(job, job->outBuf,
                                     &job->outBuf[i], false);                                      &job->outBuf[i], false);
   
                                 /*                                  /*
Line 1898 
Line 1898 
                                                 MESSAGE(stdout, job->node);                                                  MESSAGE(stdout, job->node);
                                                 lastNode = job->node;                                                  lastNode = job->node;
                                         }                                          }
                                         (void)fprintf(stdout, "%s%s", cp,                                          (void)fprintf(stdout, "%s%s", cp,
                                             gotNL ? "\n" : "");                                              gotNL ? "\n" : "");
                                         (void)fflush(stdout);                                          (void)fflush(stdout);
                                 }                                  }
                         }                          }
                         if (i < max - 1) {                          if (i < max - 1) {
                                 /* shift the remaining characters down */                                  /* shift the remaining characters down */
                                 (void)memcpy(job->outBuf, &job->outBuf[i + 1],                                  (void)memcpy(job->outBuf, &job->outBuf[i + 1],
                                     max - (i + 1));                                      max - (i + 1));
                                 job->curPos = max - (i + 1);                                  job->curPos = max - (i + 1);
   
Line 1943 
Line 1943 
                  */                   */
                 oFILE = fopen(job->outFile, "r");                  oFILE = fopen(job->outFile, "r");
                 if (oFILE != NULL) {                  if (oFILE != NULL) {
                         (void)fprintf(stdout, "Results of making %s:\n",                          (void)fprintf(stdout, "Results of making %s:\n",
                             job->node->name);                              job->node->name);
                         (void)fflush(stdout);                          (void)fflush(stdout);
                         while (fgets(inLine, sizeof(inLine), oFILE) != NULL) {                          while (fgets(inLine, sizeof(inLine), oFILE) != NULL) {
Line 2008 
Line 2008 
             (block?0:WNOHANG)|WUNTRACED)) > 0) {              (block?0:WNOHANG)|WUNTRACED)) > 0) {
                 HandleSigs();                  HandleSigs();
                 if (DEBUG(JOB)) {                  if (DEBUG(JOB)) {
                         (void)fprintf(stdout,                          (void)fprintf(stdout,
                             "Process %ld exited or stopped.\n", (long)pid);                              "Process %ld exited or stopped.\n", (long)pid);
                         (void)fflush(stdout);                          (void)fflush(stdout);
                 }                  }
Line 2017 
Line 2017 
                 jnode = Lst_Find(&jobs, JobCmpPid, &pid);                  jnode = Lst_Find(&jobs, JobCmpPid, &pid);
   
                 if (jnode == NULL) {                  if (jnode == NULL) {
                         if (WIFSIGNALED(status) &&                          if (WIFSIGNALED(status) &&
                             (WTERMSIG(status) == SIGCONT)) {                              (WTERMSIG(status) == SIGCONT)) {
                                 jnode = Lst_Find(&stoppedJobs, JobCmpPid, &pid);                                  jnode = Lst_Find(&stoppedJobs, JobCmpPid, &pid);
                                 if (jnode == NULL) {                                  if (jnode == NULL) {
Line 2035 
Line 2035 
                         Lst_Remove(&jobs, jnode);                          Lst_Remove(&jobs, jnode);
                         nJobs--;                          nJobs--;
                         if (jobFull && DEBUG(JOB)) {                          if (jobFull && DEBUG(JOB)) {
                                 (void)fprintf(stdout,                                  (void)fprintf(stdout,
                                     "Job queue is no longer full.\n");                                      "Job queue is no longer full.\n");
                                 (void)fflush(stdout);                                  (void)fflush(stdout);
                         }                          }
Line 2086 
Line 2086 
                         return;                          return;
                 } else {                  } else {
                         HandleSigs();                          HandleSigs();
                         for (ln = Lst_First(&jobs); nfds && ln != NULL;                          for (ln = Lst_First(&jobs); nfds && ln != NULL;
                             ln = Lst_Adv(ln)) {                              ln = Lst_Adv(ln)) {
                                 job = (Job *)Lst_Datum(ln);                                  job = (Job *)Lst_Datum(ln);
                                 if (FD_ISSET(job->inPipe, readfdsp)) {                                  if (FD_ISSET(job->inPipe, readfdsp)) {

Legend:
Removed from v.1.67  
changed lines
  Added in v.1.68