Import bmake-20130604

This commit is contained in:
Simon J. Gerraty 2013-06-05 15:51:46 +00:00
parent dca4585d16
commit 45f33ab2b2
5 changed files with 42 additions and 22 deletions

View File

@ -1,3 +1,16 @@
2013-06-04 Simon J. Gerraty <sjg@bad.crufty.net>
* Makefile (MAKE_VERSION): 20130604
Merge with NetBSD make, pick up
o job.c: JobCreatePipe: do fcntl() after any tweaking of fd's
to avoid leaking descriptors.
2013-05-28 Simon J. Gerraty <sjg@bad.crufty.net>
* Makefile (MAKE_VERSION): 20130528
Merge with NetBSD make, pick up
o var.c: cleanup some left-overs in VarHash()
2013-05-20 Simon J. Gerraty <sjg@bad.crufty.net> 2013-05-20 Simon J. Gerraty <sjg@bad.crufty.net>
* Makefile (MAKE_VERSION): 20130520 * Makefile (MAKE_VERSION): 20130520

View File

@ -1,7 +1,7 @@
# $Id: Makefile,v 1.12 2013/05/20 16:05:10 sjg Exp $ # $Id: Makefile,v 1.14 2013/06/05 04:03:22 sjg Exp $
# Base version on src date # Base version on src date
MAKE_VERSION= 20130520 MAKE_VERSION= 20130604
PROG= bmake PROG= bmake

26
job.c
View File

@ -1,4 +1,4 @@
/* $NetBSD: job.c,v 1.172 2013/03/05 22:01:43 christos Exp $ */ /* $NetBSD: job.c,v 1.173 2013/06/05 03:59:43 sjg Exp $ */
/* /*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California. * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@ -70,14 +70,14 @@
*/ */
#ifndef MAKE_NATIVE #ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: job.c,v 1.172 2013/03/05 22:01:43 christos Exp $"; static char rcsid[] = "$NetBSD: job.c,v 1.173 2013/06/05 03:59:43 sjg Exp $";
#else #else
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
#if 0 #if 0
static char sccsid[] = "@(#)job.c 8.2 (Berkeley) 3/19/94"; static char sccsid[] = "@(#)job.c 8.2 (Berkeley) 3/19/94";
#else #else
__RCSID("$NetBSD: job.c,v 1.172 2013/03/05 22:01:43 christos Exp $"); __RCSID("$NetBSD: job.c,v 1.173 2013/06/05 03:59:43 sjg Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
#endif #endif
@ -414,6 +414,15 @@ JobCreatePipe(Job *job, int minfd)
if (pipe(job->jobPipe) == -1) if (pipe(job->jobPipe) == -1)
Punt("Cannot create pipe: %s", strerror(errno)); Punt("Cannot create pipe: %s", strerror(errno));
for (i = 0; i < 2; i++) {
/* Avoid using low numbered fds */
fd = fcntl(job->jobPipe[i], F_DUPFD, minfd);
if (fd != -1) {
close(job->jobPipe[i]);
job->jobPipe[i] = fd;
}
}
/* Set close-on-exec flag for both */ /* Set close-on-exec flag for both */
(void)fcntl(job->jobPipe[0], F_SETFD, 1); (void)fcntl(job->jobPipe[0], F_SETFD, 1);
(void)fcntl(job->jobPipe[1], F_SETFD, 1); (void)fcntl(job->jobPipe[1], F_SETFD, 1);
@ -426,15 +435,6 @@ JobCreatePipe(Job *job, int minfd)
*/ */
fcntl(job->jobPipe[0], F_SETFL, fcntl(job->jobPipe[0], F_SETFL,
fcntl(job->jobPipe[0], F_GETFL, 0) | O_NONBLOCK); fcntl(job->jobPipe[0], F_GETFL, 0) | O_NONBLOCK);
for (i = 0; i < 2; i++) {
/* Avoid using low numbered fds */
fd = fcntl(job->jobPipe[i], F_DUPFD, minfd);
if (fd != -1) {
close(job->jobPipe[i]);
job->jobPipe[i] = fd;
}
}
} }
/*- /*-
@ -2828,6 +2828,8 @@ Job_ServerStart(int max_tokens, int jp_0, int jp_1)
/* Pipe passed in from parent */ /* Pipe passed in from parent */
tokenWaitJob.inPipe = jp_0; tokenWaitJob.inPipe = jp_0;
tokenWaitJob.outPipe = jp_1; tokenWaitJob.outPipe = jp_1;
(void)fcntl(jp_0, F_SETFD, 1);
(void)fcntl(jp_1, F_SETFD, 1);
return; return;
} }

