summaryrefslogtreecommitdiff
path: root/usr.bin/make/job.c
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2007-09-23 09:44:40 +0000
committerMarc Espie <espie@cvs.openbsd.org>2007-09-23 09:44:40 +0000
commit43b8de5801167c09a0ef8fc32678dd0eef3a978e (patch)
tree5be3acf95f26f57eca28f313c99036ec91b2c332 /usr.bin/make/job.c
parent5e2a1c6aaa726f6749c8669bc00813d4ae7c6a64 (diff)
kill local/jobs distinction. Correctly this time...
Diffstat (limited to 'usr.bin/make/job.c')
-rw-r--r--usr.bin/make/job.c44
1 files changed, 15 insertions, 29 deletions
diff --git a/usr.bin/make/job.c b/usr.bin/make/job.c
index 85726b4c6bf..a79ad784239 100644
--- a/usr.bin/make/job.c
+++ b/usr.bin/make/job.c
@@ -1,5 +1,5 @@
/* $OpenPackages$ */
-/* $OpenBSD: job.c,v 1.82 2007/09/23 09:41:11 espie Exp $ */
+/* $OpenBSD: job.c,v 1.83 2007/09/23 09:44:39 espie Exp $ */
/* $NetBSD: job.c,v 1.16 1996/11/06 17:59:08 christos Exp $ */
/*
@@ -160,8 +160,7 @@ typedef struct Job_ {
short flags; /* Flags to control treatment of job */
#define JOB_IGNERR 0x001 /* Ignore non-zero exits */
#define JOB_SILENT 0x002 /* no output */
-#define JOB_SPECIAL 0x004 /* Target is a special one. i.e. run it locally
- * if we can't export it and maxLocal is 0 */
+#define JOB_SPECIAL 0x004 /* Target is a special one. */
#define JOB_IGNDOTS 0x008 /* Ignore "..." lines when processing
* commands */
#define JOB_FIRST 0x020 /* Job is first job for the node */
@@ -223,15 +222,10 @@ static const char *shellName = "sh";
static int maxJobs; /* The most children we can run at once */
-static int maxLocal; /* The most local ones we can have */
-static int nJobs = 0; /* The number of children currently running */
-static int nLocal; /* The number of local children */
+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 (1) the total number of
- * running jobs equals the maximum allowed or
- * (2) a job can only be run locally, but
- * nLocal equals maxLocal */
+ * is set true when nJobs equals maxJobs */
static fd_set *outputsp; /* Set of descriptors of pipes connected to
* the output channels of children */
static int outputsn;
@@ -842,7 +836,6 @@ JobFinish(Job *job, /* job to finish */
(long)job->pid);
(void)fflush(stdout);
}
- nLocal++;
if (nJobs == maxJobs) {
jobFull = true;
if (DEBUG(JOB)) {
@@ -1065,7 +1058,6 @@ JobExec(Job *job, char **argv)
}
}
- nLocal += 1;
/*
* Now the job is actually running, add it to the table.
*/
@@ -1133,7 +1125,7 @@ JobRestart(Job *job)
job->node->name);
(void)fflush(stdout);
}
- if (nLocal >= maxLocal && !(job->flags & JOB_SPECIAL)) {
+ if (nJobs >= maxJobs && !(job->flags & JOB_SPECIAL)) {
/*
* Can't be exported and not allowed to run locally --
* put it back on the hold queue and mark the table
@@ -1169,11 +1161,11 @@ JobRestart(Job *job)
(void)fprintf(stdout, "Resuming %s...", job->node->name);
(void)fflush(stdout);
}
- if ((nLocal < maxLocal || ((job->flags & JOB_SPECIAL) &&
- maxLocal == 0)) && nJobs != maxJobs) {
+ if ((nJobs < maxJobs || ((job->flags & JOB_SPECIAL) &&
+ maxJobs == 0)) && nJobs != maxJobs) {
/*
* If we haven't reached the concurrency limit already
- * (or maxLocal is 0), it's ok to resume the job.
+ * (or maxJobs is 0), it's ok to resume the job.
*/
bool error;
int status;
@@ -1247,7 +1239,6 @@ JobStart(GNode *gn, /* target to create */
Job *job; /* new job descriptor */
char *argv[4]; /* Argument vector to shell */
bool cmdsOK; /* true if the nodes commands were all right */
- bool local; /* Set true if the job was run locally */
bool noExec; /* Set true if we decide not to run the job */
if (previous != NULL) {
@@ -1466,18 +1457,16 @@ JobStart(GNode *gn, /* target to create */
(void)fcntl(job->outPipe, F_SETFD, 1);
}
- local = true;
-
- if (local && nLocal >= maxLocal && !(job->flags & JOB_SPECIAL) &&
- maxLocal != 0) {
+ if (nJobs >= maxJobs && !(job->flags & JOB_SPECIAL) &&
+ maxJobs != 0) {
/*
* The job can only be run locally, but we've hit the limit of
* local concurrency, so put the job on hold until some other
* job finishes. Note that the special jobs (.BEGIN, .INTERRUPT
* and .END) may be run locally even when the local limit has
- * been reached (e.g. when maxLocal == 0), though they will be
+ * been reached (e.g. when maxJobs == 0), though they will be
* exported if at all possible. In addition, any target marked
- * with .NOEXPORT will be run locally if maxLocal is 0.
+ * with .NOEXPORT will be run locally if maxJobs is 0.
*/
jobFull = true;
@@ -1488,7 +1477,7 @@ JobStart(GNode *gn, /* target to create */
job->flags |= JOB_RESTART;
Lst_AtEnd(&stoppedJobs, job);
} else {
- if (nLocal >= maxLocal && local) {
+ if (nJobs >= maxJobs) {
/*
* If we're running this job locally as a special case
* (see above), at least say the table is full.
@@ -1729,7 +1718,7 @@ Job_CatchChildren()
/*
* Don't even bother if we know there's no one around.
*/
- if (nLocal == 0) {
+ if (nJobs == 0) {
return;
}
@@ -1768,7 +1757,6 @@ Job_CatchChildren()
(void)fflush(stdout);
}
jobFull = false;
- nLocal--;
}
JobFinish(job, &status);
@@ -1851,7 +1839,7 @@ Job_Make(GNode *gn)
*-----------------------------------------------------------------------
*/
void
-Job_Init(int maxproc, int maxlocal)
+Job_Init(int maxproc)
{
int tfd;
@@ -1864,9 +1852,7 @@ Job_Init(int maxproc, int maxlocal)
Static_Lst_Init(&jobs);
Static_Lst_Init(&stoppedJobs);
maxJobs = maxproc;
- maxLocal = maxlocal;
nJobs = 0;
- nLocal = 0;
jobFull = false;
aborting = 0;