aboutsummaryrefslogtreecommitdiff
path: root/docs/nofork_noexec.txt
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2017-08-06 14:03:27 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2017-08-06 14:03:27 +0200
commitfbecca1bed1b6daf10341304af2156baabc7af57 (patch)
tree8ede3ecea0ce8de7c033b093954c049b1ba7a0c0 /docs/nofork_noexec.txt
parent9a58cc0f7fbdf967c159588e0de5f3a8dfd87db5 (diff)
downloadbusybox-w32-fbecca1bed1b6daf10341304af2156baabc7af57.tar.gz
busybox-w32-fbecca1bed1b6daf10341304af2156baabc7af57.tar.bz2
busybox-w32-fbecca1bed1b6daf10341304af2156baabc7af57.zip
Tweak outdated documentation and comments
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'docs/nofork_noexec.txt')
-rw-r--r--docs/nofork_noexec.txt53
1 files changed, 27 insertions, 26 deletions
diff --git a/docs/nofork_noexec.txt b/docs/nofork_noexec.txt
index b45a4be89..9d210a1c9 100644
--- a/docs/nofork_noexec.txt
+++ b/docs/nofork_noexec.txt
@@ -10,13 +10,8 @@ of reimplemented Unix commands, and we can do the same trick
10for speeding up busybox shells, and more. NOEXEC and NOFORK applets 10for speeding up busybox shells, and more. NOEXEC and NOFORK applets
11are exactly those applets which are eligible for these tricks. 11are exactly those applets which are eligible for these tricks.
12 12
13Applet will be subject to NOFORK/NOEXEC tricks if it is marked as such 13Applet will be subject to NOFORK/NOEXEC tricks only if it is marked
14in applets.h. FEATURE_PREFER_APPLETS is a config option which 14as such in applets.src.h or in their inline "//applet:" directives.
15globally enables usage of NOFORK/NOEXEC tricks.
16If it is enabled, FEATURE_SH_STANDALONE can be enabled too,
17and then shells will use NOFORK/NOEXEC tricks for ordinary commands.
18NB: shell builtins use these tricks regardless of FEATURE_SH_STANDALONE
19or FEATURE_PREFER_APPLETS.
20 15
21In C, if you want to call a program and wait for it, use 16In C, if you want to call a program and wait for it, use
22spawn_and_wait(argv), BB_EXECVP(prog,argv) or BB_EXECLP(prog,argv0,...). 17spawn_and_wait(argv), BB_EXECVP(prog,argv) or BB_EXECLP(prog,argv0,...).
@@ -24,6 +19,31 @@ They check whether program name is an applet name and optionally
24do NOFORK/NOEXEC thing depending on configuration. 19do NOFORK/NOEXEC thing depending on configuration.
25 20
26 21
22 Relevant CONFIG options
23
24FEATURE_PREFER_APPLETS
25 Globally enables NOFORK/NOEXEC tricks for such programs as xargs
26 and find:
27 BB_EXECVP(cmd, argv) will try to exec /proc/self/exe
28 if command's name matches some applet name;
29 spawn_and_wait(argv) will do NOFORK/NOEXEC tricks
30
31//TODO: the above two things probably should have separate options?
32
33FEATURE_SH_STANDALONE
34 shells will try to exec /proc/self/exe if command's name matches
35 some applet name; shells will do NOEXEC trick on NOEXEC applets
36
37//TODO: split (same as for PREFER_APPLETS)
38
39FEATURE_SH_NOFORK
40 shells will do NOFORK trick on NOFORK applets
41
42NB: shell builtins use these tricks regardless of FEATURE_SH_STANDALONE,
43FEATURE_PREFER_APPLETS or FEATURE_SH_NOFORK. In effect, builtins
44are "always NOFORK".
45
46
27 NOEXEC 47 NOEXEC
28 48
29NOEXEC applet should work correctly if another applet forks and then 49NOEXEC applet should work correctly if another applet forks and then
@@ -121,22 +141,3 @@ option_mask32 getting trashed.
121It's the same trusty spawn_and_wait(argv). If FEATURE_PREFER_APPLETS=y, 141It's the same trusty spawn_and_wait(argv). If FEATURE_PREFER_APPLETS=y,
122it does NOEXEC trick. It resets xfunc_error_retval = 1 and 142it does NOEXEC trick. It resets xfunc_error_retval = 1 and
123logmode = LOGMODE_STDIO in the child. 143logmode = LOGMODE_STDIO in the child.
124
125
126 Relevant CONFIG options
127
128FEATURE_PREFER_APPLETS
129 BB_EXECVP(cmd, argv) will try to exec /proc/self/exe
130 if command's name matches some applet name;
131 spawn_and_wait(argv) will do NOFORK/NOEXEC tricks
132
133//TODO: the above two things probably should have separate options?
134
135FEATURE_SH_STANDALONE
136 shells will try to exec /proc/self/exe if command's name matches
137 some applet name; shells will do NOEXEC trick on NOEXEC applets
138
139//TODO: split (same as for PREFER_APPLETS)
140
141FEATURE_SH_NOFORK
142 shells will do NOFORK trick on NOFORK applets