From owner-freebsd-current@FreeBSD.ORG Tue Jun 24 22:15:25 2003 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 931) id 8CB8E37B401; Tue, 24 Jun 2003 22:15:25 -0700 (PDT) Date: Wed, 25 Jun 2003 00:15:25 -0500 From: Juli Mallett To: "Tim J. Robbins" Message-ID: <20030625001525.A60867@FreeBSD.org> References: <20030624183515.A42570@FreeBSD.org> <1056499632.662.7.camel@timon.nist> <3EF922BE.4070803@acm.org> <20030624234707.A59666@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <20030624234707.A59666@FreeBSD.org>; from jmallett@FreeBSD.org on Tue, Jun 24, 2003 at 11:47:07PM -0500 X-Title: Code Maven X-Towel: Yes X-Negacore: Yes X-Authentication-Warning: localhost: juli pwned teh intarweb cc: freebsd-current@freebsd.org Subject: Re: tcsh being dodgy, or pipe code ishoos? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Jun 2003 05:15:25 -0000 * Juli Mallett [ Date: 2003-06-24 ] [ w.r.t. Re: tcsh being dodgy, or pipe code ishoos? ] > * Tim Kientzle [ Date: 2003-06-24 ] > > Hmmm... This looks like xargs isn't waiting for the subcommand > > to exit. This looks like 'echo -- + 2' and 'echo -- + 3' are > > running concurrently. > > How about this, it essentially says that in the not -P case, no procs > may be unwaited-on, whereas otherwise we say that 1 may be unwaited-on.. jmg@ points out this better idea, of doing the waitchildren before the vfork, allowing xargs to do its work while the child runs, as seems to be the desirable effect of having maxprocs=1, so. %%% Index: xargs.c =================================================================== RCS file: /home/ncvs/src/usr.bin/xargs/xargs.c,v retrieving revision 1.54 diff -u -r1.54 xargs.c --- xargs.c 13 Jun 2003 17:05:41 -0000 1.54 +++ xargs.c 25 Jun 2003 05:12:27 -0000 @@ -518,6 +518,8 @@ } exec: childerr = 0; + curprocs++; + waitchildren(*argv, 0); switch(pid = vfork()) { case -1: err(1, "vfork"); @@ -537,8 +539,6 @@ childerr = errno; _exit(1); } - curprocs++; - waitchildren(*argv, 0); } static void %%% -- juli mallett. email: jmallett@freebsd.org; efnet: juli;