F_DUPFD the job_pipe fds onto higher numbers (>15) to make it less likely

that they will get closed in a complex recursive parallel make.
This commit is contained in:
dsl 2006-01-04 21:25:03 +00:00
parent 68ab653c0c
commit 261501b75e
1 changed files with 13 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: job.c,v 1.99 2006/01/04 20:56:05 dsl Exp $ */
/* $NetBSD: job.c,v 1.100 2006/01/04 21:25:03 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.99 2006/01/04 20:56:05 dsl Exp $";
static char rcsid[] = "$NetBSD: job.c,v 1.100 2006/01/04 21:25:03 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.99 2006/01/04 20:56:05 dsl Exp $");
__RCSID("$NetBSD: job.c,v 1.100 2006/01/04 21:25:03 dsl Exp $");
#endif
#endif /* not lint */
#endif
@ -3541,12 +3541,21 @@ JobTokenAdd(void)
void
Job_ServerStart(int maxproc)
{
int i, flags;
int i, fd, flags;
char jobarg[64];
if (pipe(job_pipe) < 0)
Fatal("error in pipe: %s", strerror(errno));
for (i = 0; i < 2; i++) {
/* Avoid using low numbered fds */
fd = fcntl(job_pipe[i], F_DUPFD, 15);
if (fd != -1) {
close(job_pipe[i]);
job_pipe[i] = fd;
}
}
/*
* We mark the input side of the pipe non-blocking; we poll(2) the
* pipe when we're waiting for a job token, but we might lose the