=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/make/job.c,v retrieving revision 1.94 retrieving revision 1.95 diff -c -r1.94 -r1.95 *** src/usr.bin/make/job.c 2007/10/09 09:34:05 1.94 --- src/usr.bin/make/job.c 2007/10/09 09:35:43 1.95 *************** *** 1,5 **** /* $OpenPackages$ */ ! /* $OpenBSD: job.c,v 1.94 2007/10/09 09:34:05 espie Exp $ */ /* $NetBSD: job.c,v 1.16 1996/11/06 17:59:08 christos Exp $ */ /* --- 1,5 ---- /* $OpenPackages$ */ ! /* $OpenBSD: job.c,v 1.95 2007/10/09 09:35:43 espie Exp $ */ /* $NetBSD: job.c,v 1.16 1996/11/06 17:59:08 christos Exp $ */ /* *************** *** 207,213 **** static int maxJobs; /* The most children we can run at once */ static int nJobs; /* The number of children currently running */ ! static LIST jobs; /* The structures that describe them */ static bool jobFull; /* Flag to tell when the job table is full. It * is set true when nJobs equals maxJobs */ static fd_set *outputsp; /* Set of descriptors of pipes connected to --- 207,213 ---- static int maxJobs; /* The most children we can run at once */ static int nJobs; /* The number of children currently running */ ! static LIST runningJobs; /* The structures that describe them */ static bool jobFull; /* Flag to tell when the job table is full. It * is set true when nJobs equals maxJobs */ static fd_set *outputsp; /* Set of descriptors of pipes connected to *************** *** 439,445 **** (void)fprintf(stdout, "handle_signal(%d) called.\n", signo); (void)fflush(stdout); } ! Lst_ForEach(&jobs, pass_signal_to_job, &signo); /* * Deal with proper cleanup based on the signal received. We only run --- 439,445 ---- (void)fprintf(stdout, "handle_signal(%d) called.\n", signo); (void)fflush(stdout); } ! Lst_ForEach(&runningJobs, pass_signal_to_job, &signo); /* * Deal with proper cleanup based on the signal received. We only run *************** *** 486,492 **** (void)KILL(getpid(), signo); signo = SIGCONT; ! Lst_ForEach(&jobs, pass_signal_to_job, &signo); (void)sigprocmask(SIG_SETMASK, &omask, NULL); sigprocmask(SIG_SETMASK, &omask, NULL); --- 486,492 ---- (void)KILL(getpid(), signo); signo = SIGCONT; ! Lst_ForEach(&runningJobs, pass_signal_to_job, &signo); (void)sigprocmask(SIG_SETMASK, &omask, NULL); sigprocmask(SIG_SETMASK, &omask, NULL); *************** *** 848,854 **** #endif } job->flags &= ~JOB_CONTINUING; ! Lst_AtEnd(&jobs, job); nJobs++; debug_printf("Process %ld is continuing locally.\n", (long)job->pid); --- 848,854 ---- #endif } job->flags &= ~JOB_CONTINUING; ! Lst_AtEnd(&runningJobs, job); nJobs++; debug_printf("Process %ld is continuing locally.\n", (long)job->pid); *************** *** 1043,1049 **** * Now the job is actually running, add it to the table. */ nJobs++; ! Lst_AtEnd(&jobs, job); if (nJobs == maxJobs) { jobFull = true; } --- 1043,1049 ---- * Now the job is actually running, add it to the table. */ nJobs++; ! Lst_AtEnd(&runningJobs, job); if (nJobs == maxJobs) { jobFull = true; } *************** *** 1610,1616 **** handle_all_signals(); debug_printf("Process %ld exited or stopped.\n", (long)pid); ! jnode = Lst_Find(&jobs, JobCmpPid, &pid); if (jnode == NULL) { if (WIFSIGNALED(status) && --- 1610,1616 ---- handle_all_signals(); debug_printf("Process %ld exited or stopped.\n", (long)pid); ! jnode = Lst_Find(&runningJobs, JobCmpPid, &pid); if (jnode == NULL) { if (WIFSIGNALED(status) && *************** *** 1628,1634 **** } } else { job = (Job *)Lst_Datum(jnode); ! Lst_Remove(&jobs, jnode); nJobs--; if (jobFull) debug_printf("Job queue is no longer full.\n"); --- 1628,1634 ---- } } else { job = (Job *)Lst_Datum(jnode); ! Lst_Remove(&runningJobs, jnode); nJobs--; if (jobFull) debug_printf("Job queue is no longer full.\n"); *************** *** 1674,1680 **** nfds = select(outputsn+1, readfdsp, NULL, NULL, &timeout); handle_all_signals(); if (nfds > 0) { ! for (ln = Lst_First(&jobs); nfds && ln != NULL; ln = Lst_Adv(ln)) { job = (Job *)Lst_Datum(ln); if (FD_ISSET(job->inPipe, readfdsp)) { --- 1674,1680 ---- nfds = select(outputsn+1, readfdsp, NULL, NULL, &timeout); handle_all_signals(); if (nfds > 0) { ! for (ln = Lst_First(&runningJobs); nfds && ln != NULL; ln = Lst_Adv(ln)) { job = (Job *)Lst_Datum(ln); if (FD_ISSET(job->inPipe, readfdsp)) { *************** *** 1747,1753 **** void Job_Init(int maxproc) { ! Static_Lst_Init(&jobs); Static_Lst_Init(&stoppedJobs); maxJobs = maxproc; nJobs = 0; --- 1747,1753 ---- void Job_Init(int maxproc) { ! Static_Lst_Init(&runningJobs); Static_Lst_Init(&stoppedJobs); maxJobs = maxproc; nJobs = 0; *************** *** 1847,1853 **** aborting = ABORT_INTERRUPT; ! for (ln = Lst_First(&jobs); ln != NULL; ln = Lst_Adv(ln)) { job = (Job *)Lst_Datum(ln); if (!Targ_Precious(job->node)) { --- 1847,1853 ---- aborting = ABORT_INTERRUPT; ! for (ln = Lst_First(&runningJobs); ln != NULL; ln = Lst_Adv(ln)) { job = (Job *)Lst_Datum(ln); if (!Targ_Precious(job->node)) { *************** *** 1957,1963 **** aborting = ABORT_ERROR; if (nJobs) { ! for (ln = Lst_First(&jobs); ln != NULL; ln = Lst_Adv(ln)) { job = (Job *)Lst_Datum(ln); /* --- 1957,1964 ---- aborting = ABORT_ERROR; if (nJobs) { ! for (ln = Lst_First(&runningJobs); ln != NULL; ! ln = Lst_Adv(ln)) { job = (Job *)Lst_Datum(ln); /*