aboutsummaryrefslogtreecommitdiff
path: root/procps
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2016-11-23 06:43:46 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2016-11-23 06:43:46 +0100
commit5467d268f09ddddd200ab14fd402831708be5dfd (patch)
treef22a0e6dfed031e499d7eb75da577fc842150e87 /procps
parentf8f81ed7aaf90897fa9a4687dac75152740a71e2 (diff)
downloadbusybox-w32-5467d268f09ddddd200ab14fd402831708be5dfd.tar.gz
busybox-w32-5467d268f09ddddd200ab14fd402831708be5dfd.tar.bz2
busybox-w32-5467d268f09ddddd200ab14fd402831708be5dfd.zip
Make killall and killall5 selecatable independent from kill
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'procps')
-rw-r--r--procps/kill.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/procps/kill.c b/procps/kill.c
index 1ee79a051..57a33bcaa 100644
--- a/procps/kill.c
+++ b/procps/kill.c
@@ -18,7 +18,6 @@
18//config:config KILLALL 18//config:config KILLALL
19//config: bool "killall" 19//config: bool "killall"
20//config: default y 20//config: default y
21//config: depends on KILL
22//config: help 21//config: help
23//config: killall sends a signal to all processes running any of the 22//config: killall sends a signal to all processes running any of the
24//config: specified commands. If no signal name is specified, SIGTERM is 23//config: specified commands. If no signal name is specified, SIGTERM is
@@ -27,8 +26,11 @@
27//config:config KILLALL5 26//config:config KILLALL5
28//config: bool "killall5" 27//config: bool "killall5"
29//config: default y 28//config: default y
30//config: depends on KILL 29//config: help
31//config: 30//config: The SystemV killall command. killall5 sends a signal
31//config: to all processes except kernel threads and the processes
32//config: in its own session, so it won't kill the shell that is running
33//config: the script it was called from.
32 34
33//applet:IF_KILL(APPLET(kill, BB_DIR_BIN, BB_SUID_DROP)) 35//applet:IF_KILL(APPLET(kill, BB_DIR_BIN, BB_SUID_DROP))
34//applet:IF_KILLALL(APPLET_ODDNAME(killall, kill, BB_DIR_USR_BIN, BB_SUID_DROP, killall)) 36//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)
95 char *arg; 97 char *arg;
96 pid_t pid; 98 pid_t pid;
97 int signo = SIGTERM, errors = 0, quiet = 0; 99 int signo = SIGTERM, errors = 0, quiet = 0;
98#if !ENABLE_KILLALL && !ENABLE_KILLALL5 100#if ENABLE_KILL && !ENABLE_KILLALL && !ENABLE_KILLALL5
99#define killall 0 101# define killall 0
100#define killall5 0 102# define killall5 0
103#elif !ENABLE_KILL && ENABLE_KILLALL && !ENABLE_KILLALL5
104# define killall 1
105# define killall5 0
106#elif !ENABLE_KILL && !ENABLE_KILLALL && ENABLE_KILLALL5
107# define killall 0
108# define killall5 1
101#else 109#else
102/* How to determine who we are? find 3rd char from the end: 110/* How to determine who we are? find 3rd char from the end:
103 * kill, killall, killall5 111 * kill, killall, killall5
104 * ^i ^a ^l - it's unique 112 * ^i ^a ^l - it's unique
105 * (checking from the start is complicated by /bin/kill... case) */ 113 * (checking from the start is complicated by /bin/kill... case) */
106 const char char3 = argv[0][strlen(argv[0]) - 3]; 114 const char char3 = argv[0][strlen(argv[0]) - 3];
107#define killall (ENABLE_KILLALL && char3 == 'a') 115# define killall (ENABLE_KILLALL && char3 == 'a')
108#define killall5 (ENABLE_KILLALL5 && char3 == 'l') 116# define killall5 (ENABLE_KILLALL5 && char3 == 'l')
109#endif 117#endif
110 118
111 /* Parse any options */ 119 /* Parse any options */