~ubuntu-branches/ubuntu/karmic/sysvinit/karmic-updates

« back to all changes in this revision

Viewing changes to debian/patches/80_killall_pidof.dpatch

  • Committer: Bazaar Package Importer
  • Author(s): Scott James Remnant
  • Date: 2009-09-07 19:56:53 UTC
  • mfrom: (1.1.4 upstream) (2.1.7 sid)
  • Revision ID: james.westby@ubuntu.com-20090907195653-2i6t0j91wfbf1f0d
Tags: 2.87dsf-4ubuntu1
* Merge from debian unstable, remaining changes:
  - Support Cell processor:
    + debian/initscripts/postinst: Create spu system group and /spu mount
      point if we are running on a Cell processor.
    + debian/initscripts/etc/init.d/mountkernfs.sh: Mount spufs if Cell
      processor is detected.
    + debian/initscripts/lib/init/mount-functions.sh: Modprobe spufs
      if not available.
    + debian/control: Add initscripts dependency 'passwd' for groupadd.
    (Forwarded to Debian #483399)
  - Use tmpfs mounts for /var/lock and /var/run:
    + debian/initscripts/share/default.rcS: Enable RAMRUN and RAMLOCK by
      default.
    + debian/initscripts.postinst: Enable RAMRUN and RAMLOCK in
      /etc/default/rcS on upgrades. This needs to be kept until the next
      LTS.
    + debian/initscripts/etc/init.d/mountkernfs.sh: Propagate files from the
      initramfs to our new /var/run, so that we can populate
      /var/run/sendsigs.omit from initramfs.
  - Boot ordering differences:
    + mountkernfs.sh: 02 -> 01
    + mountdevsubfs.sh: 04 -> 11
    + bootlogd: disabled by default
    + checkroot.sh: 10 -> 20
    + mtab.sh: 12 -> 22
  - debian/patches/91_sulogin_lockedpw.dpatch: Disable "root account is
    locked" warning, since this is the default in Ubuntu. Document this in
    sulogin.8.
  - debian/control: Drop Essential: yes from packages since we use Upstart.
  - debian/control: Conflict/Replace sysvconfig which has also previously
    provided service(8).
  - debian/control, debian/rules: Previous name for sysvinit-utils was
    'sysvutils' in Ubuntu, so Conflict/Replace/Provide it. Also create a
    dummy sysvutils package, since Hardy has reverse versioned dependencies
    to it. This needs to be kept until after the next LTS.
  - debian/control: Depend on lsb-base (>= 3.2-14) for status_of_proc()
    function.
  - debian/initscripts/etc/init.d/checkfs.sh: Don't depend on hwclockfirst
    which Ubuntu does not have.
  - debian/initscripts/etc/init.d/mountkernfs.sh: Always mount devpts, and
    do not touch /dev/ptmx (which is already managed by udev).
  - debian/initscripts/etc/init.d/mountkernfs.sh: mount fusectl if it is
    available
  - debian/initscripts/etc/init.d/mountkernfs.sh: mount securityfs if it is
    available. This allows for easier AppArmor confinement of applications
    early in the boot process. LP: #399954
  - debian/initscripts/etc/init.d/mountkernfs.sh: mount debugfs if it is
    available.
  - debian/initscripts/etc/init.d/ondemand: Sleep for 60 seconds, then
    set CPU Frequency Scaling governor to "ondemand".   LP: #341573.
  - debian/initscripts/etc/init.d/umountfs: Don't unmount filesystems
    that precede root or use force for some mountpoints.
  - debian/initscripts/etc/network/if-up.d/mountnfs: Rename ifstate
    file to /var/run/network/ifstate
  - ./debian/initscripts/lib/init/usplash-fsck-functions.sh: Use blkid,
    vol_id is gone.
  - debian/initscripts.{pre,postinst}: waitnfs.sh -> mountnfs.sh renaming
    transition. This needs to be kept until after the next LTS.

LP: #32455, #94120, #160197, #382097 (amongst others).

* debian/sysv-rc/sbin/update-rc.d: Dropped support for "multiuser"
  command-line option.
* debian/rules: Compat symlink from /usr/bin/service to /usr/sbin/service
* debian/initscripts.postinst: Transition from bootlogs.sh to bootlogs

* debian/sysv-rc.postinst: Don't try and use insserv by default, though
  everything's in place for you to try if you like.  It can be activated
  with:
      USEINSSERV=yes dpkg-reconfigure sysv-rc

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#! /bin/sh /usr/share/dpatch/dpatch-run
2
 
## 20_pidof.dpatch by Petter Reinholdtsen
3
 
##
4
 
## All lines beginning with `## DP:' are a description of the patch.
5
 
## DP: Modify pidof to not print empty line if no pid was found. (bug: #225476)
6
 
 
7
 
@DPATCH@
8
 
diff -urNad trunk~/src/killall5.c trunk/src/killall5.c
9
 
--- trunk~/src/killall5.c       2008-03-26 09:30:38.000000000 +0100
10
 
+++ trunk/src/killall5.c        2008-03-26 09:31:14.000000000 +0100
11
 
@@ -378,8 +378,8 @@
12
 
        int             foundone = 0;
13
 
        int             ok = 0;
14
 
 
15
 
-       /* Try to stat the executable. */
16
 
-       if (prog[0] == '/' && stat(prog, &st) == 0) dostat++;
17
 
+       if (! prog)
18
 
+               return NULL;
19
 
 
20
 
        /* Get basename of program. */
21
 
        if ((s = strrchr(prog, '/')) == NULL)
22
 
@@ -387,9 +387,16 @@
23
 
        else
24
 
                s++;
25
 
 
26
 
+       if (! *s)
27
 
+               return NULL;
28
 
+
29
 
        q = (PIDQ_HEAD *)xmalloc(sizeof(PIDQ_HEAD));
30
 
        q = init_pid_q(q);
31
 
 
32
 
+       /* Try to stat the executable. */
33
 
+       if (prog[0] == '/' && stat(prog, &st) == 0)
34
 
+               dostat++;
35
 
+
36
 
        /* First try to find a match based on dev/ino pair. */
37
 
        if (dostat) {
38
 
                for (p = plist; p; p = p->next) {
39
 
@@ -404,15 +411,35 @@
40
 
        if (!foundone) for (p = plist; p; p = p->next) {
41
 
                ok = 0;
42
 
 
43
 
-               /* Compare name (both basename and full path) */
44
 
-               ok += (p->argv0 && strcmp(p->argv0, prog) == 0);
45
 
-               ok += (p->argv0 && strcmp(p->argv0base, s) == 0);
46
 
+               /*             matching        nonmatching
47
 
+                * proc name   prog name       prog name
48
 
+                * ---         -----------     ------------
49
 
+                *   b         b, p/b, q/b
50
 
+                * p/b         b, p/b          q/b
51
 
+                *
52
 
+                * Algorithm: Match if:
53
 
+                *    cmd = arg
54
 
+                * or cmd = base(arg)
55
 
+                * or base(cmd) = arg
56
 
+                *
57
 
+                * Specifically, do not match just because base(cmd) = base(arg)
58
 
+                * as was done in earlier versions of this program, since this
59
 
+                * allows /aaa/foo to match /bbb/foo .
60
 
+                */
61
 
+               ok |=
62
 
+                       (p->argv0 && strcmp(p->argv0, prog) == 0)
63
 
+                       || (p->argv0 && s != prog && strcmp(p->argv0, s) == 0)
64
 
+                       || (p->argv0base && strcmp(p->argv0base, prog) == 0);
65
 
 
66
 
                /* For scripts, compare argv[1] as well. */
67
 
-               if (scripts_too && p->argv1 &&
68
 
-                   !strncmp(p->statname, p->argv1base, STATNAMELEN)) {
69
 
-                       ok += (strcmp(p->argv1, prog) == 0);
70
 
-                       ok += (strcmp(p->argv1base, s) == 0);
71
 
+               if (
72
 
+                       scripts_too && p->statname && p->argv1base
73
 
+                       && !strncmp(p->statname, p->argv1base, STATNAMELEN)
74
 
+               ) {
75
 
+                       ok |=
76
 
+                               (p->argv1 && strcmp(p->argv1, prog) == 0)
77
 
+                               || (p->argv1 && s != prog && strcmp(p->argv1, s) == 0)
78
 
+                               || (p->argv1base && strcmp(p->argv1base, prog) == 0);
79
 
                }
80
 
 
81
 
                /*
82
 
@@ -423,7 +450,7 @@
83
 
                    (p->argv0 == NULL ||
84
 
                     p->argv0[0] == 0 ||
85
 
                     strchr(p->argv0, ' '))) {
86
 
-                       ok += (strcmp(p->statname, s) == 0);
87
 
+                       ok |= (strcmp(p->statname, s) == 0);
88
 
                }
89
 
                if (ok) add_pid_to_q(q, p);
90
 
        }
91
 
@@ -548,7 +575,8 @@
92
 
                        }
93
 
                }
94
 
        }
95
 
-       printf("\n");
96
 
+       if (!first)
97
 
+               printf("\n");
98
 
        closelog();
99
 
        return(first ? 1 : 0);
100
 
 }