Re: tcsh being dodgy, or pipe code ishoos?

From: Juli Mallett <jmallett_at_FreeBSD.org>
Date: Wed, 25 Jun 2003 00:15:25 -0500
* Juli Mallett <jmallett_at_FreeBSD.org> [ Date: 2003-06-24 ]
	[ w.r.t. Re: tcsh being dodgy, or pipe code ishoos? ]
> * Tim Kientzle <kientzle_at_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_at_ 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
_at__at_ -518,6 +518,8 _at__at_
        }
 exec:
        childerr = 0;
+       curprocs++;
+       waitchildren(*argv, 0);
        switch(pid = vfork()) {
        case -1:
                err(1, "vfork");
_at__at_ -537,8 +539,6 _at__at_
                childerr = errno;
                _exit(1);
        }
-       curprocs++;
-       waitchildren(*argv, 0);
 }
  
 static void
%%%
-- 
juli mallett. email: jmallett_at_freebsd.org; efnet: juli;
Received on Tue Jun 24 2003 - 20:15:25 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:13 UTC