Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 25 Jun 2003 00:15:25 -0500
From:      Juli Mallett <jmallett@FreeBSD.org>
To:        "Tim J. Robbins" <tjr@FreeBSD.org>
Cc:        freebsd-current@freebsd.org
Subject:   Re: tcsh being dodgy, or pipe code ishoos?
Message-ID:  <20030625001525.A60867@FreeBSD.org>
In-Reply-To: <20030624234707.A59666@FreeBSD.org>; from jmallett@FreeBSD.org on Tue, Jun 24, 2003 at 11:47:07PM -0500
References:  <20030624183515.A42570@FreeBSD.org> <1056499632.662.7.camel@timon.nist> <3EF922BE.4070803@acm.org> <20030624234707.A59666@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
* Juli Mallett <jmallett@FreeBSD.org> [ Date: 2003-06-24 ]
	[ w.r.t. Re: tcsh being dodgy, or pipe code ishoos? ]
> * Tim Kientzle <kientzle@acm.org> [ 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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030625001525.A60867>