1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-11-09 09:38:26 +02:00
openwrt-xburst/package/busybox/patches/100-killall5.patch
kaloz 2fe852f5c0 upgrade busybox to v1.1.1
git-svn-id: svn://svn.openwrt.org/openwrt/trunk/openwrt@3578 3c298f89-4303-0410-b956-a3cf2f4a3e73
2006-04-02 15:16:27 +00:00

86 lines
2.6 KiB
Diff

diff -Nur busybox-1.1.1/include/applets.h busybox-1.1.1-owrt/include/applets.h
--- busybox-1.1.1/include/applets.h 2006-03-22 22:16:24.000000000 +0100
+++ busybox-1.1.1-owrt/include/applets.h 2006-04-01 18:23:43.000000000 +0200
@@ -154,6 +154,7 @@
USE_IPTUNNEL(APPLET(iptunnel, iptunnel_main, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_KILL(APPLET(kill, kill_main, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_KILLALL(APPLET(killall, kill_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
+USE_KILLALL5(APPLET(killall5, kill_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
USE_KLOGD(APPLET(klogd, klogd_main, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_LASH(APPLET(lash, lash_main, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_LAST(APPLET(last, last_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
diff -Nur busybox-1.1.1/include/usage.h busybox-1.1.1-owrt/include/usage.h
--- busybox-1.1.1/include/usage.h 2006-03-22 22:16:24.000000000 +0100
+++ busybox-1.1.1-owrt/include/usage.h 2006-04-01 18:22:53.000000000 +0200
@@ -1598,6 +1598,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 -Nur busybox-1.1.1/procps/Config.in busybox-1.1.1-owrt/procps/Config.in
--- busybox-1.1.1/procps/Config.in 2006-03-22 22:16:25.000000000 +0100
+++ busybox-1.1.1-owrt/procps/Config.in 2006-04-01 18:22:53.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 -Nur busybox-1.1.1/procps/kill.c busybox-1.1.1-owrt/procps/kill.c
--- busybox-1.1.1/procps/kill.c 2006-03-22 22:16:25.000000000 +0100
+++ busybox-1.1.1-owrt/procps/kill.c 2006-04-01 18:22:53.000000000 +0200
@@ -34,6 +34,7 @@
#define KILL 0
#define KILLALL 1
+#define KILLALL5 2
int kill_main(int argc, char **argv)
{
@@ -48,6 +49,9 @@
#else
whichApp = KILL;
#endif
+#ifdef CONFIG_KILLALL5
+ whichApp = (strcmp(bb_applet_name, "killall5") == 0)? KILLALL5 : whichApp;
+#endif
/* Parse any options */
if (argc < 2)
@@ -126,6 +130,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();