aboutsummaryrefslogtreecommitdiff
path: root/libbb/vfork_daemon_rexec.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-06-27 02:52:20 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-06-27 02:52:20 +0000
commitdefc1ea34074e7882724c460260d307cdf981a70 (patch)
treefca9b9a5fe243f9c0c76b84824ea2ff92ea8e589 /libbb/vfork_daemon_rexec.c
parent26bc57d8b26425f23f4be974cce7bf35c95c9a1a (diff)
downloadbusybox-w32-defc1ea34074e7882724c460260d307cdf981a70.tar.gz
busybox-w32-defc1ea34074e7882724c460260d307cdf981a70.tar.bz2
busybox-w32-defc1ea34074e7882724c460260d307cdf981a70.zip
*: introduce and use FAST_FUNC: regparm on i386, otherwise no-on
text data bss dec hex filename 808035 611 6868 815514 c719a busybox_old 804472 611 6868 811951 c63af busybox_unstripped
Diffstat (limited to 'libbb/vfork_daemon_rexec.c')
-rw-r--r--libbb/vfork_daemon_rexec.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/libbb/vfork_daemon_rexec.c b/libbb/vfork_daemon_rexec.c
index 9624efbb9..37d4c274e 100644
--- a/libbb/vfork_daemon_rexec.c
+++ b/libbb/vfork_daemon_rexec.c
@@ -20,7 +20,7 @@
20 20
21/* This does a fork/exec in one call, using vfork(). Returns PID of new child, 21/* This does a fork/exec in one call, using vfork(). Returns PID of new child,
22 * -1 for failure. Runs argv[0], searching path if that has no / in it. */ 22 * -1 for failure. Runs argv[0], searching path if that has no / in it. */
23pid_t spawn(char **argv) 23pid_t FAST_FUNC spawn(char **argv)
24{ 24{
25 /* Compiler should not optimize stores here */ 25 /* Compiler should not optimize stores here */
26 volatile int failed; 26 volatile int failed;
@@ -58,7 +58,7 @@ pid_t spawn(char **argv)
58} 58}
59 59
60/* Die with an error message if we can't spawn a child process. */ 60/* Die with an error message if we can't spawn a child process. */
61pid_t xspawn(char **argv) 61pid_t FAST_FUNC xspawn(char **argv)
62{ 62{
63 pid_t pid = spawn(argv); 63 pid_t pid = spawn(argv);
64 if (pid < 0) 64 if (pid < 0)
@@ -66,7 +66,7 @@ pid_t xspawn(char **argv)
66 return pid; 66 return pid;
67} 67}
68 68
69int safe_waitpid(int pid, int *wstat, int options) 69int FAST_FUNC safe_waitpid(int pid, int *wstat, int options)
70{ 70{
71 int r; 71 int r;
72 72
@@ -76,13 +76,13 @@ int safe_waitpid(int pid, int *wstat, int options)
76 return r; 76 return r;
77} 77}
78 78
79int wait_any_nohang(int *wstat) 79int FAST_FUNC wait_any_nohang(int *wstat)
80{ 80{
81 return safe_waitpid(-1, wstat, WNOHANG); 81 return safe_waitpid(-1, wstat, WNOHANG);
82} 82}
83 83
84// Wait for the specified child PID to exit, returning child's error return. 84// Wait for the specified child PID to exit, returning child's error return.
85int wait4pid(int pid) 85int FAST_FUNC wait4pid(int pid)
86{ 86{
87 int status; 87 int status;
88 88
@@ -101,7 +101,7 @@ int wait4pid(int pid)
101} 101}
102 102
103#if ENABLE_FEATURE_PREFER_APPLETS 103#if ENABLE_FEATURE_PREFER_APPLETS
104void save_nofork_data(struct nofork_save_area *save) 104void FAST_FUNC save_nofork_data(struct nofork_save_area *save)
105{ 105{
106 memcpy(&save->die_jmp, &die_jmp, sizeof(die_jmp)); 106 memcpy(&save->die_jmp, &die_jmp, sizeof(die_jmp));
107 save->applet_name = applet_name; 107 save->applet_name = applet_name;
@@ -111,7 +111,7 @@ void save_nofork_data(struct nofork_save_area *save)
111 save->saved = 1; 111 save->saved = 1;
112} 112}
113 113
114void restore_nofork_data(struct nofork_save_area *save) 114void FAST_FUNC restore_nofork_data(struct nofork_save_area *save)
115{ 115{
116 memcpy(&die_jmp, &save->die_jmp, sizeof(die_jmp)); 116 memcpy(&die_jmp, &save->die_jmp, sizeof(die_jmp));
117 applet_name = save->applet_name; 117 applet_name = save->applet_name;
@@ -120,7 +120,7 @@ void restore_nofork_data(struct nofork_save_area *save)
120 die_sleep = save->die_sleep; 120 die_sleep = save->die_sleep;
121} 121}
122 122
123int run_nofork_applet_prime(struct nofork_save_area *old, int applet_no, char **argv) 123int FAST_FUNC run_nofork_applet_prime(struct nofork_save_area *old, int applet_no, char **argv)
124{ 124{
125 int rc, argc; 125 int rc, argc;
126 126
@@ -166,7 +166,7 @@ int run_nofork_applet_prime(struct nofork_save_area *old, int applet_no, char **
166 return rc & 0xff; /* don't confuse people with "exitcodes" >255 */ 166 return rc & 0xff; /* don't confuse people with "exitcodes" >255 */
167} 167}
168 168
169int run_nofork_applet(int applet_no, char **argv) 169int FAST_FUNC run_nofork_applet(int applet_no, char **argv)
170{ 170{
171 struct nofork_save_area old; 171 struct nofork_save_area old;
172 172
@@ -176,7 +176,7 @@ int run_nofork_applet(int applet_no, char **argv)
176} 176}
177#endif /* FEATURE_PREFER_APPLETS */ 177#endif /* FEATURE_PREFER_APPLETS */
178 178
179int spawn_and_wait(char **argv) 179int FAST_FUNC spawn_and_wait(char **argv)
180{ 180{
181 int rc; 181 int rc;
182#if ENABLE_FEATURE_PREFER_APPLETS 182#if ENABLE_FEATURE_PREFER_APPLETS
@@ -210,7 +210,7 @@ int spawn_and_wait(char **argv)
210} 210}
211 211
212#if !BB_MMU 212#if !BB_MMU
213void re_exec(char **argv) 213void FAST_FUNC re_exec(char **argv)
214{ 214{
215 /* high-order bit of first char in argv[0] is a hidden 215 /* high-order bit of first char in argv[0] is a hidden
216 * "we have (already) re-execed, don't do it again" flag */ 216 * "we have (already) re-execed, don't do it again" flag */
@@ -219,7 +219,7 @@ void re_exec(char **argv)
219 bb_perror_msg_and_die("exec %s", bb_busybox_exec_path); 219 bb_perror_msg_and_die("exec %s", bb_busybox_exec_path);
220} 220}
221 221
222void forkexit_or_rexec(char **argv) 222void FAST_FUNC forkexit_or_rexec(char **argv)
223{ 223{
224 pid_t pid; 224 pid_t pid;
225 /* Maybe we are already re-execed and come here again? */ 225 /* Maybe we are already re-execed and come here again? */
@@ -237,7 +237,7 @@ void forkexit_or_rexec(char **argv)
237#else 237#else
238/* Dance around (void)...*/ 238/* Dance around (void)...*/
239#undef forkexit_or_rexec 239#undef forkexit_or_rexec
240void forkexit_or_rexec(void) 240void FAST_FUNC forkexit_or_rexec(void)
241{ 241{
242 pid_t pid; 242 pid_t pid;
243 pid = fork(); 243 pid = fork();
@@ -252,7 +252,7 @@ void forkexit_or_rexec(void)
252 252
253/* Due to a #define in libbb.h on MMU systems we actually have 1 argument - 253/* Due to a #define in libbb.h on MMU systems we actually have 1 argument -
254 * char **argv "vanishes" */ 254 * char **argv "vanishes" */
255void bb_daemonize_or_rexec(int flags, char **argv) 255void FAST_FUNC bb_daemonize_or_rexec(int flags, char **argv)
256{ 256{
257 int fd; 257 int fd;
258 258
@@ -286,7 +286,7 @@ void bb_daemonize_or_rexec(int flags, char **argv)
286 } 286 }
287} 287}
288 288
289void bb_sanitize_stdio(void) 289void FAST_FUNC bb_sanitize_stdio(void)
290{ 290{
291 bb_daemonize_or_rexec(DAEMON_ONLY_SANITIZE, NULL); 291 bb_daemonize_or_rexec(DAEMON_ONLY_SANITIZE, NULL);
292} 292}