aboutsummaryrefslogtreecommitdiff
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
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>
-rw-r--r--docs/new-applet-HOWTO.txt15
-rw-r--r--docs/nofork_noexec.txt53
-rw-r--r--networking/arping.c4
3 files changed, 37 insertions, 35 deletions
diff --git a/docs/new-applet-HOWTO.txt b/docs/new-applet-HOWTO.txt
index 078e77bce..619d47fb8 100644
--- a/docs/new-applet-HOWTO.txt
+++ b/docs/new-applet-HOWTO.txt
@@ -147,17 +147,17 @@ Placement / Directory
147 147
148Find the appropriate directory for your new applet. 148Find the appropriate directory for your new applet.
149 149
150Add the kbuild snippet to the .c file:
151
152//kbuild:lib-$(CONFIG_MU) += mu.o
153
154Add the config snippet to the .c file: 150Add the config snippet to the .c file:
155 151
156//config:config MU 152//config:config MU
157//config: bool "MU" 153//config: bool "MU"
158//config: default y 154//config: default y
159//config: help 155//config: help
160//config: Returns an indeterminate value. 156//config: Returns an indeterminate value.
157
158Add the kbuild snippet to the .c file:
159
160//kbuild:lib-$(CONFIG_MU) += mu.o
161 161
162 162
163Usage String(s) 163Usage String(s)
@@ -168,8 +168,9 @@ This should look like the following:
168 168
169//usage:#define mu_trivial_usage 169//usage:#define mu_trivial_usage
170//usage: "[-abcde] FILE..." 170//usage: "[-abcde] FILE..."
171//usage:#define mu_full_usage 171//usage:#define mu_full_usage "\n\n"
172//usage: "Returns an indeterminate value\n" 172//usage: "Returns an indeterminate value"
173//usage: "\n"
173//usage: "\n -a First function" 174//usage: "\n -a First function"
174//usage: "\n -b Second function" 175//usage: "\n -b Second function"
175//usage: ... 176//usage: ...
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
diff --git a/networking/arping.c b/networking/arping.c
index 71672957e..3fd54a287 100644
--- a/networking/arping.c
+++ b/networking/arping.c
@@ -295,8 +295,8 @@ int arping_main(int argc UNUSED_PARAM, char **argv)
295 295
296 sock_fd = xsocket(AF_PACKET, SOCK_DGRAM, 0); 296 sock_fd = xsocket(AF_PACKET, SOCK_DGRAM, 0);
297 297
298 // Drop suid root privileges 298 // If you ever change BB_SUID_DROP to BB_SUID_REQUIRE,
299 // Need to remove SUID_NEVER from applets.h for this to work 299 // drop suid root privileges here:
300 //xsetuid(getuid()); 300 //xsetuid(getuid());
301 301
302 { 302 {