[BusyBox] new version xargs
Vladimir N. Oleynik
dzo at simtreas.ru
Mon Nov 11 02:58:03 UTC 2002
Glenn,
> > I tried full rewrote xargs applet.
> > Previous Mark Whitley version have many problems:
> > 1. Full broken if geting lines have spaces or shell metachars
> > 2. Eating empty lines as default (but this true with -r option only).
> > 3. Do not show problem if command can`t executing
> > 4. Do not detect unsuported options
> >
> > New version have also:
> > 1. Support -prt options
> > 2. Use vfork (special algorithm)
> > 3. Reduce memory allocate
> >
>
> Applied
>
> Thanks
Thanks!
I think, idea from my xargs_exec may be true algorith for use for
new run_part() libbb function. No MMU mashines can use vfork but
can`t use fork().
int pid;
+ int common[4]; /* common vfork stack */
+ common[0] = 0;
- if ((pid = fork()) < 0) {
+ if ((pid = vfork()) < 0) {
perror_msg_and_die("failed to vfork");
} else if (!pid) {
execv(args[0], args);
+ common[0]=errno;
+ _exit(1);
- perror_msg_and_die("failed to exec %s", args[0]);
}
+ if(common[0]) {
+ errno = common[0];
+ perror_msg_and_die("failed to exec %s", args[0]);
+ }
waitpid(pid, &result, 0);
--w
vodz
More information about the busybox
mailing list