diff options
author | Denys Vlasenko | 2016-11-23 06:43:46 +0100 |
---|---|---|
committer | Denys Vlasenko | 2016-11-23 06:43:46 +0100 |
commit | 5467d268f09ddddd200ab14fd402831708be5dfd (patch) | |
tree | f22a0e6dfed031e499d7eb75da577fc842150e87 | |
parent | f8f81ed7aaf90897fa9a4687dac75152740a71e2 (diff) | |
download | busybox-5467d268f09ddddd200ab14fd402831708be5dfd.zip busybox-5467d268f09ddddd200ab14fd402831708be5dfd.tar.gz |
Make killall and killall5 selecatable independent from kill
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | procps/kill.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/procps/kill.c b/procps/kill.c index 1ee79a0..57a33bc 100644 --- a/procps/kill.c +++ b/procps/kill.c @@ -18,7 +18,6 @@ //config:config KILLALL //config: bool "killall" //config: default y -//config: depends on KILL //config: help //config: killall sends a signal to all processes running any of the //config: specified commands. If no signal name is specified, SIGTERM is @@ -27,8 +26,11 @@ //config:config KILLALL5 //config: bool "killall5" //config: default y -//config: depends on KILL -//config: +//config: help +//config: The SystemV killall command. killall5 sends a signal +//config: to all processes except kernel threads and the processes +//config: in its own session, so it won't kill the shell that is running +//config: the script it was called from. //applet:IF_KILL(APPLET(kill, BB_DIR_BIN, BB_SUID_DROP)) //applet:IF_KILLALL(APPLET_ODDNAME(killall, kill, BB_DIR_USR_BIN, BB_SUID_DROP, killall)) @@ -95,17 +97,23 @@ int kill_main(int argc UNUSED_PARAM, char **argv) char *arg; pid_t pid; int signo = SIGTERM, errors = 0, quiet = 0; -#if !ENABLE_KILLALL && !ENABLE_KILLALL5 -#define killall 0 -#define killall5 0 +#if ENABLE_KILL && !ENABLE_KILLALL && !ENABLE_KILLALL5 +# define killall 0 +# define killall5 0 +#elif !ENABLE_KILL && ENABLE_KILLALL && !ENABLE_KILLALL5 +# define killall 1 +# define killall5 0 +#elif !ENABLE_KILL && !ENABLE_KILLALL && ENABLE_KILLALL5 +# define killall 0 +# define killall5 1 #else /* How to determine who we are? find 3rd char from the end: * kill, killall, killall5 * ^i ^a ^l - it's unique * (checking from the start is complicated by /bin/kill... case) */ const char char3 = argv[0][strlen(argv[0]) - 3]; -#define killall (ENABLE_KILLALL && char3 == 'a') -#define killall5 (ENABLE_KILLALL5 && char3 == 'l') +# define killall (ENABLE_KILLALL && char3 == 'a') +# define killall5 (ENABLE_KILLALL5 && char3 == 'l') #endif /* Parse any options */ |