~ubuntu-branches/debian/experimental/sysvinit/experimental

« back to all changes in this revision

Viewing changes to debian/patches/82_killall_retval.dpatch

  • Committer: Bazaar Package Importer
  • Author(s): Petter Reinholdtsen
  • Date: 2008-08-12 16:07:50 UTC
  • Revision ID: james.westby@ubuntu.com-20080812160750-65gpyv74vh4qr69w
Tags: 2.86.ds1-61
* Fix typo in rcS(5), proberly->properly (Closes: #484233).  Thanks to
  Julien Danjou for noticing.
* Fix typo in rcS(5), maually->manually (Closes: #493680).  Thanks to
  Xr for noticing.
* Modify runlevel detection code in invoke-rc.d to notice the
  difference between runlevels 0 and 6, and the boot runlevel, to
  make it possible to use invoke-rc.d during boot (Closes: 384509).
* Make sure to call restorecon after mounting tmpfs file systems, to
  set SELinux permissions (Closes: #493679).  Patch from Russell
  Coker.
* Move responsibility of stopping the splash screen process from
  individual init.d scripts to init.d/rc.  This make sure the
  progress calculation reflect reality, and that the splash screen
  is taken down in runlevel 1 (Closes: #431560) and that it stop
  before gdm and kdm (Closes: #422922, #489734).
* Skip error message from checkfs.sh when / is read-only.  Patch
  from Mirek Slugen (Closes: #492214).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh /usr/share/dpatch/dpatch-run
 
2
## 82_killall_retval.dpatch by Petter Reinholdtsen
 
3
 
 
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.
 
7
 
 
8
@DPATCH@
 
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
 
12
@@ -10,6 +10,10 @@
 
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.
 
16
+.SH EXIT STATUS
 
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
 
19
+(/proc/ is missing).
 
20
 .SH SEE ALSO
 
21
 .BR halt (8),
 
22
 .BR reboot (8)
 
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
 
26
@@ -590,6 +590,9 @@
 
27
        int             pid, sid = -1;
 
28
        int             sig = SIGKILL;
 
29
 
 
30
+       /* return non-zero if no process was killed */
 
31
+       int             retval = 2;
 
32
+
 
33
        /* Get program name. */
 
34
        if ((progname = strrchr(argv[0], '/')) == NULL)
 
35
                progname = argv[0];
 
36
@@ -630,15 +633,17 @@
 
37
        /* Read /proc filesystem */
 
38
        if (readproc() < 0) {
 
39
                kill(-1, SIGCONT);
 
40
-               exit(1);
 
41
+               return(1);
 
42
        }
 
43
 
 
44
        /* Now kill all processes except init (pid 1) and our session. */
 
45
        sid = (int)getsid(0);
 
46
        pid = (int)getpid();
 
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) {
 
50
                        kill(p->pid, sig);
 
51
+                       retval = 0;
 
52
+               }
 
53
 
 
54
        /* And let them continue. */
 
55
        kill(-1, SIGCONT);
 
56
@@ -649,5 +654,5 @@
 
57
        /* Force the kernel to run the scheduler */
 
58
        usleep(1);
 
59
 
 
60
-       return 0;
 
61
+       return retval;
 
62
 }