1
#! /bin/sh /usr/share/dpatch/dpatch-run
2
## 82_killall_retval.dpatch by Petter Reinholdtsen
4
Modify killall5 to make it report if it found any processes to kill.
5
This make it possible to avoid sleeping for 5 seconds during shutdown
6
if there are no processes left to wait for.
9
diff -urNad trunk~/man/killall5.8 trunk/man/killall5.8
10
--- trunk~/man/killall5.8 2008-03-26 09:30:38.000000000 +0100
11
+++ trunk/man/killall5.8 2008-03-26 09:31:29.000000000 +0100
13
kernel threads and the processes in its own session, so it won't kill
14
the shell that is running the script it was called from. Its primary
15
(only) use is in the \fBrc\fP scripts found in the /etc/init.d directory.
17
+The program return zero if it killed processes. It return 2 if no
18
+process were killed, and 1 if it was unable to find any processes
23
diff -urNad trunk~/src/killall5.c trunk/src/killall5.c
24
--- trunk~/src/killall5.c 2008-03-26 09:31:28.000000000 +0100
25
+++ trunk/src/killall5.c 2008-03-26 09:31:29.000000000 +0100
30
+ /* return non-zero if no process was killed */
33
/* Get program name. */
34
if ((progname = strrchr(argv[0], '/')) == NULL)
37
/* Read /proc filesystem */
44
/* Now kill all processes except init (pid 1) and our session. */
47
for (p = plist; p; p = p->next)
48
- if (p->pid != 1 && p->pid != pid && p->sid != sid && !p->kernel)
49
+ if (p->pid != 1 && p->pid != pid && p->sid != sid && !p->kernel) {
54
/* And let them continue. */
57
/* Force the kernel to run the scheduler */