[Pkg-sysvinit-commits] r1447 - in sysvinit-upstream/trunk: doc man src
Petter Reinholdtsen
pere at alioth.debian.org
Sun Jul 12 14:41:53 UTC 2009
Author: pere
Date: 2009-07-12 14:41:52 +0000 (Sun, 12 Jul 2009)
New Revision: 1447
Modified:
sysvinit-upstream/trunk/doc/Changelog
sysvinit-upstream/trunk/man/killall5.8
sysvinit-upstream/trunk/src/killall5.c
Log:
Change killall5 to use the exit value to report if it found any
processes to kill. Patch from Debian.
Modified: sysvinit-upstream/trunk/doc/Changelog
===================================================================
--- sysvinit-upstream/trunk/doc/Changelog 2009-07-12 14:39:45 UTC (rev 1446)
+++ sysvinit-upstream/trunk/doc/Changelog 2009-07-12 14:41:52 UTC (rev 1447)
@@ -65,6 +65,8 @@
string lengths. Patch from SuSe.
* Change wall to make halt include hostname in output.
* Change killall to avoid killing init by mistake. Patch from SuSe.
+ * Change killall5 to use the exit value to report if it found any
+ processes to kill. Patch from Debian.
-- Petter Reinholdtsen <pere at debian.org> Fri, 30 Jul 2004 14:14:58 +0200
Modified: sysvinit-upstream/trunk/man/killall5.8
===================================================================
--- sysvinit-upstream/trunk/man/killall5.8 2009-07-12 14:39:45 UTC (rev 1446)
+++ sysvinit-upstream/trunk/man/killall5.8 2009-07-12 14:41:52 UTC (rev 1447)
@@ -10,6 +10,10 @@
kernel threads and the processes in its own session, so it won't kill
the shell that is running the script it was called from. Its primary
(only) use is in the \fBrc\fP scripts found in the /etc/init.d directory.
+.SH EXIT STATUS
+The program return zero if it killed processes. It return 2 if no
+process were killed, and 1 if it was unable to find any processes
+(/proc/ is missing).
.SH SEE ALSO
.BR halt (8),
.BR reboot (8)
Modified: sysvinit-upstream/trunk/src/killall5.c
===================================================================
--- sysvinit-upstream/trunk/src/killall5.c 2009-07-12 14:39:45 UTC (rev 1446)
+++ sysvinit-upstream/trunk/src/killall5.c 2009-07-12 14:41:52 UTC (rev 1447)
@@ -616,6 +616,9 @@
int pid, sid = -1;
int sig = SIGKILL;
+ /* return non-zero if no process was killed */
+ int retval = 2;
+
/* Get program name. */
if ((progname = strrchr(argv[0], '/')) == NULL)
progname = argv[0];
@@ -656,15 +659,17 @@
/* Read /proc filesystem */
if (readproc() < 0) {
kill(-1, SIGCONT);
- exit(1);
+ return(1);
}
/* Now kill all processes except init (pid 1) and our session. */
sid = (int)getsid(0);
pid = (int)getpid();
for (p = plist; p; p = p->next)
- if (p->pid != 1 && p->pid != pid && p->sid != sid && !p->kernel)
+ if (p->pid != 1 && p->pid != pid && p->sid != sid && !p->kernel) {
kill(p->pid, sig);
+ retval = 0;
+ }
/* And let them continue. */
kill(-1, SIGCONT);
@@ -675,5 +680,5 @@
/* Force the kernel to run the scheduler */
usleep(1);
- return 0;
+ return retval;
}
More information about the Pkg-sysvinit-commits
mailing list