[Pkg-sysvinit-commits] r1522 - in sysvinit/trunk/debian: . patches
Petter Reinholdtsen
pere at alioth.debian.org
Fri Jul 24 13:57:45 UTC 2009
Author: pere
Date: 2009-07-24 13:57:42 +0000 (Fri, 24 Jul 2009)
New Revision: 1522
Removed:
sysvinit/trunk/debian/patches/82_killall_exclude_pids.dpatch
Modified:
sysvinit/trunk/debian/changelog
sysvinit/trunk/debian/patches/00list
Log:
Drop patch 82_killall_exclude_pids now included upstream.
Modified: sysvinit/trunk/debian/changelog
===================================================================
--- sysvinit/trunk/debian/changelog 2009-07-24 13:54:56 UTC (rev 1521)
+++ sysvinit/trunk/debian/changelog 2009-07-24 13:57:42 UTC (rev 1522)
@@ -37,6 +37,7 @@
- Drop patch 71_wall_hostname now included upstream.
- Drop patch 80_killall_pidof now included upstream.
- Drop patch 80_killall_sched now included upstream.
+ - Drop patch 82_killall_exclude_pids now included upstream.
* XXX Need to remove debian patches now included in the new upstream release.
Modified: sysvinit/trunk/debian/patches/00list
===================================================================
--- sysvinit/trunk/debian/patches/00list 2009-07-24 13:54:56 UTC (rev 1521)
+++ sysvinit/trunk/debian/patches/00list 2009-07-24 13:57:42 UTC (rev 1522)
@@ -11,7 +11,6 @@
#68_init_quiet
##81_killall_avoid_init
##82_killall_retval
-##82_killall_exclude_pids
##83_killall_manref
##84_killall_fuse
##85_killall_safecwd
Deleted: sysvinit/trunk/debian/patches/82_killall_exclude_pids.dpatch
===================================================================
--- sysvinit/trunk/debian/patches/82_killall_exclude_pids.dpatch 2009-07-24 13:54:56 UTC (rev 1521)
+++ sysvinit/trunk/debian/patches/82_killall_exclude_pids.dpatch 2009-07-24 13:57:42 UTC (rev 1522)
@@ -1,114 +0,0 @@
-#! /bin/sh /usr/share/dpatch/dpatch-run
-## 82_killall_exclude_pids.dpatch by Colin Watson <cjwatson at ubuntu.com>
-## Modified for Debian by Petter Reinholdtsen <pere at hungry.com>
-##
-## All lines beginning with `## DP:' are a description of the patch.
-## DP: Implement '-o omitpid' option, to allow sendsigs to avoid killing
-## DP: processes that are e.g. implementing the root filesystem.
-
- at DPATCH@
-diff -urNad trunk~/man/killall5.8 trunk/man/killall5.8
---- trunk~/man/killall5.8 2008-03-26 09:31:24.000000000 +0100
-+++ trunk/man/killall5.8 2008-03-26 09:31:24.000000000 +0100
-@@ -4,12 +4,19 @@
- .SH SYNOPSIS
- .B killall5
- .RB -signalnumber
-+.RB [ \-o
-+.IR omitpid ]
-+.RB [ \-o
-+.IR omitpid.. ]
- .SH DESCRIPTION
- .B killall5
- is the SystemV killall command. It sends a signal to all processes except
- 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 OPTIONS
-+.IP "-o \fIomitpid\fP"
-+Tells \fIkillall5\fP to omit processes with that process id.
- .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
-diff -urNad trunk~/src/killall5.c trunk/src/killall5.c
---- trunk~/src/killall5.c 2008-03-26 09:31:24.000000000 +0100
-+++ trunk/src/killall5.c 2008-03-26 09:31:24.000000000 +0100
-@@ -583,11 +583,15 @@
-
-
-
-+#define KILLALL_OMITSZ 16
-+
- /* Main for either killall or pidof. */
- int main(int argc, char **argv)
- {
- PROC *p;
- int pid, sid = -1;
-+ pid_t opid[KILLALL_OMITSZ];
-+ int i, oind, omit = 0;
- int sig = SIGKILL;
-
- /* return non-zero if no process was killed */
-@@ -607,10 +611,34 @@
- return main_pidof(argc, argv);
-
- /* Right, so we are "killall". */
-+ for (oind = KILLALL_OMITSZ-1; oind > 0; oind--)
-+ opid[oind] = 0;
-+
- if (argc > 1) {
-- if (argc != 2) usage();
-- if (argv[1][0] == '-') (argv[1])++;
-- if ((sig = atoi(argv[1])) <= 0 || sig > 31) usage();
-+ for (i = 1; i < argc; i++) {
-+ if (argv[i][0] == '-') (argv[i])++;
-+ if (argv[i][0] == 'o') {
-+ if (++i >= argc) usage();
-+ if (oind >= KILLALL_OMITSZ -1) {
-+ nsyslog(LOG_ERR,"omit pid buffer size "
-+ "%d exceeded!\n",
-+ KILLALL_OMITSZ);
-+ closelog();
-+ exit(1);
-+ }
-+ if ((opid[oind] = atoi(argv[i])) < 1) {
-+ nsyslog(LOG_ERR,
-+ "illegal omit pid value "
-+ "(%s)!\n", argv[i]);
-+ closelog();
-+ exit(1);
-+ }
-+ oind++;
-+ omit = 1;
-+ }
-+ else if ((sig = atoi(argv[1])) <= 0 || sig > 31)
-+ usage();
-+ }
- }
-
- /* First get the /proc filesystem online. */
-@@ -639,11 +667,20 @@
- /* 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) {
-- kill(p->pid, sig);
-- retval = 0;
-+ for (p = plist; p; p = p->next) {
-+ if (p->pid == 1 || p->pid == pid || p->sid == sid || p->kernel)
-+ continue;
-+ if (omit) {
-+ for (i = 0; i < oind; i++)
-+ if (opid[i] == p->pid)
-+ break;
-+ /* On a match, continue with the for loop above. */
-+ if (i < oind)
-+ continue;
- }
-+ kill(p->pid, sig);
-+ retval = 0;
-+ }
-
- /* And let them continue. */
- kill(-1, SIGCONT);
More information about the Pkg-sysvinit-commits
mailing list