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

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/usr.bin/make/job.c between version 1.101 and 1.102

version 1.101, 2006/01/04 21:31:55 version 1.102, 2006/01/21 19:18:37
Line 963  JobClose(Job *job)
Line 963  JobClose(Job *job)
 static void  static void
 JobFinish(Job *job, int *status)  JobFinish(Job *job, int *status)
 {  {
     Boolean      done;      Boolean      done, return_job_token;
   
     if ((WIFEXITED(*status) &&      if ((WIFEXITED(*status) &&
          (((WEXITSTATUS(*status) != 0) && !(job->flags & JOB_IGNERR)))) ||           (((WEXITSTATUS(*status) != 0) && !(job->flags & JOB_IGNERR)))) ||
Line 1182  JobFinish(Job *job, int *status)
Line 1182  JobFinish(Job *job, int *status)
         done = TRUE;          done = TRUE;
     }      }
   
       return_job_token = FALSE;
   
     if (done) {      if (done) {
         Trace_Log(JOBEND, job);          Trace_Log(JOBEND, job);
         if (!compatMake && !(job->flags & JOB_SPECIAL)) {          if (!compatMake && !(job->flags & JOB_SPECIAL)) {
             if ((*status != 0) ||              if ((*status != 0) ||
                 (aborting == ABORT_ERROR) ||                      (aborting == ABORT_ERROR) ||
                 (aborting == ABORT_INTERRUPT))                      (aborting == ABORT_INTERRUPT))
                 Job_TokenReturn();                  return_job_token = TRUE;
         }          }
   
     }      }
   
     if (done &&      if (done &&
Line 1211  JobFinish(Job *job, int *status)
Line 1212  JobFinish(Job *job, int *status)
         }          }
         job->node->made = MADE;          job->node->made = MADE;
         if (!(job->flags & JOB_SPECIAL))          if (!(job->flags & JOB_SPECIAL))
             Job_TokenReturn();              return_job_token = TRUE;
         Make_Update(job->node);          Make_Update(job->node);
         free(job);          free(job);
     } else if (*status != 0) {      } else if (*status != 0) {
Line 1232  JobFinish(Job *job, int *status)
Line 1233  JobFinish(Job *job, int *status)
         aborting = ABORT_ERROR;          aborting = ABORT_ERROR;
     }      }
   
       if (return_job_token)
           Job_TokenReturn();
   
     if ((aborting == ABORT_ERROR) && Job_Empty()) {      if ((aborting == ABORT_ERROR) && Job_Empty()) {
         /*          /*
          * If we are aborting and the job table is now empty, we finish.           * If we are aborting and the job table is now empty, we finish.
Line 2842  static void JobSigReset(void)
Line 2846  static void JobSigReset(void)
 Boolean  Boolean
 Job_Empty(void)  Job_Empty(void)
 {  {
     if (nJobs == 0) {      if (nJobs != 0)
         if (!Lst_IsEmpty(stoppedJobs) && !aborting) {          return FALSE;
             /*  
              * The job table is obviously not full if it has no jobs in      if (Lst_IsEmpty(stoppedJobs) || aborting)
              * it...Try and restart the stopped jobs.          return TRUE;
              */  
             JobRestartJobs();      /*
             return(FALSE);       * The job table is obviously not full if it has no jobs in
         } else {       * it...Try and restart the stopped jobs.
             return(TRUE);       */
         }      JobRestartJobs();
     } else {      return FALSE;
         return(FALSE);  
     }  
 }  }
   
 /*-  /*-
Line 3612  Job_TokenReturn(void)
Line 3614  Job_TokenReturn(void)
     jobTokensRunning--;      jobTokensRunning--;
     if (jobTokensRunning < 0)      if (jobTokensRunning < 0)
         Punt("token botch");          Punt("token botch");
     if (jobTokensRunning)      if (jobTokensRunning || JOB_TOKENS[aborting] != '+')
         JobTokenAdd();          JobTokenAdd();
 }  }
   
Line 3645  Job_TokenWithdraw(void)
Line 3647  Job_TokenWithdraw(void)
                 getpid(), aborting, jobTokensRunning);                  getpid(), aborting, jobTokensRunning);
   
     if (aborting)      if (aborting)
             return FALSE;          return FALSE;
   
     if (jobTokensRunning == 0) {  
         if (DEBUG(JOB))  
             printf("first one's free\n");  
         jobTokensRunning++;  
         return TRUE;  
     }  
     count = read(job_pipe[0], &tok, 1);      count = read(job_pipe[0], &tok, 1);
     if (count == 0)      if (count == 0)
         Fatal("eof on job pipe!");          Fatal("eof on job pipe!");
     else if (count < 0) {      if (count < 0 && jobTokensRunning != 0) {
         if (errno != EAGAIN) {          if (errno != EAGAIN) {
             Fatal("job pipe read: %s", strerror(errno));              Fatal("job pipe read: %s", strerror(errno));
         }          }
Line 3665  Job_TokenWithdraw(void)
Line 3661  Job_TokenWithdraw(void)
         wantToken = TRUE;          wantToken = TRUE;
         return FALSE;          return FALSE;
     }      }
     if (tok != '+') {  
       if (count == 1 && tok != '+') {
         /* Remove any other job tokens */          /* Remove any other job tokens */
         if (DEBUG(JOB))          if (DEBUG(JOB))
             printf("(%d) abort token %c\n", getpid(), tok);              printf("(%d) aborted by token %c\n", getpid(), tok);
         while (read(job_pipe[0], &tok1, 1) == 1)          while (read(job_pipe[0], &tok1, 1) == 1)
             continue;              continue;
         /* And put the stopper back */          /* And put the stopper back */
         write(job_pipe[1], &tok, 1);          write(job_pipe[1], &tok, 1);
         aborting = ABORT_ERROR;          Fatal("A failure has been detected in another branch of the parallel make");
         return FALSE;  
     }      }
   
       if (count == 1 && jobTokensRunning == 0)
           /* We didn't want the token really */
           write(job_pipe[1], &tok, 1);
   
     jobTokensRunning++;      jobTokensRunning++;
     if (DEBUG(JOB))      if (DEBUG(JOB))
         printf("(%d) withdrew token\n", getpid());          printf("(%d) withdrew token\n", getpid());

Legend:
Removed from v.1.101  
changed lines
  Added in v.1.102

CVSweb <webmaster@jp.NetBSD.org>