Fix the fix for bin/72510 applied in job.c:1.70. Actually there have

been two maxJobs variables: one static in job.c and one global used in
main.c and parse.c. Makeing one global out of these was the wrong way
to fix the problem. Instead rename the global one to jobLimit and keep
maxJobs static in job.c.

Suggested by:	rwatson
PR:		bin/72510
This commit is contained in:
Hartmut Brandt 2005-05-12 14:16:44 +00:00
parent 35fd572dcb
commit 8b8eb9e2ab
5 changed files with 13 additions and 8 deletions

View File

@ -69,6 +69,7 @@ extern struct Path parseIncPath;
/* The system include path. */
extern struct Path sysIncPath;
extern int jobLimit; /* -j argument: maximum number of jobs */
extern Boolean jobsRunning; /* True if jobs are running */
extern Boolean compatMake; /* True if we are make compatible */
extern Boolean ignoreErrors; /* True if should ignore all errors */

View File

@ -400,7 +400,12 @@ static struct Shell *commandShell = NULL;
static char *shellPath = NULL; /* full pathname of executable image */
static char *shellName = NULL; /* last component of shell */
int maxJobs; /* The most children we can run at once */
/*
* The maximum number of jobs that may run. This is initialize from the
* -j argument for the leading make and from the FIFO for sub-makes.
*/
static int maxJobs;
static int nJobs; /* The number of children currently running */
/* The structures that describe them */

View File

@ -56,8 +56,6 @@ struct Buffer;
struct GNode;
struct Lst;
extern int maxJobs; /* Number of jobs that may run */
void Shell_Init(void);
void Job_Touch(struct GNode *, Boolean);
Boolean Job_CheckCommands(struct GNode *, void (*abortProc)(const char *, ...));

View File

@ -122,6 +122,7 @@ static Boolean expandVars; /* fully expand printed variables */
static Lst variables = Lst_Initializer(variables);
static Boolean forceJobs; /* -j argument given */
int jobLimit; /* -j argument: maximum number of jobs */
Boolean compatMake; /* -B argument */
Boolean debug; /* -d flag */
Boolean noExecute; /* -n flag */
@ -362,8 +363,8 @@ rearg:
char *endptr;
forceJobs = TRUE;
maxJobs = strtol(optarg, &endptr, 10);
if (maxJobs <= 0 || *endptr != '\0') {
jobLimit = strtol(optarg, &endptr, 10);
if (jobLimit <= 0 || *endptr != '\0') {
warnx("illegal number, -j argument -- %s",
optarg);
usage();
@ -695,7 +696,7 @@ main(int argc, char **argv)
debug = 0; /* No debug verbosity, please. */
jobsRunning = FALSE;
maxJobs = DEFMAXJOBS;
jobLimit = DEFMAXJOBS;
forceJobs = FALSE; /* No -j flag */
compatMake = FALSE; /* No compat mode */
@ -977,7 +978,7 @@ main(int argc, char **argv)
* should it exist).
*/
if (!queryFlag) {
Job_Init(maxJobs);
Job_Init(jobLimit);
jobsRunning = TRUE;
}

View File

@ -882,7 +882,7 @@ ParseDoDependency(char *line)
DEFAULT = gn;
break;
case NotParallel:
maxJobs = 1;
jobLimit = 1;
break;
case SingleShell:
compatMake = 1;