Openwrt/openwrt/package/busybox/patches/100-killall5.patch

86 lines
2.6 KiB
Diff
Raw Normal View History

diff -ruN busybox-1.2.0-old/include/applets.h busybox-1.2.0-new/include/applets.h
--- busybox-1.2.0-old/include/applets.h 2006-07-01 00:42:10.000000000 +0200
+++ busybox-1.2.0-new/include/applets.h 2006-07-31 00:29:34.000000000 +0200
@@ -157,6 +157,7 @@
USE_IPTUNNEL(APPLET(iptunnel, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_KILL(APPLET(kill, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_KILLALL(APPLET_ODDNAME(killall, kill, _BB_DIR_USR_BIN, _BB_SUID_NEVER, killall))
+USE_KILLALL5(APPLET_ODDNAME(killall5, kill, _BB_DIR_USR_BIN, _BB_SUID_NEVER, killall5))
USE_KLOGD(APPLET(klogd, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_LASH(APPLET(lash, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_LAST(APPLET(last, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
diff -ruN busybox-1.2.0-old/include/usage.h busybox-1.2.0-new/include/usage.h
--- busybox-1.2.0-old/include/usage.h 2006-07-01 00:42:10.000000000 +0200
+++ busybox-1.2.0-new/include/usage.h 2006-07-31 00:25:57.000000000 +0200
@@ -1503,6 +1503,13 @@
#define killall_example_usage \
"$ killall apache\n"
+#define killall5_trivial_usage \
+ ""
+#define killall5_full_usage \
+ ""
+#define killall5_example_usage \
+ ""
+
#define klogd_trivial_usage \
"[-c n] [-n]"
#define klogd_full_usage \
diff -ruN busybox-1.2.0-old/procps/Config.in busybox-1.2.0-new/procps/Config.in
--- busybox-1.2.0-old/procps/Config.in 2006-07-01 00:42:12.000000000 +0200
+++ busybox-1.2.0-new/procps/Config.in 2006-07-31 00:25:57.000000000 +0200
@@ -38,6 +38,11 @@
specified commands. If no signal name is specified, SIGTERM is
sent.
+config CONFIG_KILLALL5
+ bool "killall5"
+ default n
+ depends on CONFIG_KILL
+
config CONFIG_PIDOF
bool "pidof"
default n
diff -ruN busybox-1.2.0-old/procps/kill.c busybox-1.2.0-new/procps/kill.c
--- busybox-1.2.0-old/procps/kill.c 2006-07-01 00:42:12.000000000 +0200
+++ busybox-1.2.0-new/procps/kill.c 2006-07-31 00:25:57.000000000 +0200
@@ -20,6 +20,7 @@
#define KILL 0
#define KILLALL 1
+#define KILLALL5 2
int kill_main(int argc, char **argv)
{
@@ -34,6 +35,9 @@
#else
whichApp = KILL;
#endif
+#ifdef CONFIG_KILLALL5
+ whichApp = (strcmp(bb_applet_name, "killall5") == 0)? KILLALL5 : whichApp;
+#endif
/* Parse any options */
if (argc < 2)
@@ -112,6 +116,20 @@
}
}
+#ifdef CONFIG_KILLALL5
+ else if (whichApp == KILLALL5) {
+ procps_status_t * p;
+ pid_t myPid=getpid();
+ while ((p = procps_scan(0)) != 0) {
+ if (p->pid != 1 && p->pid != myPid && p->pid != p->ppid) {
+ if (kill(p->pid, signo) != 0) {
+ bb_perror_msg( "Could not kill pid '%d'", p->pid);
+ errors++;
+ }
+ }
+ }
+ }
+#endif
#ifdef CONFIG_KILLALL
else {
pid_t myPid=getpid();