Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/make make(1): rename global variables in job.c
details: https://anonhg.NetBSD.org/src/rev/b5b22d0c452f
branches: trunk
changeset: 946439:b5b22d0c452f
user: rillig <rillig%NetBSD.org@localhost>
date: Sat Nov 28 08:31:41 2020 +0000
description:
make(1): rename global variables in job.c
When compiling make in all-in-one mode, the variable name nfds conflicts
with the local variable name nfds in meta_compat_parent.
The variable name jobfds was misleading. It has nothing to do with file
descriptors, it's just an array of jobs.
diffstat:
usr.bin/make/job.c | 52 ++++++++++++++++++++++++++--------------------------
1 files changed, 26 insertions(+), 26 deletions(-)
diffs (126 lines):
diff -r f83055d25578 -r b5b22d0c452f usr.bin/make/job.c
--- a/usr.bin/make/job.c Sat Nov 28 05:16:06 2020 +0000
+++ b/usr.bin/make/job.c Sat Nov 28 08:31:41 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: job.c,v 1.329 2020/11/24 18:17:45 rillig Exp $ */
+/* $NetBSD: job.c,v 1.330 2020/11/28 08:31:41 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -143,7 +143,7 @@
#include "trace.h"
/* "@(#)job.c 8.2 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: job.c,v 1.329 2020/11/24 18:17:45 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.330 2020/11/28 08:31:41 rillig Exp $");
/* A shell defines how the commands are run. All commands for a target are
* written into a single file, which is then given to the shell to execute
@@ -383,8 +383,8 @@
* the output channels of children
*/
static struct pollfd *fds = NULL;
-static Job **jobfds = NULL;
-static nfds_t nfds = 0;
+static Job **allJobs = NULL;
+static nfds_t nJobs = 0;
static void watchfd(Job *);
static void clearfd(Job *);
static int readyfd(Job *);
@@ -1942,7 +1942,7 @@
/* The first fd in the list is the job token pipe */
do {
- nready = poll(fds + 1 - wantToken, nfds - 1 + wantToken, POLL_MSEC);
+ nready = poll(fds + 1 - wantToken, nJobs - 1 + wantToken, POLL_MSEC);
} while (nready < 0 && errno == EINTR);
if (nready < 0)
@@ -1972,10 +1972,10 @@
if (nready == 0)
return;
- for (i = npseudojobs * nfds_per_job(); i < nfds; i++) {
+ for (i = npseudojobs * nfds_per_job(); i < nJobs; i++) {
if (!fds[i].revents)
continue;
- job = jobfds[i];
+ job = allJobs[i];
if (job->status == JOB_ST_RUNNING)
JobDoOutput(job, FALSE);
#if defined(USE_FILEMON) && !defined(USE_FILEMON_DEV)
@@ -2110,8 +2110,8 @@
/* Preallocate enough for the maximum number of jobs. */
fds = bmake_malloc(sizeof *fds *
(npseudojobs + (size_t)opts.maxJobs) * nfds_per_job());
- jobfds = bmake_malloc(sizeof *jobfds *
- (npseudojobs + (size_t)opts.maxJobs) * nfds_per_job());
+ allJobs = bmake_malloc(sizeof *allJobs *
+ (npseudojobs + (size_t)opts.maxJobs) * nfds_per_job());
/* These are permanent entries and take slots 0 and 1 */
watchfd(&tokenWaitJob);
@@ -2548,17 +2548,17 @@
if (job->inPollfd != NULL)
Punt("Watching watched job");
- fds[nfds].fd = job->inPipe;
- fds[nfds].events = POLLIN;
- jobfds[nfds] = job;
- job->inPollfd = &fds[nfds];
- nfds++;
+ fds[nJobs].fd = job->inPipe;
+ fds[nJobs].events = POLLIN;
+ allJobs[nJobs] = job;
+ job->inPollfd = &fds[nJobs];
+ nJobs++;
#if defined(USE_FILEMON) && !defined(USE_FILEMON_DEV)
if (useMeta) {
- fds[nfds].fd = meta_job_fd(job);
- fds[nfds].events = fds[nfds].fd == -1 ? 0 : POLLIN;
- jobfds[nfds] = job;
- nfds++;
+ fds[nJobs].fd = meta_job_fd(job);
+ fds[nJobs].events = fds[nJobs].fd == -1 ? 0 : POLLIN;
+ allJobs[nJobs] = job;
+ nJobs++;
}
#endif
}
@@ -2570,7 +2570,7 @@
if (job->inPollfd == NULL)
Punt("Unwatching unwatched job");
i = (size_t)(job->inPollfd - fds);
- nfds--;
+ nJobs--;
#if defined(USE_FILEMON) && !defined(USE_FILEMON_DEV)
if (useMeta) {
/*
@@ -2580,20 +2580,20 @@
assert(nfds_per_job() == 2);
if (i % 2)
Punt("odd-numbered fd with meta");
- nfds--;
+ nJobs--;
}
#endif
/*
* Move last job in table into hole made by dead job.
*/
- if (nfds != i) {
- fds[i] = fds[nfds];
- jobfds[i] = jobfds[nfds];
- jobfds[i]->inPollfd = &fds[i];
+ if (nJobs != i) {
+ fds[i] = fds[nJobs];
+ allJobs[i] = allJobs[nJobs];
+ allJobs[i]->inPollfd = &fds[i];
#if defined(USE_FILEMON) && !defined(USE_FILEMON_DEV)
if (useMeta) {
- fds[i + 1] = fds[nfds + 1];
- jobfds[i + 1] = jobfds[nfds + 1];
+ fds[i + 1] = fds[nJobs + 1];
+ allJobs[i + 1] = allJobs[nJobs + 1];
}
#endif
}
Home |
Main Index |
Thread Index |
Old Index