From owner-svn-src-head@FreeBSD.ORG Mon Jun 24 18:57:17 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 8536BB4C; Mon, 24 Jun 2013 18:57:17 +0000 (UTC) (envelope-from tijl@freebsd.org) Received: from mailrelay007.isp.belgacom.be (mailrelay007.isp.belgacom.be [195.238.6.173]) by mx1.freebsd.org (Postfix) with ESMTP id 92D951911; Mon, 24 Jun 2013 18:57:15 +0000 (UTC) X-Belgacom-Dynamic: yes X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AlcGAPWUyFFR8noC/2dsb2JhbABagwkxg068PoEGF3SCIwEBBSMEUhALFAQJFgsCAgIHAwIBAgEnHgYNAQcBAYgOCKk1kTuPNAoRBwmCRoEUA5ADgSyHPZAbgxI6 Received: from 2.122-242-81.adsl-dyn.isp.belgacom.be (HELO kalimero.tijl.coosemans.org) ([81.242.122.2]) by relay.skynet.be with ESMTP; 24 Jun 2013 20:57:08 +0200 Received: from kalimero.tijl.coosemans.org (kalimero.tijl.coosemans.org [127.0.0.1]) by kalimero.tijl.coosemans.org (8.14.7/8.14.7) with ESMTP id r5OIv78X049559; Mon, 24 Jun 2013 20:57:07 +0200 (CEST) (envelope-from tijl@FreeBSD.org) Message-ID: <51C8967F.2060905@FreeBSD.org> Date: Mon, 24 Jun 2013 20:57:03 +0200 From: Tijl Coosemans User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:17.0) Gecko/20130517 Thunderbird/17.0.6 MIME-Version: 1.0 To: "Simon J. Gerraty" Subject: Re: svn commit: r251422 - in head: contrib/bmake usr.bin/bmake References: <201306051612.r55GCpPG050941@svn.freebsd.org> In-Reply-To: <201306051612.r55GCpPG050941@svn.freebsd.org> X-Enigmail-Version: 1.5.1 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="----enig2FEITOQXDJAXPCBPGMLER" Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org 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: Mon, 24 Jun 2013 18:57:17 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2FEITOQXDJAXPCBPGMLER Content-Type: multipart/mixed; boundary="------------030701030603070904050805" This is a multi-part message in MIME format. --------------030701030603070904050805 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 2013-06-05 18:12, Simon J. Gerraty wrote: > Author: sjg > Date: Wed Jun 5 16:12:50 2013 > New Revision: 251422 > URL: http://svnweb.freebsd.org/changeset/base/251422 >=20 > Log: > Update to bmake-20130604 to fix file descriptor leak. >=20 > Modified: head/contrib/bmake/job.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- 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 $ */ > =20 > /* > * Copyright (c) 1988, 1989, 1990 The Regents of the University of Cal= ifornia. > @@ -70,14 +70,14 @@ > */ > =20 > #ifndef MAKE_NATIVE > -static char rcsid[] =3D "$NetBSD: job.c,v 1.172 2013/03/05 22:01:43 ch= ristos Exp $"; > +static char rcsid[] =3D "$NetBSD: job.c,v 1.173 2013/06/05 03:59:43 sj= g Exp $"; > #else > #include > #ifndef lint > #if 0 > static char sccsid[] =3D "@(#)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) =3D=3D -1) > Punt("Cannot create pipe: %s", strerror(errno)); > =20 > + for (i =3D 0; i < 2; i++) { > + /* Avoid using low numbered fds */ > + fd =3D fcntl(job->jobPipe[i], F_DUPFD, minfd); > + if (fd !=3D -1) { > + close(job->jobPipe[i]); > + job->jobPipe[i] =3D fd; > + } > + } > + =20 > /* Set close-on-exec flag for both */ > (void)fcntl(job->jobPipe[0], F_SETFD, 1); > (void)fcntl(job->jobPipe[1], F_SETFD, 1); I've been noticing that bmake doesn't run parallel jobs as like fmake. I've attached a Makefile that I think shows what's going wrong. If you run "make -j4" it outputs the following: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D --- all --- -j 4 -i -J 15,16 4 -j 4 -i 4 --- sub_2 --- -j 4 -i -J 15,16 4 -j 4 -i 4 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D Bmake outputs the target name in -j mode (e.g. "--- all ---"), but there's no "--- sub_1 ---" and "--- sub_3 ---" which suggests -j isn't working there. The -J flag also doesn't appear in .MAKEFLAGS in those targets. I suspect the descriptors for the job server have to remain open so submakes can pick them up. At least, when I comment out the two fcntl calls above (and two more below), I do get the output I expect: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D --- all --- -j 4 -J 15,16 4 --- sub_1 --- -j 4 -J 15,16 4 --- sub_2 --- -j 4 -J 15,16 4 --- sub_3 --- -j 4 -J 15,16 4 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D > @@ -426,15 +435,6 @@ JobCreatePipe(Job *job, int minfd) > */ > fcntl(job->jobPipe[0], F_SETFL,=20 > fcntl(job->jobPipe[0], F_GETFL, 0) | O_NONBLOCK); > - > - for (i =3D 0; i < 2; i++) { > - /* Avoid using low numbered fds */ > - fd =3D fcntl(job->jobPipe[i], F_DUPFD, minfd); > - if (fd !=3D -1) { > - close(job->jobPipe[i]); > - job->jobPipe[i] =3D fd; > - } > - } > } > =20 > /*- > @@ -2828,6 +2828,8 @@ Job_ServerStart(int max_tokens, int jp_0 > /* Pipe passed in from parent */ > tokenWaitJob.inPipe =3D jp_0; > tokenWaitJob.outPipe =3D jp_1; > + (void)fcntl(jp_0, F_SETFD, 1); > + (void)fcntl(jp_1, F_SETFD, 1); These two fcntl calls have to be commented out too. --------------030701030603070904050805 Content-Type: text/plain; charset=ISO-8859-15; name="Makefile" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="Makefile" YWxsOgoJQGVjaG8gJHsuTUFLRUZMQUdTfQoJQGVjaG8gJHsuTUFLRS5KT0JTfQoJQCR7TUFL RX0gc3ViXzEKCnN1Yl8xOgoJQGVjaG8gJHsuTUFLRUZMQUdTfQoJQGVjaG8gJHsuTUFLRS5K T0JTfQoJQCR7TUFLRX0gc3ViXzIKCnN1Yl8yOgoJQGVjaG8gJHsuTUFLRUZMQUdTfQoJQGVj aG8gJHsuTUFLRS5KT0JTfQoJQCR7TUFLRX0gc3ViXzMKCnN1Yl8zOgoJQGVjaG8gJHsuTUFL RUZMQUdTfQoJQGVjaG8gJHsuTUFLRS5KT0JTfQoK --------------030701030603070904050805-- ------enig2FEITOQXDJAXPCBPGMLER Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.20 (FreeBSD) iF4EAREIAAYFAlHIloMACgkQfoCS2CCgtiubrAD8CCgC91+tMcY855SSDCDOMGvd 78FzNF2fRVuoexvUmjMA/A99PKOLevE/d61PNt1tnfnxEcd2Uk8oS+HuhFElvf/a =7HT0 -----END PGP SIGNATURE----- ------enig2FEITOQXDJAXPCBPGMLER--