* Juli Mallett <[EMAIL PROTECTED]> [ Date: 2003-06-24 ]
        [ w.r.t. Re: tcsh being dodgy, or pipe code ishoos? ]
> * Tim Kientzle <[EMAIL PROTECTED]> [ 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: [EMAIL PROTECTED]; efnet: juli;
_______________________________________________
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to