diff options
| author | dsl <dsl@NetBSD.org> | 2006-03-08 22:11:48 +0000 |
|---|---|---|
| committer | dsl <dsl@NetBSD.org> | 2006-03-08 22:11:48 +0000 |
| commit | 5e60bf00ceea7fc62697ca69fce68883114eb273 (patch) | |
| tree | fc8916781d72fb5609cd2ee4bd2c3f683b1c8826 /usr.bin/make | |
| parent | a12ced4fd940133d3916a365c05ebbd977f28199 (diff) | |
Avoid calling JobRestartJobs() from the SIGCONT signal handler, instead
push a byte through the (now badly named) exit_pipe and call JobRestartJobs()
from the main code path when poll() wakes up.
Part of a plan to remove JobSigLock() and the zillions of system calls
it does.
Diffstat (limited to 'usr.bin/make')
| -rw-r--r-- | usr.bin/make/job.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/usr.bin/make/job.c b/usr.bin/make/job.c index 75f0e8f9dc2..fbb3532ae75 100644 --- a/usr.bin/make/job.c +++ b/usr.bin/make/job.c @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.104 2006/02/11 20:58:53 dsl Exp $ */ +/* $NetBSD: job.c,v 1.105 2006/03/08 22:11:48 dsl Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -70,14 +70,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: job.c,v 1.104 2006/02/11 20:58:53 dsl Exp $"; +static char rcsid[] = "$NetBSD: job.c,v 1.105 2006/03/08 22:11:48 dsl Exp $"; #else #include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)job.c 8.2 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: job.c,v 1.104 2006/02/11 20:58:53 dsl Exp $"); +__RCSID("$NetBSD: job.c,v 1.105 2006/03/08 22:11:48 dsl Exp $"); #endif #endif /* not lint */ #endif @@ -307,6 +307,8 @@ int job_pipe[2] = { -1, -1 }; /* job server pipes. */ static Job childExitJob; /* child exit pseudo-job */ int exit_pipe[2] = { -1, -1 }; /* child exit signal pipe. */ +#define CHILD_EXIT "." +#define DO_JOB_RESTART "R" #ifdef REMOTE # define TARG_FMT "--- %s at %s ---\n" /* Default format */ @@ -471,7 +473,7 @@ JobCondPassSig(ClientData jobp, ClientData signop) static void JobChildSig(int signo __unused) { - write(exit_pipe[1], ".", 1); + write(exit_pipe[1], CHILD_EXIT, 1); } @@ -495,7 +497,7 @@ JobChildSig(int signo __unused) static void JobContinueSig(int signo __unused) { - JobRestartJobs(); + write(exit_pipe[1], DO_JOB_RESTART, 1); } #endif @@ -2636,15 +2638,18 @@ Job_CatchOutput(void) return; } else { sigset_t mask; - JobSigLock(&mask); - if (Lst_Open(jobs) == FAILURE) { - Punt("Cannot open job table"); - } if (readyfd(&childExitJob)) { char token; (void)read(childExitJob.inPipe, &token, 1); nready -= 1; + if (token == DO_JOB_RESTART[0]) + JobRestartJobs(); + } + + JobSigLock(&mask); + if (Lst_Open(jobs) == FAILURE) { + Punt("Cannot open job table"); } while (nready && (ln = Lst_Next(jobs)) != NILLNODE) { |
