upgrade busybox to v1.1.1
[openwrt/svn-archive/archive.git] / openwrt / package / busybox / patches / 100-killall5.patch
1 diff -Nur busybox-1.1.1/include/applets.h busybox-1.1.1-owrt/include/applets.h
2 --- busybox-1.1.1/include/applets.h 2006-03-22 22:16:24.000000000 +0100
3 +++ busybox-1.1.1-owrt/include/applets.h 2006-04-01 18:23:43.000000000 +0200
4 @@ -154,6 +154,7 @@
5 USE_IPTUNNEL(APPLET(iptunnel, iptunnel_main, _BB_DIR_BIN, _BB_SUID_NEVER))
6 USE_KILL(APPLET(kill, kill_main, _BB_DIR_BIN, _BB_SUID_NEVER))
7 USE_KILLALL(APPLET(killall, kill_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
8 +USE_KILLALL5(APPLET(killall5, kill_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
9 USE_KLOGD(APPLET(klogd, klogd_main, _BB_DIR_SBIN, _BB_SUID_NEVER))
10 USE_LASH(APPLET(lash, lash_main, _BB_DIR_BIN, _BB_SUID_NEVER))
11 USE_LAST(APPLET(last, last_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
12 diff -Nur busybox-1.1.1/include/usage.h busybox-1.1.1-owrt/include/usage.h
13 --- busybox-1.1.1/include/usage.h 2006-03-22 22:16:24.000000000 +0100
14 +++ busybox-1.1.1-owrt/include/usage.h 2006-04-01 18:22:53.000000000 +0200
15 @@ -1598,6 +1598,13 @@
16 #define killall_example_usage \
17 "$ killall apache\n"
18
19 +#define killall5_trivial_usage \
20 + ""
21 +#define killall5_full_usage \
22 + ""
23 +#define killall5_example_usage \
24 + ""
25 +
26 #define klogd_trivial_usage \
27 "[-c n] [-n]"
28 #define klogd_full_usage \
29 diff -Nur busybox-1.1.1/procps/Config.in busybox-1.1.1-owrt/procps/Config.in
30 --- busybox-1.1.1/procps/Config.in 2006-03-22 22:16:25.000000000 +0100
31 +++ busybox-1.1.1-owrt/procps/Config.in 2006-04-01 18:22:53.000000000 +0200
32 @@ -38,6 +38,11 @@
33 specified commands. If no signal name is specified, SIGTERM is
34 sent.
35
36 +config CONFIG_KILLALL5
37 + bool "killall5"
38 + default n
39 + depends on CONFIG_KILL
40 +
41 config CONFIG_PIDOF
42 bool "pidof"
43 default n
44 diff -Nur busybox-1.1.1/procps/kill.c busybox-1.1.1-owrt/procps/kill.c
45 --- busybox-1.1.1/procps/kill.c 2006-03-22 22:16:25.000000000 +0100
46 +++ busybox-1.1.1-owrt/procps/kill.c 2006-04-01 18:22:53.000000000 +0200
47 @@ -34,6 +34,7 @@
48
49 #define KILL 0
50 #define KILLALL 1
51 +#define KILLALL5 2
52
53 int kill_main(int argc, char **argv)
54 {
55 @@ -48,6 +49,9 @@
56 #else
57 whichApp = KILL;
58 #endif
59 +#ifdef CONFIG_KILLALL5
60 + whichApp = (strcmp(bb_applet_name, "killall5") == 0)? KILLALL5 : whichApp;
61 +#endif
62
63 /* Parse any options */
64 if (argc < 2)
65 @@ -126,6 +130,20 @@
66 }
67
68 }
69 +#ifdef CONFIG_KILLALL5
70 + else if (whichApp == KILLALL5) {
71 + procps_status_t * p;
72 + pid_t myPid=getpid();
73 + while ((p = procps_scan(0)) != 0) {
74 + if (p->pid != 1 && p->pid != myPid && p->pid != p->ppid) {
75 + if (kill(p->pid, signo) != 0) {
76 + bb_perror_msg( "Could not kill pid '%d'", p->pid);
77 + errors++;
78 + }
79 + }
80 + }
81 + }
82 +#endif
83 #ifdef CONFIG_KILLALL
84 else {
85 pid_t myPid=getpid();