diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-07-01 11:11:24 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-07-01 11:11:24 +0000 |
commit | 58d60c3333b988feb72eb867332d9ad773957810 (patch) | |
tree | 1c6d46f7642c863462198e144cd49ca051c8458f /shell/hush.c | |
parent | 49b5c516b5f5cb72ba05d5584e574b4a48cee7c1 (diff) | |
download | busybox-w32-58d60c3333b988feb72eb867332d9ad773957810.tar.gz busybox-w32-58d60c3333b988feb72eb867332d9ad773957810.tar.bz2 busybox-w32-58d60c3333b988feb72eb867332d9ad773957810.zip |
*: introduce and use xfork()
function old new delta
xfork - 20 +20
msh_main 1377 1380 +3
mod_process 455 446 -9
forkexit_or_rexec 30 17 -13
expand_variables 1434 1421 -13
open_transformer 91 76 -15
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/4 up/down: 23/-50) Total: -27 bytes
Diffstat (limited to 'shell/hush.c')
-rw-r--r-- | shell/hush.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/shell/hush.c b/shell/hush.c index 59d8f3f99..27fab0d1b 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
@@ -1902,7 +1902,7 @@ static int run_pipe(struct pipe *pi) | |||
1902 | #endif | 1902 | #endif |
1903 | if (child->pid < 0) { /* [v]fork failed */ | 1903 | if (child->pid < 0) { /* [v]fork failed */ |
1904 | /* Clearly indicate, was it fork or vfork */ | 1904 | /* Clearly indicate, was it fork or vfork */ |
1905 | bb_perror_msg(BB_MMU ? "fork" : "vfork"); | 1905 | bb_perror_msg(BB_MMU ? "vfork" + 1 : "vfork"); |
1906 | } else { | 1906 | } else { |
1907 | pi->alive_progs++; | 1907 | pi->alive_progs++; |
1908 | #if ENABLE_HUSH_JOB | 1908 | #if ENABLE_HUSH_JOB |
@@ -3096,11 +3096,7 @@ static FILE *generate_stream_from_list(struct pipe *head) | |||
3096 | * huge=`cat TESTFILE` # will block here forever | 3096 | * huge=`cat TESTFILE` # will block here forever |
3097 | * echo OK | 3097 | * echo OK |
3098 | */ | 3098 | */ |
3099 | pid = BB_MMU ? fork() : xvfork(); | 3099 | pid = BB_MMU ? xfork() : xvfork(); |
3100 | #if BB_MMU | ||
3101 | if (pid < 0) | ||
3102 | bb_perror_msg_and_die("fork"); | ||
3103 | #endif | ||
3104 | if (pid == 0) { /* child */ | 3100 | if (pid == 0) { /* child */ |
3105 | if (ENABLE_HUSH_JOB) | 3101 | if (ENABLE_HUSH_JOB) |
3106 | die_sleep = 0; /* let nofork's xfuncs die */ | 3102 | die_sleep = 0; /* let nofork's xfuncs die */ |