diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-04-13 02:25:53 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-04-13 02:25:53 +0000 |
commit | 7465dbcf2a4c0a0983d40e5c0f5c057d2ed04125 (patch) | |
tree | fdbbbaab05b45dfb3f67e62e23863e4cc899584b /libbb | |
parent | f78a656f7c287c0963d985490b3e77751b4a81bc (diff) | |
download | busybox-w32-7465dbcf2a4c0a0983d40e5c0f5c057d2ed04125.tar.gz busybox-w32-7465dbcf2a4c0a0983d40e5c0f5c057d2ed04125.tar.bz2 busybox-w32-7465dbcf2a4c0a0983d40e5c0f5c057d2ed04125.zip |
ash: speed up NOFORK code in ash by eliminating second find_applet().
some code reduction along the way.
function old new delta
run_list 1971 1981 +10
run_nofork_applet_prime 181 182 +1
unsetcmd 97 96 -1
delete_cmd_entry 54 53 -1
describe_command 399 397 -2
cmdlookup 152 150 -2
evaltreenr 602 599 -3
evaltree 602 599 -3
clearcmdentry 101 98 -3
cdcmd 675 672 -3
hashcmd 305 301 -4
find_command 933 910 -23
evalcommand 1371 1229 -142
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/11 up/down: 11/-187) Total: -176 bytes
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/vfork_daemon_rexec.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/libbb/vfork_daemon_rexec.c b/libbb/vfork_daemon_rexec.c index 1567d89be..2c4c930b2 100644 --- a/libbb/vfork_daemon_rexec.c +++ b/libbb/vfork_daemon_rexec.c | |||
@@ -146,6 +146,15 @@ int run_nofork_applet_prime(struct nofork_save_area *old, int applet_no, char ** | |||
146 | memcpy(tmp_argv, argv, (argc+1) * sizeof(tmp_argv[0])); | 146 | memcpy(tmp_argv, argv, (argc+1) * sizeof(tmp_argv[0])); |
147 | /* Finally we can call NOFORK applet's main() */ | 147 | /* Finally we can call NOFORK applet's main() */ |
148 | rc = applet_main[applet_no](argc, tmp_argv); | 148 | rc = applet_main[applet_no](argc, tmp_argv); |
149 | |||
150 | /* The whole reason behind nofork_save_area is that <applet>_main | ||
151 | * may exit non-locally! For example, in hush Ctrl-Z tries to | ||
152 | * (modulo bugs) to dynamically create child (backgrounded task) | ||
153 | * if it detects that Ctrl-Z was pressed when a NOFORK was running! | ||
154 | * Testcase: interactive "rm -i". | ||
155 | * Don't fool yourself into thinking "and <applet>_main() returns | ||
156 | * quickly here" and removing "useless" nofork_save_area code. */ | ||
157 | |||
149 | } else { /* xfunc died in NOFORK applet */ | 158 | } else { /* xfunc died in NOFORK applet */ |
150 | /* in case they meant to return 0... */ | 159 | /* in case they meant to return 0... */ |
151 | if (rc == -2222) | 160 | if (rc == -2222) |
@@ -154,7 +163,7 @@ int run_nofork_applet_prime(struct nofork_save_area *old, int applet_no, char ** | |||
154 | 163 | ||
155 | /* Restoring globals */ | 164 | /* Restoring globals */ |
156 | restore_nofork_data(old); | 165 | restore_nofork_data(old); |
157 | return rc; | 166 | return rc & 0xff; /* don't confuse people with "exitcodes" >255 */ |
158 | } | 167 | } |
159 | 168 | ||
160 | int run_nofork_applet(int applet_no, char **argv) | 169 | int run_nofork_applet(int applet_no, char **argv) |