Implement first instance of NOFORK applet - echo

find: use NOFORK/NOEXEC; small -exec buglet also eliminated
vfork_daemon_rexec: honor PREFER_APPLETS
echo: small size improvements

find -exec echo {} \; with PREFER_APPLETS=y runs 4 times faster
This commit is contained in:
Denis Vlasenko
2007-04-09 13:04:50 +00:00
parent 2dfdd44d9d
commit 7e754f12d3
6 changed files with 77 additions and 50 deletions

View File

@ -26,14 +26,16 @@ pid_t spawn(char **argv)
volatile int failed;
pid_t pid;
// Be nice to nommu machines.
// Ain't it a good place to fflush(NULL)?
/* Be nice to nommu machines. */
failed = 0;
pid = vfork();
if (pid < 0) /* error */
return pid;
if (!pid) { /* child */
/* Don't use BB_EXECVP tricks here! */
execvp(argv[0], argv);
/* This macro is ok - it doesn't do NOEXEC/NOFORK tricks */
BB_EXECVP(argv[0], argv);
/* We are (maybe) sharing a stack with blocked parent,
* let parent know we failed and then exit to unblock parent