11
make.1
View File

@ -1,4 +1,4 @@
.\" $NetBSD: make.1,v 1.213 2013/03/31 05:49:51 sjg Exp $ .\" $NetBSD: make.1,v 1.215 2013/05/22 19:35:11 christos Exp $
.\" .\"
.\" Copyright (c) 1990, 1993 .\" Copyright (c) 1990, 1993
.\" The Regents of the University of California. All rights reserved. .\" The Regents of the University of California. All rights reserved.
@ -29,7 +29,7 @@
.\" .\"
.\" from: @(#)make.1 8.4 (Berkeley) 3/19/94 .\" from: @(#)make.1 8.4 (Berkeley) 3/19/94
.\" .\"
.Dd March 30, 2013 .Dd May 22, 2013
.Dt MAKE 1 .Dt MAKE 1
.Os .Os
.Sh NAME .Sh NAME
@ -2110,6 +2110,13 @@ for Sprite at Berkeley.
It was designed to be a parallel distributed make running jobs on different It was designed to be a parallel distributed make running jobs on different
machines using a daemon called machines using a daemon called
.Dq customs . .Dq customs .
.Pp
Historically the target/dependency
.Dq FRC
has been used to FoRCe rebuilding (since the target/dependency
does not exist... unless someone creates an
.Dq FRC
file).
.Sh BUGS .Sh BUGS
The The
.Nm .Nm

10
var.c
View File

@ -1,4 +1,4 @@
/* $NetBSD: var.c,v 1.174 2013/05/18 13:12:45 sjg Exp $ */ /* $NetBSD: var.c,v 1.175 2013/05/29 00:23:31 sjg Exp $ */
/* /*
* Copyright (c) 1988, 1989, 1990, 1993 * Copyright (c) 1988, 1989, 1990, 1993
@ -69,14 +69,14 @@
*/ */
#ifndef MAKE_NATIVE #ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: var.c,v 1.174 2013/05/18 13:12:45 sjg Exp $"; static char rcsid[] = "$NetBSD: var.c,v 1.175 2013/05/29 00:23:31 sjg Exp $";
#else #else
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
#if 0 #if 0
static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94"; static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94";
#else #else
__RCSID("$NetBSD: var.c,v 1.174 2013/05/18 13:12:45 sjg Exp $"); __RCSID("$NetBSD: var.c,v 1.175 2013/05/29 00:23:31 sjg Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
#endif #endif
@ -2310,9 +2310,7 @@ VarHash(char *str)
size_t len, len2; size_t len, len2;
unsigned char *ustr = (unsigned char *)str; unsigned char *ustr = (unsigned char *)str;
uint32_t h, k, c1, c2; uint32_t h, k, c1, c2;
int done;
done = 1;
h = 0x971e137bU; h = 0x971e137bU;
c1 = 0x95543787U; c1 = 0x95543787U;
c2 = 0x2ad7eb25U; c2 = 0x2ad7eb25U;
@ -2342,7 +2340,7 @@ VarHash(char *str)
h = (h << 13) ^ (h >> 19); h = (h << 13) ^ (h >> 19);
h = h * 5 + 0x52dce729U; h = h * 5 + 0x52dce729U;
h ^= k; h ^= k;
} while (!done); }
h ^= len2; h ^= len2;
h *= 0x85ebca6b; h *= 0x85ebca6b;
h ^= h >> 13; h ^= h >> 13;