diff options
author | Pascal Bellard <pascal.bellard@ads-lu.com> | 2010-07-04 15:32:38 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-07-04 15:32:38 +0200 |
commit | 926031b7640bf5aad2ffcd54b096911743a47d97 (patch) | |
tree | 093e0e1bab2c905a97c5880e4942e2000ada7e72 /shell | |
parent | 243d1757d798a0cd43f51eb1db75cc1e81c65732 (diff) | |
download | busybox-w32-926031b7640bf5aad2ffcd54b096911743a47d97.tar.gz busybox-w32-926031b7640bf5aad2ffcd54b096911743a47d97.tar.bz2 busybox-w32-926031b7640bf5aad2ffcd54b096911743a47d97.zip |
*: introduce and use xfork() and xvfork()
function old new delta
launch_helper 170 169 -1
setup_heredoc 312 302 -10
handle_dir_common 367 354 -13
expand_vars_to_list 2456 2443 -13
open_transformer 89 74 -15
data_extract_to_command 439 423 -16
do_ipaddr 1406 1389 -17
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/7 up/down: 0/-85) Total: -85 bytes
Signed-off-by: Pascal Bellard <pascal.bellard@ads-lu.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell')
-rw-r--r-- | shell/hush.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/shell/hush.c b/shell/hush.c index 29ff3c442..831443e2e 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
@@ -3208,15 +3208,11 @@ static void setup_heredoc(struct redir_struct *redir) | |||
3208 | #if !BB_MMU | 3208 | #if !BB_MMU |
3209 | to_free = NULL; | 3209 | to_free = NULL; |
3210 | #endif | 3210 | #endif |
3211 | pid = vfork(); | 3211 | pid = xvfork(); |
3212 | if (pid < 0) | ||
3213 | bb_perror_msg_and_die("vfork"); | ||
3214 | if (pid == 0) { | 3212 | if (pid == 0) { |
3215 | /* child */ | 3213 | /* child */ |
3216 | disable_restore_tty_pgrp_on_exit(); | 3214 | disable_restore_tty_pgrp_on_exit(); |
3217 | pid = BB_MMU ? fork() : vfork(); | 3215 | pid = BB_MMU ? xfork() : xvfork(); |
3218 | if (pid < 0) | ||
3219 | bb_perror_msg_and_die(BB_MMU ? "fork" : "vfork"); | ||
3220 | if (pid != 0) | 3216 | if (pid != 0) |
3221 | _exit(0); | 3217 | _exit(0); |
3222 | /* grandchild */ | 3218 | /* grandchild */ |
@@ -4450,7 +4446,7 @@ static NOINLINE int run_pipe(struct pipe *pi) | |||
4450 | argv_expanded = NULL; | 4446 | argv_expanded = NULL; |
4451 | if (command->pid < 0) { /* [v]fork failed */ | 4447 | if (command->pid < 0) { /* [v]fork failed */ |
4452 | /* Clearly indicate, was it fork or vfork */ | 4448 | /* Clearly indicate, was it fork or vfork */ |
4453 | bb_perror_msg(BB_MMU ? "fork" : "vfork"); | 4449 | bb_perror_msg(BB_MMU ? "vfork"+1 : "vfork"); |
4454 | } else { | 4450 | } else { |
4455 | pi->alive_cmds++; | 4451 | pi->alive_cmds++; |
4456 | #if ENABLE_HUSH_JOB | 4452 | #if ENABLE_HUSH_JOB |
@@ -5586,10 +5582,7 @@ static FILE *generate_stream_from_string(const char *s, pid_t *pid_p) | |||
5586 | # endif | 5582 | # endif |
5587 | 5583 | ||
5588 | xpipe(channel); | 5584 | xpipe(channel); |
5589 | pid = BB_MMU ? fork() : vfork(); | 5585 | pid = BB_MMU ? xfork() : xvfork(); |
5590 | if (pid < 0) | ||
5591 | bb_perror_msg_and_die(BB_MMU ? "fork" : "vfork"); | ||
5592 | |||
5593 | if (pid == 0) { /* child */ | 5586 | if (pid == 0) { /* child */ |
5594 | disable_restore_tty_pgrp_on_exit(); | 5587 | disable_restore_tty_pgrp_on_exit(); |
5595 | /* Process substitution is not considered to be usual | 5588 | /* Process substitution is not considered to be usual |