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 | |
parent | 9a58cc0f7fbdf967c159588e0de5f3a8dfd87db5 (diff) | |
download | busybox-fbecca1bed1b6daf10341304af2156baabc7af57.tar.gz |
Tweak outdated documentation and comments
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | docs/new-applet-HOWTO.txt | 15 | ||||
-rw-r--r-- | docs/nofork_noexec.txt | 53 | ||||
-rw-r--r-- | networking/arping.c | 4 |
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 Find the appropriate directory for your new applet. -Add the kbuild snippet to the .c file: - -//kbuild:lib-$(CONFIG_MU) += mu.o - Add the config snippet to the .c file: //config:config MU //config: bool "MU" //config: default y //config: help -//config: Returns an indeterminate value. +//config: Returns an indeterminate value. + +Add the kbuild snippet to the .c file: + +//kbuild:lib-$(CONFIG_MU) += mu.o Usage String(s) @@ -168,8 +168,9 @@ This should look like the following: //usage:#define mu_trivial_usage //usage: "[-abcde] FILE..." -//usage:#define mu_full_usage -//usage: "Returns an indeterminate value\n" +//usage:#define mu_full_usage "\n\n" +//usage: "Returns an indeterminate value" +//usage: "\n" //usage: "\n -a First function" //usage: "\n -b Second function" //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 for speeding up busybox shells, and more. NOEXEC and NOFORK applets are exactly those applets which are eligible for these tricks. -Applet will be subject to NOFORK/NOEXEC tricks if it is marked as such -in applets.h. FEATURE_PREFER_APPLETS is a config option which -globally enables usage of NOFORK/NOEXEC tricks. -If it is enabled, FEATURE_SH_STANDALONE can be enabled too, -and then shells will use NOFORK/NOEXEC tricks for ordinary commands. -NB: shell builtins use these tricks regardless of FEATURE_SH_STANDALONE -or FEATURE_PREFER_APPLETS. +Applet will be subject to NOFORK/NOEXEC tricks only if it is marked +as such in applets.src.h or in their inline "//applet:" directives. In C, if you want to call a program and wait for it, use 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 do NOFORK/NOEXEC thing depending on configuration. + Relevant CONFIG options + +FEATURE_PREFER_APPLETS + Globally enables NOFORK/NOEXEC tricks for such programs as xargs + and find: + BB_EXECVP(cmd, argv) will try to exec /proc/self/exe + if command's name matches some applet name; + spawn_and_wait(argv) will do NOFORK/NOEXEC tricks + +//TODO: the above two things probably should have separate options? + +FEATURE_SH_STANDALONE + shells will try to exec /proc/self/exe if command's name matches + some applet name; shells will do NOEXEC trick on NOEXEC applets + +//TODO: split (same as for PREFER_APPLETS) + +FEATURE_SH_NOFORK + shells will do NOFORK trick on NOFORK applets + +NB: shell builtins use these tricks regardless of FEATURE_SH_STANDALONE, +FEATURE_PREFER_APPLETS or FEATURE_SH_NOFORK. In effect, builtins +are "always NOFORK". + + NOEXEC NOEXEC applet should work correctly if another applet forks and then @@ -121,22 +141,3 @@ option_mask32 getting trashed. It's the same trusty spawn_and_wait(argv). If FEATURE_PREFER_APPLETS=y, it does NOEXEC trick. It resets xfunc_error_retval = 1 and logmode = LOGMODE_STDIO in the child. - - - Relevant CONFIG options - -FEATURE_PREFER_APPLETS - BB_EXECVP(cmd, argv) will try to exec /proc/self/exe - if command's name matches some applet name; - spawn_and_wait(argv) will do NOFORK/NOEXEC tricks - -//TODO: the above two things probably should have separate options? - -FEATURE_SH_STANDALONE - shells will try to exec /proc/self/exe if command's name matches - some applet name; shells will do NOEXEC trick on NOEXEC applets - -//TODO: split (same as for PREFER_APPLETS) - -FEATURE_SH_NOFORK - 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) sock_fd = xsocket(AF_PACKET, SOCK_DGRAM, 0); - // Drop suid root privileges - // Need to remove SUID_NEVER from applets.h for this to work + // If you ever change BB_SUID_DROP to BB_SUID_REQUIRE, + // drop suid root privileges here: //xsetuid(getuid()); { |