Convert iptables to new packaging style
[openwrt.git] / openwrt / package / busybox / patches / 100-killall5.patch
1 diff -urN busybox-dist/include/applets.h busybox/include/applets.h
2 --- busybox-dist/include/applets.h 2004-03-13 02:33:09.000000000 -0600
3 +++ busybox/include/applets.h 2004-03-16 09:45:29.000000000 -0600
4 @@ -313,6 +313,9 @@
5 #ifdef CONFIG_KILLALL
6 APPLET(killall, kill_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
7 #endif
8 +#ifdef CONFIG_KILLALL5
9 + APPLET(killall5, kill_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
10 +#endif
11 #ifdef CONFIG_KLOGD
12 APPLET(klogd, klogd_main, _BB_DIR_SBIN, _BB_SUID_NEVER)
13 #endif
14 diff -urN busybox-dist/include/usage.h busybox/include/usage.h
15 --- busybox-dist/include/usage.h 2004-03-13 02:33:09.000000000 -0600
16 +++ busybox/include/usage.h 2004-03-16 09:45:29.000000000 -0600
17 @@ -1389,6 +1389,13 @@
18 #define killall_example_usage \
19 "$ killall apache\n"
20
21 +#define killall5_trivial_usage \
22 + ""
23 +#define killall5_full_usage \
24 + ""
25 +#define killall5_example_usage \
26 + ""
27 +
28 #define klogd_trivial_usage \
29 "[-c n] [-n]"
30 #define klogd_full_usage \
31 diff -urN busybox-dist/procps/Config.in busybox/procps/Config.in
32 --- busybox-dist/procps/Config.in 2003-12-24 00:02:11.000000000 -0600
33 +++ busybox/procps/Config.in 2004-03-16 09:45:29.000000000 -0600
34 @@ -30,6 +30,11 @@
35 specified commands. If no signal name is specified, SIGTERM is
36 sent.
37
38 +config CONFIG_KILLALL5
39 + bool "killall5"
40 + default n
41 + depends on CONFIG_KILL
42 +
43 config CONFIG_PIDOF
44 bool "pidof"
45 default n
46 diff -urN busybox-dist/procps/kill.c busybox/procps/kill.c
47 --- busybox-dist/procps/kill.c 2004-03-15 02:29:03.000000000 -0600
48 +++ busybox/procps/kill.c 2004-03-16 09:45:29.000000000 -0600
49 @@ -34,6 +34,7 @@
50
51 #define KILL 0
52 #define KILLALL 1
53 +#define KILLALL5 2
54
55 extern int kill_main(int argc, char **argv)
56 {
57 @@ -47,6 +48,9 @@
58 #else
59 whichApp = KILL;
60 #endif
61 +#ifdef CONFIG_KILLALL5
62 + whichApp = (strcmp(bb_applet_name, "killall5") == 0)? KILLALL5 : whichApp;
63 +#endif
64
65 /* Parse any options */
66 if (argc < 2)
67 @@ -119,6 +123,20 @@
68 }
69
70 }
71 +#ifdef CONFIG_KILLALL5
72 + else if (whichApp == KILLALL5) {
73 + procps_status_t * p;
74 + pid_t myPid=getpid();
75 + while ((p = procps_scan(0)) != 0) {
76 + if (p->pid != 1 && p->pid != myPid && p->pid != p->ppid) {
77 + if (kill(p->pid, signo) != 0) {
78 + bb_perror_msg( "Could not kill pid '%d'", p->pid);
79 + errors++;
80 + }
81 + }
82 + }
83 + }
84 +#endif
85 #ifdef CONFIG_KILLALL
86 else {
87 pid_t myPid=getpid();
This page took 0.046122 seconds and 5 git commands to generate.