summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--procps/kill.c24
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 */