From owner-svn-src-head@FreeBSD.ORG Wed Jun 5 16:12:52 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 7645C4F2; Wed, 5 Jun 2013 16:12:52 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 674AB1135; Wed, 5 Jun 2013 16:12:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r55GCqDi050950; Wed, 5 Jun 2013 16:12:52 GMT (envelope-from sjg@svn.freebsd.org) Received: (from sjg@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r55GCpPG050941; Wed, 5 Jun 2013 16:12:51 GMT (envelope-from sjg@svn.freebsd.org) Message-Id: <201306051612.r55GCpPG050941@svn.freebsd.org> From: "Simon J. Gerraty" Date: Wed, 5 Jun 2013 16:12:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251422 - in head: contrib/bmake usr.bin/bmake X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2013 16:12:52 -0000 Author: sjg Date: Wed Jun 5 16:12:50 2013 New Revision: 251422 URL: http://svnweb.freebsd.org/changeset/base/251422 Log: Update to bmake-20130604 to fix file descriptor leak. Modified: head/contrib/bmake/ChangeLog head/contrib/bmake/Makefile head/contrib/bmake/job.c head/contrib/bmake/make.1 head/contrib/bmake/var.c head/usr.bin/bmake/Makefile Directory Properties: head/contrib/bmake/ (props changed) Modified: head/contrib/bmake/ChangeLog ============================================================================== --- head/contrib/bmake/ChangeLog Wed Jun 5 15:52:24 2013 (r251421) +++ head/contrib/bmake/ChangeLog Wed Jun 5 16:12:50 2013 (r251422) @@ -1,3 +1,16 @@ +2013-06-04 Simon J. Gerraty + + * 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 + + * 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 * Makefile (MAKE_VERSION): 20130520 Modified: head/contrib/bmake/Makefile ============================================================================== --- head/contrib/bmake/Makefile Wed Jun 5 15:52:24 2013 (r251421) +++ head/contrib/bmake/Makefile Wed Jun 5 16:12:50 2013 (r251422) @@ -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 -MAKE_VERSION= 20130520 +MAKE_VERSION= 20130604 PROG= bmake Modified: head/contrib/bmake/job.c ============================================================================== --- head/contrib/bmake/job.c Wed Jun 5 15:52:24 2013 (r251421) +++ head/contrib/bmake/job.c Wed Jun 5 16:12:50 2013 (r251422) @@ -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. @@ -70,14 +70,14 @@ */ #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 #include #ifndef lint #if 0 static char sccsid[] = "@(#)job.c 8.2 (Berkeley) 3/19/94"; #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 /* not lint */ #endif @@ -414,6 +414,15 @@ JobCreatePipe(Job *job, int minfd) if (pipe(job->jobPipe) == -1) 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 */ (void)fcntl(job->jobPipe[0], 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_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 /* Pipe passed in from parent */ tokenWaitJob.inPipe = jp_0; tokenWaitJob.outPipe = jp_1; + (void)fcntl(jp_0, F_SETFD, 1); + (void)fcntl(jp_1, F_SETFD, 1); return; } Modified: head/contrib/bmake/make.1 ============================================================================== --- head/contrib/bmake/make.1 Wed Jun 5 15:52:24 2013 (r251421) +++ head/contrib/bmake/make.1 Wed Jun 5 16:12:50 2013 (r251422) @@ -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 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" from: @(#)make.1 8.4 (Berkeley) 3/19/94 .\" -.Dd March 30, 2013 +.Dd May 22, 2013 .Dt MAKE 1 .Os .Sh NAME @@ -2110,6 +2110,13 @@ for Sprite at Berkeley. It was designed to be a parallel distributed make running jobs on different machines using a daemon called .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 The .Nm Modified: head/contrib/bmake/var.c ============================================================================== --- head/contrib/bmake/var.c Wed Jun 5 15:52:24 2013 (r251421) +++ head/contrib/bmake/var.c Wed Jun 5 16:12:50 2013 (r251422) @@ -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 @@ -69,14 +69,14 @@ */ #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 #include #ifndef lint #if 0 static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94"; #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 /* not lint */ #endif @@ -2326,9 +2326,7 @@ VarHash(char *str) size_t len, len2; unsigned char *ustr = (unsigned char *)str; uint32_t h, k, c1, c2; - int done; - done = 1; h = 0x971e137bU; c1 = 0x95543787U; c2 = 0x2ad7eb25U; @@ -2358,7 +2356,7 @@ VarHash(char *str) h = (h << 13) ^ (h >> 19); h = h * 5 + 0x52dce729U; h ^= k; - } while (!done); + } h ^= len2; h *= 0x85ebca6b; h ^= h >> 13; Modified: head/usr.bin/bmake/Makefile ============================================================================== --- head/usr.bin/bmake/Makefile Wed Jun 5 15:52:24 2013 (r251421) +++ head/usr.bin/bmake/Makefile Wed Jun 5 16:12:50 2013 (r251422) @@ -14,10 +14,10 @@ CFLAGS+= -I${.CURDIR} CLEANDIRS+= FreeBSD CLEANFILES+= bootstrap -# $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 -MAKE_VERSION= 20130520 +MAKE_VERSION= 20130604 PROG?= ${.CURDIR:T}