summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>1999-08-23 22:15:17 +0000
committerPaul Smith <psmith@gnu.org>1999-08-23 22:15:17 +0000
commit5dc4b92b606351290d979371da4a500ce8f6a57e (patch)
treeb8d06830fdf21258b23c4759a4ae0ca53b1f5bea /main.c
parentb3fa4b3c7e77cb4a1767b16b1cfbef2ab19a78cf (diff)
downloadgunmake-5dc4b92b606351290d979371da4a500ce8f6a57e.tar.gz
* Fix jobserver algorithm again.
* A couple of nits. * Fix considered pruning for double-colon rules.
Diffstat (limited to 'main.c')
-rw-r--r--main.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/main.c b/main.c
index dcab8b5..de82b59 100644
--- a/main.c
+++ b/main.c
@@ -1301,11 +1301,15 @@ int main (int argc, char ** argv)
{
char *cp;
- if (jobserver_fds->max > 1)
- fatal (NILF, _("internal error: multiple --jobserver-fds options."));
+ if (jobserver_fds->idx > 1)
+ fatal (NILF, _("internal error: multiple --jobserver-fds options"));
- if (job_slots > 0)
- fatal (NILF, _("internal error: --jobserver-fds unexpected."));
+ /* The combination of a pipe + !job_slots means we're using the
+ jobserver. If !job_slots and we don't have a pipe, we can start
+ infinite jobs. */
+
+ if (job_slots != 0)
+ fatal (NILF, _("internal error: --jobserver-fds unexpected"));
/* Now parse the fds string and make sure it has the proper format. */
@@ -1313,13 +1317,7 @@ int main (int argc, char ** argv)
if (sscanf (cp, "%d,%d", &job_fds[0], &job_fds[1]) != 2)
fatal (NILF,
- _("internal error: invalid --jobserver-fds string `%s'."), cp);
-
- /* Set job_slots to 0. The combination of a pipe + !job_slots means
- we're using the jobserver. If !job_slots and we don't have a pipe, we
- can start infinite jobs. */
-
- job_slots = 0;
+ _("internal error: invalid --jobserver-fds string `%s'"), cp);
/* Create a duplicate pipe, that will be closed in the SIGCHLD
handler. If this fails with EBADF, the parent has closed the pipe
@@ -1353,7 +1351,8 @@ int main (int argc, char ** argv)
/* Every make assumes that it always has one job it can run. For the
submakes it's the token they were given by their parent. For the
- top make, we just subtract one from the number the user wants. */
+ top make, we just subtract one from the number the user wants. We
+ want job_slots to be 0 to indicate we're using the jobserver. */
while (--job_slots)
while (write (job_fds[1], &c, 1) != 1)