diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2017-08-06 14:03:27 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2017-08-06 14:03:27 +0200 |
commit | fbecca1bed1b6daf10341304af2156baabc7af57 (patch) | |
tree | 8ede3ecea0ce8de7c033b093954c049b1ba7a0c0 /docs/nofork_noexec.txt | |
parent | 9a58cc0f7fbdf967c159588e0de5f3a8dfd87db5 (diff) | |
download | busybox-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.txt | 53 |
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 | |||
10 | for speeding up busybox shells, and more. NOEXEC and NOFORK applets | 10 | for speeding up busybox shells, and more. NOEXEC and NOFORK applets |
11 | are exactly those applets which are eligible for these tricks. | 11 | are exactly those applets which are eligible for these tricks. |
12 | 12 | ||
13 | Applet will be subject to NOFORK/NOEXEC tricks if it is marked as such | 13 | Applet will be subject to NOFORK/NOEXEC tricks only if it is marked |
14 | in applets.h. FEATURE_PREFER_APPLETS is a config option which | 14 | as such in applets.src.h or in their inline "//applet:" directives. |
15 | globally enables usage of NOFORK/NOEXEC tricks. | ||
16 | If it is enabled, FEATURE_SH_STANDALONE can be enabled too, | ||
17 | and then shells will use NOFORK/NOEXEC tricks for ordinary commands. | ||
18 | NB: shell builtins use these tricks regardless of FEATURE_SH_STANDALONE | ||
19 | or FEATURE_PREFER_APPLETS. | ||
20 | 15 | ||
21 | In C, if you want to call a program and wait for it, use | 16 | In C, if you want to call a program and wait for it, use |
22 | spawn_and_wait(argv), BB_EXECVP(prog,argv) or BB_EXECLP(prog,argv0,...). | 17 | spawn_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 | |||
24 | do NOFORK/NOEXEC thing depending on configuration. | 19 | do NOFORK/NOEXEC thing depending on configuration. |
25 | 20 | ||
26 | 21 | ||
22 | Relevant CONFIG options | ||
23 | |||
24 | FEATURE_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 | |||
33 | FEATURE_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 | |||
39 | FEATURE_SH_NOFORK | ||
40 | shells will do NOFORK trick on NOFORK applets | ||
41 | |||
42 | NB: shell builtins use these tricks regardless of FEATURE_SH_STANDALONE, | ||
43 | FEATURE_PREFER_APPLETS or FEATURE_SH_NOFORK. In effect, builtins | ||
44 | are "always NOFORK". | ||
45 | |||
46 | |||
27 | NOEXEC | 47 | NOEXEC |
28 | 48 | ||
29 | NOEXEC applet should work correctly if another applet forks and then | 49 | NOEXEC applet should work correctly if another applet forks and then |
@@ -121,22 +141,3 @@ option_mask32 getting trashed. | |||
121 | It's the same trusty spawn_and_wait(argv). If FEATURE_PREFER_APPLETS=y, | 141 | It's the same trusty spawn_and_wait(argv). If FEATURE_PREFER_APPLETS=y, |
122 | it does NOEXEC trick. It resets xfunc_error_retval = 1 and | 142 | it does NOEXEC trick. It resets xfunc_error_retval = 1 and |
123 | logmode = LOGMODE_STDIO in the child. | 143 | logmode = LOGMODE_STDIO in the child. |
124 | |||
125 | |||
126 | Relevant CONFIG options | ||
127 | |||
128 | FEATURE_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 | |||
135 | FEATURE_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 | |||
141 | FEATURE_SH_NOFORK | ||
142 | shells will do NOFORK trick on NOFORK applets | ||