Hello community,
here is the log from the commit of package sysvinit for openSUSE:Factory
checked in at Wed Apr 1 18:20:30 CEST 2009.
--------
--- sysvinit/sysvinit.changes 2009-03-25 21:33:18.000000000 +0100
+++ sysvinit/sysvinit.changes 2009-03-27 13:15:05.396001883 +0100
@@ -1,0 +2,12 @@
+Fri Mar 27 13:08:59 CET 2009 - werner@suse.de
+
+- Update to killproc 2.15
+ * New option -w for making startproc waiting on daemons parent
+ process (bnc#489473, bnc#482096 comment#21 ff)
+ * New option -W for making startproc waiting on files created
+ by the daemon (bnc#482096 comment#24 ff)
+- Merge changes for preload code of startpar into one patch
+- nfs4pidof: avoid nfs code for process which are on shadow mounts
+ points of NFS mounts
+
+-------------------------------------------------------------------
@@ -49 +61 @@
-- Updte to killproc 2.14 to include most of our patches and to
+- Update to killproc 2.14 to include most of our patches and to
calling whatdependson for head-i586
Old:
----
killproc-2.14.dif
killproc-2.14.tar.bz2
New:
----
killproc-2.15.dif
killproc-2.15.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ sysvinit.spec ++++++
--- /var/tmp/diff_new_pack.Ik3301/_old 2009-04-01 18:18:33.000000000 +0200
+++ /var/tmp/diff_new_pack.Ik3301/_new 2009-04-01 18:18:33.000000000 +0200
@@ -21,7 +21,7 @@
Name: sysvinit
%define MGVER 0.9.6s
%define PDVER 2.0.2
-%define KPVER 2.14
+%define KPVER 2.15
%define SCVER 1.09
%define SIVER 2.86
%define START 0.53
@@ -30,12 +30,12 @@
PreReq: coreutils
AutoReqProv: on
Version: 2.86
-Release: 202
+Release: 203
Summary: SysV-Style init
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: libselinux-devel libsepol-devel
Source: sysvinit-2.86.tar.bz2
-Source2: killproc-2.14.tar.bz2
+Source2: killproc-2.15.tar.bz2
Source3: powerd-2.0.2.tar.bz2
Source4: showconsole-1.09.tar.bz2
Source5: startpar-0.53.tar.bz2
@@ -47,7 +47,7 @@
Patch: sysvinit-2.86.dif
Patch1: sysvinit-2.86-nfs4pidof.patch
Patch2: powerd-2.0.2.dif
-Patch3: killproc-2.14.dif
+Patch3: killproc-2.15.dif
Patch5: sysvinit-2.86-sulogin.patch
Patch6: sysvinit-2.82-startstop.patch
Patch7: sysvinit-2.85-suse.patch
@@ -327,6 +327,15 @@
%doc %{_mandir}/man8/mkill.8.gz
%changelog
+* Fri Mar 27 2009 werner@suse.de
+- Update to killproc 2.15
+ * New option -w for making startproc waiting on daemons parent
+ process (bnc#489473, bnc#482096 comment#21 ff)
+ * New option -W for making startproc waiting on files created
+ by the daemon (bnc#482096 comment#24 ff)
+- Merge changes for preload code of startpar into one patch
+- nfs4pidof: avoid nfs code for process which are on shadow mounts
+ points of NFS mounts
* Wed Mar 25 2009 coolo@suse.de
- exec one more time so that the preload part does not appear
under the name of the init script in bootcharts
@@ -349,7 +358,7 @@
* Mon Mar 09 2009 werner@suse.de
- Add patch from Debian people to startpar and mode to version 0.53
* Thu Mar 05 2009 werner@suse.de
-- Updte to killproc 2.14 to include most of our patches and to
+- Update to killproc 2.14 to include most of our patches and to
use openat(2), readlinkat(2), and opendirat(2) system calls.
- Remove /dev/initctl from file list, do not create blogd pipe
/dev/blogd (bnc#475580)
++++++ killproc-2.14.dif -> killproc-2.15.dif ++++++
--- sysvinit/killproc-2.14.dif 2009-03-13 17:57:55.000000000 +0100
+++ sysvinit/killproc-2.15.dif 2009-03-26 18:47:27.504002962 +0100
@@ -1,186 +1,4 @@
---- libinit.h
-+++ libinit.h 2009-03-10 13:06:32.512001779 +0100
-@@ -46,7 +46,7 @@
- # define restrict __restrict__
- # endif
- #endif
--#define alignof(type) (sizeof(type)+(sizeof(type)%sizeof(void*)))
-+#define alignof(type) ((sizeof(type)+(sizeof(void*)-1)) & ~(sizeof(void*)-1))
-
- /*
- * LSB specs:
---- mkill.c
-+++ mkill.c 2009-03-13 18:01:55.276001810 +0100
-@@ -60,10 +60,19 @@ extern inline DIR * opendirat(int dirfd,
- " %s [-SIG] [-u] /mnt1 [/mnt2...]\n"\
- " %s -l\n", we_are, we_are
-
-+typedef struct _s_shadow
-+{
-+ struct _s_shadow *next;
-+ struct _s_shadow *prev;
-+ size_t nlen;
-+ char * name;
-+} shadow_t;
-+
- typedef struct _s_mnt
- {
- struct _s_mnt *next; /* Pointer to next struct. */
- struct _s_mnt *prev; /* Pointer to previous st. */
-+ shadow_t *shadow; /* Pointer to shadows */
- size_t nlen;
- char * name;
- int order; /* Order of the mount point*/
-@@ -327,12 +336,8 @@ int main(int argc, char* argv[])
- sort_proc();
-
- num = 0;
-- this = procs;
-- last = (proc_t*)0;
- found = false;
-- for (ptr = procs; this; ptr = this) {
-- last = ptr->prev;
-- this = ptr->next;
-+ for (ptr = procs; ptr; ptr = ptr->next) {
- if (nsig) {
- if (stop)
- kill(ptr->pid, SIGSTOP);
-@@ -391,11 +396,7 @@ int main(int argc, char* argv[])
- if (!found)
- goto out;
-
-- this = procs;
-- last = (proc_t*)0;
-- for (ptr = procs; this; ptr = this) {
-- last = ptr->prev;
-- this = ptr->next;
-+ for (ptr = procs; ptr; ptr = ptr->next) {
- kill(ptr->pid, SIGSTOP);
- kill(ptr->pid, SIGKILL);
- }
-@@ -440,9 +441,10 @@ static void init_mnt(int argc, char* arg
- error(100, "malloc(): %s\n", strerror(errno));
- ptr->order = order++;
- ptr->name = ((char*)ptr)+alignof(mntent_t);
-+ ptr->shadow = (shadow_t*)0;
-
- strcpy(ptr->name, ent->mnt_dir);
-- ptr->nlen = strlen(ptr->name);
-+ ptr->nlen = nlen;
- if (mntent)
- mntent->prev = ptr;
- ptr->next = mntent;
-@@ -451,6 +453,57 @@ static void init_mnt(int argc, char* arg
- }
- endmntent(mnt);
- maxorder = order;
-+
-+ if ((mnt = setmntent("/proc/mounts", "r")) == (FILE*)0)
-+ error(100, "cannot open /proc/mounts: %s\n", strerror(errno));
-+
-+ while ((ent = getmntent(mnt))) {
-+ mntent_t *p;
-+
-+ for (p = mntent; p; p = p->next) {
-+ shadow_t *restrict s;
-+ size_t nlen;
-+
-+ if (strcmp(ent->mnt_dir, p->name) == 0)
-+ continue;
-+ if (strncmp(ent->mnt_dir, p->name, p->nlen) != 0)
-+ continue;
-+
-+ nlen = strlen(ent->mnt_dir);
-+ if (posix_memalign((void*)&s, sizeof(void*), alignof(shadow_t)+(nlen+1)) != 0)
-+ error(100, "malloc(): %s\n", strerror(errno));
-+ s->name = ((char*)s)+alignof(shadow_t);
-+
-+ strcpy(s->name, ent->mnt_dir);
-+ s->nlen = nlen;
-+ if (p->shadow)
-+ p->shadow->prev = s;
-+ s->next = p->shadow;
-+ s->prev = (shadow_t*)0;
-+ p->shadow = s;
-+ }
-+ }
-+ endmntent(mnt);
-+}
-+
-+static void clear_shadow(shadow_t *restrict shadow)
-+{
-+ shadow_t *s, *n, *l;
-+
-+ n = shadow;
-+ l = (shadow_t*)0;
-+ for (s = shadow; n; s = n) {
-+ l = s->prev;
-+ n = s->next;
-+ if (s == shadow) {
-+ if (n) n->prev = (shadow_t*)0;
-+ shadow = n;
-+ } else if (l) {
-+ if (n) n->prev = l;
-+ l->next = n;
-+ }
-+ free(s);
-+ }
- }
-
- static void clear_mnt(const boolean lazy)
-@@ -471,6 +524,8 @@ static void clear_mnt(const boolean lazy
- if (n) n->prev = l;
- l->next = n;
- }
-+ if (p->shadow)
-+ clear_shadow(p->shadow);
- free(p);
- }
- }
-@@ -523,17 +578,39 @@ static void sort_proc(void)
- procs = sort;
- }
-
-+static boolean shadow(shadow_t *restrict this, const char *restrict name, const size_t nlen)
-+{
-+ shadow_t *s;
-+
-+ if (!this)
-+ goto out;
-+ for (s = this; s; s = s->next) {
-+ if (nlen < s->nlen)
-+ continue;
-+ if (name[s->nlen] != '\0' && name[s->nlen] != '/')
-+ continue;
-+ if (strncmp(name, s->name, s->nlen) == 0)
-+ return true;
-+ }
-+out:
-+ return false;
-+}
-+
- static int check(const char *restrict name)
- {
-- mntent_t *p, *n, *l;
-+ const size_t nlen = strlen(name);
-+ mntent_t *p;
-
-- n = mntent;
-- l = (mntent_t*)0;
-- for (p = mntent; n; p = n) {
-- l = p->prev;
-- n = p->next;
-- if (strncmp(name, p->name, p->nlen) == 0)
-+ for (p = mntent; p; p = p->next) {
-+ if (nlen < p->nlen)
-+ continue;
-+ if (name[p->nlen] != '\0' && name[p->nlen] != '/')
-+ continue;
-+ if (strncmp(name, p->name, p->nlen) == 0) {
-+ if (shadow(p->shadow, name, nlen))
-+ continue;
- return p->order;
-+ }
- }
- return 0;
- }
+--- .empty
++++ .empty 2009-03-26 18:47:25.048001558 +0100
+@@ -0,0 +1 @@
++remove if patch applied
++++++ killproc-2.14.tar.bz2 -> killproc-2.15.tar.bz2 ++++++
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/killproc-2.14/killproc-2.14.lsm new/killproc-2.15/killproc-2.14.lsm
--- old/killproc-2.14/killproc-2.14.lsm 2009-03-06 11:26:43.000000000 +0100
+++ new/killproc-2.15/killproc-2.14.lsm 1970-01-01 01:00:00.000000000 +0100
@@ -1,18 +0,0 @@
-Begin3
-Title: killproc and assorted tools for boot scripts
-Version: 2.14
-Entered-date: 06MAR09
-Description: Some useful programs for a replacment of the shell functions
- daemom and killproc found in the Linux System V init suite.
- killproc(8) for signaling or terminating, checkproc(8) for
- checking and startproc(8) for starting processes.
- Each program has its own manual page.
-Keywords: killproc, startproc, checkproc, process control
-Author: Werner Fink
-Maintained-by: Werner Fink
-Primary-site: sunsite.unc.edu /pub/Linux/system/daemons/init
- @UNKNOWN killproc-2.14.tar.gz
-Alternate-site: ftp.suse.com /pub/projects/init
-Platforms: Linux with System VR2 or higher boot scheme
-Copying-policy: GPL
-End
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/killproc-2.14/killproc-2.15.lsm new/killproc-2.15/killproc-2.15.lsm
--- old/killproc-2.14/killproc-2.15.lsm 1970-01-01 01:00:00.000000000 +0100
+++ new/killproc-2.15/killproc-2.15.lsm 2009-03-26 18:41:22.000000000 +0100
@@ -0,0 +1,18 @@
+Begin3
+Title: killproc and assorted tools for boot scripts
+Version: 2.15
+Entered-date: 26MAR09
+Description: Some useful programs for a replacment of the shell functions
+ daemom and killproc found in the Linux System V init suite.
+ killproc(8) for signaling or terminating, checkproc(8) for
+ checking and startproc(8) for starting processes.
+ Each program has its own manual page.
+Keywords: killproc, startproc, checkproc, process control
+Author: Werner Fink
+Maintained-by: Werner Fink
+Primary-site: sunsite.unc.edu /pub/Linux/system/daemons/init
+ @UNKNOWN killproc-2.15.tar.gz
+Alternate-site: ftp.suse.com /pub/projects/init
+Platforms: Linux with System VR2 or higher boot scheme
+Copying-policy: GPL
+End
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/killproc-2.14/libinit.h new/killproc-2.15/libinit.h
--- old/killproc-2.14/libinit.h 2009-03-06 11:26:43.000000000 +0100
+++ new/killproc-2.15/libinit.h 2009-03-26 18:41:22.000000000 +0100
@@ -19,6 +19,9 @@
* 2000/11/10 Werner Fink: LSB specs, logging
*/
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE
+#endif
#include
#include
#include
@@ -29,6 +32,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -46,7 +50,7 @@
# define restrict __restrict__
# endif
#endif
-#define alignof(type) (sizeof(type)+(sizeof(type)%sizeof(void*)))
+#define alignof(type) ((sizeof(type)+(sizeof(void*)-1)) & ~(sizeof(void*)-1))
/*
* LSB specs:
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/killproc-2.14/Makefile new/killproc-2.15/Makefile
--- old/killproc-2.14/Makefile 2009-03-06 11:26:43.000000000 +0100
+++ new/killproc-2.15/Makefile 2009-03-26 18:41:22.000000000 +0100
@@ -12,7 +12,7 @@
PREFIX = /usr
DEBUG =
DESTDIR =
-VERSION = 2.14
+VERSION = 2.15
DATE = $(shell date +'%d%b%y' | tr '[:lower:]' '[:upper:]')
ifneq ($(INC),)
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/killproc-2.14/mkill.c new/killproc-2.15/mkill.c
--- old/killproc-2.14/mkill.c 2009-03-06 11:26:43.000000000 +0100
+++ new/killproc-2.15/mkill.c 2009-03-26 18:41:22.000000000 +0100
@@ -60,10 +60,19 @@
" %s [-SIG] [-u] /mnt1 [/mnt2...]\n"\
" %s -l\n", we_are, we_are
+typedef struct _s_shadow
+{
+ struct _s_shadow *next;
+ struct _s_shadow *prev;
+ size_t nlen;
+ char * name;
+} shadow_t;
+
typedef struct _s_mnt
{
struct _s_mnt *next; /* Pointer to next struct. */
struct _s_mnt *prev; /* Pointer to previous st. */
+ shadow_t *shadow; /* Pointer to shadows */
size_t nlen;
char * name;
int order; /* Order of the mount point*/
@@ -327,12 +336,8 @@
sort_proc();
num = 0;
- this = procs;
- last = (proc_t*)0;
found = false;
- for (ptr = procs; this; ptr = this) {
- last = ptr->prev;
- this = ptr->next;
+ for (ptr = procs; ptr; ptr = ptr->next) {
if (nsig) {
if (stop)
kill(ptr->pid, SIGSTOP);
@@ -391,11 +396,7 @@
if (!found)
goto out;
- this = procs;
- last = (proc_t*)0;
- for (ptr = procs; this; ptr = this) {
- last = ptr->prev;
- this = ptr->next;
+ for (ptr = procs; ptr; ptr = ptr->next) {
kill(ptr->pid, SIGSTOP);
kill(ptr->pid, SIGKILL);
}
@@ -440,9 +441,10 @@
error(100, "malloc(): %s\n", strerror(errno));
ptr->order = order++;
ptr->name = ((char*)ptr)+alignof(mntent_t);
+ ptr->shadow = (shadow_t*)0;
strcpy(ptr->name, ent->mnt_dir);
- ptr->nlen = strlen(ptr->name);
+ ptr->nlen = nlen;
if (mntent)
mntent->prev = ptr;
ptr->next = mntent;
@@ -451,6 +453,57 @@
}
endmntent(mnt);
maxorder = order;
+
+ if ((mnt = setmntent("/proc/mounts", "r")) == (FILE*)0)
+ error(100, "cannot open /proc/mounts: %s\n", strerror(errno));
+
+ while ((ent = getmntent(mnt))) {
+ mntent_t *p;
+
+ for (p = mntent; p; p = p->next) {
+ shadow_t *restrict s;
+ size_t nlen;
+
+ if (strcmp(ent->mnt_dir, p->name) == 0)
+ continue;
+ if (strncmp(ent->mnt_dir, p->name, p->nlen) != 0)
+ continue;
+
+ nlen = strlen(ent->mnt_dir);
+ if (posix_memalign((void*)&s, sizeof(void*), alignof(shadow_t)+(nlen+1)) != 0)
+ error(100, "malloc(): %s\n", strerror(errno));
+ s->name = ((char*)s)+alignof(shadow_t);
+
+ strcpy(s->name, ent->mnt_dir);
+ s->nlen = nlen;
+ if (p->shadow)
+ p->shadow->prev = s;
+ s->next = p->shadow;
+ s->prev = (shadow_t*)0;
+ p->shadow = s;
+ }
+ }
+ endmntent(mnt);
+}
+
+static void clear_shadow(shadow_t *restrict shadow)
+{
+ shadow_t *s, *n, *l;
+
+ n = shadow;
+ l = (shadow_t*)0;
+ for (s = shadow; n; s = n) {
+ l = s->prev;
+ n = s->next;
+ if (s == shadow) {
+ if (n) n->prev = (shadow_t*)0;
+ shadow = n;
+ } else if (l) {
+ if (n) n->prev = l;
+ l->next = n;
+ }
+ free(s);
+ }
}
static void clear_mnt(const boolean lazy)
@@ -471,6 +524,8 @@
if (n) n->prev = l;
l->next = n;
}
+ if (p->shadow)
+ clear_shadow(p->shadow);
free(p);
}
}
@@ -523,17 +578,39 @@
procs = sort;
}
+static boolean shadow(shadow_t *restrict this, const char *restrict name, const size_t nlen)
+{
+ shadow_t *s;
+
+ if (!this)
+ goto out;
+ for (s = this; s; s = s->next) {
+ if (nlen < s->nlen)
+ continue;
+ if (name[s->nlen] != '\0' && name[s->nlen] != '/')
+ continue;
+ if (strncmp(name, s->name, s->nlen) == 0)
+ return true;
+ }
+out:
+ return false;
+}
+
static int check(const char *restrict name)
{
- mntent_t *p, *n, *l;
+ const size_t nlen = strlen(name);
+ mntent_t *p;
- n = mntent;
- l = (mntent_t*)0;
- for (p = mntent; n; p = n) {
- l = p->prev;
- n = p->next;
- if (strncmp(name, p->name, p->nlen) == 0)
+ for (p = mntent; p; p = p->next) {
+ if (nlen < p->nlen)
+ continue;
+ if (name[p->nlen] != '\0' && name[p->nlen] != '/')
+ continue;
+ if (strncmp(name, p->name, p->nlen) == 0) {
+ if (shadow(p->shadow, name, nlen))
+ continue;
return p->order;
+ }
}
return 0;
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/killproc-2.14/startproc.8 new/killproc-2.15/startproc.8
--- old/killproc-2.14/startproc.8 2009-03-06 11:26:43.000000000 +0100
+++ new/killproc-2.15/startproc.8 2009-03-26 18:41:22.000000000 +0100
@@ -26,6 +26,7 @@
.RB [ \-p\ \fIpid_file\fP ]
.RB [ \-i\ \fIignore_file\fP ]
.RB [ \-c\ \fIroot\fP ]
+.RB [ \- ( w | W\ \fI\fP \fR)]
.IR /path/to/executable " [" "arguments for executable" ]
.\"
.HP
@@ -73,9 +74,9 @@
to identify the running program.
.PP
Extended functionality is provided by the
-.B -p
+.B \-p
option (former option
-.B -f
+.B \-f
changed due to the LSB specification).
If this option is specified,
.B startproc
@@ -105,6 +106,8 @@
.B start_daemon
does not support the options
.BR \- ( t | T )\ \fI<sec>\fP
+nor
+.BR \- ( w | W\ \fI\fP )
for waiting for success and
the option
.B \-s
@@ -124,7 +127,7 @@
Set the nice level for the process. If used, this option should
always be the first in the command line. The nice level
.I <prio>
-may be specified in the range between -20 and +20.
+may be specified in the range between \-20 and +20.
Only root is allowed to set negative nice values.
.TP
.B \-e
@@ -139,14 +142,20 @@
.RB (/var/run/ <basename> .pid).
The pid read from this file is being matched against the pid
of running processes that have an executable with specified path.
-of the program. In order to avoid confusion with stale pid files, a
+In order to avoid confusion with stale pid files, a
not up-to-date pid will be ignored.
+Obviously this option does not work if option
+.B \-f
+is specified.
.TP
.BI \-i " ignore_file"
The pid found in this file is used as
.B session
id of the same binary program which should be ignored by
.BR startproc .
+Obviously this option does not work if option
+.B \-f
+is specified.
.TP
.B \-f
This option is required by the Linux Standard Base Specification (LSB).
@@ -212,6 +221,22 @@
but wait only on the started process not on childs forked by
the process.
.TP
+.B \-w
+Wait the first started process to terminate before returning.
+If the parent process of the daemon does not finish also
+.BR startproc (8)
+does
+.B not
+finish.
+.TP
+.BI \-W " <file list>"
+Wait on the provided file or list of files separated with colons.
+If the files will not be created
+.BR startproc (8)
+does
+.B not
+finish.
+.TP
.BI \-u " user"
Sets the user ID of the process to
.IR user .
@@ -236,7 +261,7 @@
.I /usr/sbin/sendmail
is launched.
.TP
-.B startproc -p /var/myrun/lpd.pid /usr/sbin/lpd
+.B startproc \-p /var/myrun/lpd.pid /usr/sbin/lpd
.IP
starts
.I /usr/sbin/lpd
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/killproc-2.14/startproc.c new/killproc-2.15/startproc.c
--- old/killproc-2.14/startproc.c 2009-03-06 11:26:43.000000000 +0100
+++ new/killproc-2.15/startproc.c 2009-03-26 18:41:22.000000000 +0100
@@ -24,13 +24,14 @@
#include "libinit.h"
#include
#include
+#include
#include
#include
#include
#define USAGE "Usage:\n"\
" %s [-f] [-L] [[-n ]+/-<prio>] [-s] [-t sec|-T sec] [-u uid] [-g gid] [-v] [-e] \\\n"\
- " [-l log|-q|-d] [-p pid_file] [-i ignore_file] [-c root] /path/to/executable [args]\n"
+ " [-l log|-q|-d] [-p pid_file] [-i ignore_file] [-c root] [-w|-W list] /path/to/executable [args]\n"
#define USAGE_SD "Usage:\n"\
" %s [-f] [-L] [-n +/-<prio>] [-u uid] [-g gid] [-v] [-e] \\\n"\
" [-l log|-q|-d] [-p pid_file] [-i ignore_file] [-c root] /path/to/executable [args]\n"
@@ -38,12 +39,15 @@
static int do_start(const char *name, char *argv[], const char* log_file,
const int nicelvl, const int env, const char* root, unsigned short flags);
static void closefds(FILE *not);
+static void waiton(const char *list);
static int quiet = 1, supprmsg = 0, sess = 0, seconds = 0, sigchld = 0, force = 0, dialog = 0;
static struct passwd *user = NULL;
-struct group *grp = NULL;
+static struct group *grp = NULL;
static int syslogd = 0;
static int sdaemon = 0;
+static int wpopts = WNOHANG|WUNTRACED;
+static char *wlist = NULL;
static volatile sig_atomic_t signaled = 0;
static void (*save_sigquit) = SIG_DFL;
@@ -97,7 +101,7 @@
}
opterr = 0;
- while ((c = getopt(argc, argv, "+c:edp:l:hqvsu:g:t:n:fLi:T:")) != -1) { /* `+' is POSIX correct */
+ while ((c = getopt(argc, argv, "+c:edp:l:hqvsu:g:t:n:fLi:T:wW:")) != -1) { /* `+' is POSIX correct */
switch (c) {
case 'v':
quiet = 0;
@@ -116,6 +120,8 @@
seconds = 15;
break;
case 'p': /* Former option -f */
+ if (force)
+ warn("option -p does not work in force mode\n");
/* Allocate here: address optarg (current *argv) isn't freeable */
if (optarg && optarg[0] != '-' && !pid_file) {
pid_file = xstrdup(optarg);
@@ -219,12 +225,25 @@
error(LSB_WRGSYN,"Option -t requires number of seconds\n");
break;
case 'i':
+ if (force)
+ warn("option -i does not work in force mode\n");
/* Remember: address optarg (current *argv) */
if (optarg && optarg[0] != '-') {
iargv[iargc++] = optarg;
} else
error(LSB_WRGSYN,"Option -i requires pid file to read pid from\n");
break;
+ case 'w':
+ if (sdaemon) goto fail;
+ wpopts = WUNTRACED;
+ break;
+ case 'W':
+ if (sdaemon) goto fail;
+ if (optarg && optarg[0] != '-') {
+ wlist = optarg;
+ } else
+ error(LSB_WRGSYN,"Option -W requires a file name or list of files separated by colons\n");
+ break;
case '?':
fail:
error(LSB_WRGSYN, (sdaemon ? USAGE_SD : USAGE), we_are);
@@ -597,7 +616,7 @@
n = 0;
retry:
errno = 0;
- switch (waitpid(pid, &status, WNOHANG|WUNTRACED)) {
+ switch (waitpid(pid, &status, wpopts)) {
case -1: /* WNOHANG and hopefully no child but daemon */
if (errno == EINTR)
goto retry;
@@ -629,6 +648,8 @@
}
break;
}
+ if ((wpopts & WNOHANG) && wlist)
+ waiton(wlist);
break;
}
return 0;
@@ -639,10 +660,12 @@
*/
static void closefds(FILE *not)
{
+ const int fdnot = not ? fileno(not) : -1;
+ const int fderr = fileno(stderr);
char dir[128];
struct dirent *fdd;
- int fd, ret;
DIR *fds;
+ int ret;
if (((ret = snprintf(dir, sizeof(dir), "/proc/%ld/fd", (long)getpid())) < 0) ||
(ret == sizeof(dir)))
@@ -651,9 +674,12 @@
error(100, "cannot open dir: %s\n", strerror(errno));
while ((fdd = readdir(fds))) {
- if ((fd = atoi(fdd->d_name)) <= fileno(stderr))
+ int fd;
+ if (*fdd->d_name == '.')
continue;
- if (not && (fd == fileno(not)))
+ if ((fd = atoi(fdd->d_name)) <= fderr)
+ continue;
+ if (fd == fdnot)
continue;
if (isatty(fd)) {
close(fd);
@@ -667,3 +693,108 @@
closedir(fds);
}
+typedef struct _wait_
+{
+ struct _wait_ * prev;
+ struct _wait_ * next;
+ char *restrict name;
+ int wd;
+} wait_t;
+
+static void waiton(const char *list)
+{
+ int fd = inotify_init1(IN_CLOEXEC);
+ char *buf = strdup(list);
+ char *bufp;
+ wait_t *restrict p, *n, *l, *wait = (wait_t*)0;
+
+ if (fd < 0)
+ error(100, "error in inotify_init(): %s\n", strerror(errno));
+ if (!buf)
+ error(100, "error in strdup(): %s\n", strerror(errno));
+
+ for (bufp = strsep(&buf, ":"); bufp && *bufp; bufp = strsep(&buf, ":")) {
+ char * base, * name;
+ struct stat st;
+ size_t nlen;
+
+ if (stat(bufp, &st) == 0)
+ continue;
+ base = basename(bufp);
+ name = dirname(bufp);
+
+ if (stat(name, &st) < 0) {
+ warn("%s: %s\n", bufp, strerror(errno));
+ continue;
+ }
+ nlen = strlen(base);
+
+ if (posix_memalign((void*)&p, sizeof(void*), alignof(wait_t)+(nlen+1)) != 0)
+ error(100, "malloc(): %s\n", strerror(errno));
+ p->name = ((char*)p)+alignof(wait_t);
+ strcpy(p->name, base);
+
+ if ((p->wd = inotify_add_watch(fd, name, IN_CREATE|IN_MOVE|IN_DELETE_SELF)) < 0) {
+ warn("cannot add watch point for %s: %s\n", name, strerror(errno));
+ free(p);
+ continue;
+ }
+
+ if (wait)
+ wait->prev = p;
+ p->next = wait;
+ p->prev = (wait_t*)0;
+ wait = p;
+ }
+ free(buf);
+
+ while (wait) {
+ char buf[sizeof(struct inotify_event)+PATH_MAX+1];
+ struct inotify_event *restrict ie;
+ struct timeval tv = {0, 10000};
+ fd_set check;
+ ssize_t ret;
+ int in;
+
+ FD_ZERO (&check);
+ FD_SET (fd, &check);
+ if ((in = select(fd + 1, &check, (fd_set*)0, (fd_set*)0, &tv)) < 0) {
+ warn("select: %s\n", strerror(errno));
+ break;
+ }
+ if (in == 0)
+ continue;
+
+ ioctl(fd, FIONREAD, &in);
+ if (in == 0)
+ continue;
+
+ ret = read(fd, &buf, in);
+ if (ret < 0 && (errno == EINTR))
+ continue;
+ ie = (struct inotify_event*)&buf;
+
+ n = wait;
+ l = (wait_t*)0;
+ for (p = wait; n; p = n) {
+ l = p->prev;
+ n = p->next;
+
+ if (p->wd != ie->wd)
+ continue;
+ if (strcmp(p->name, ie->name) != 0)
+ continue;
+
+ if (p == wait) {
+ if (n) n->prev = (wait_t*)0;
+ wait = n;
+ } else if (l) {
+ if (n) n->prev = l;
+ l->next = n;
+ }
+ free(p);
+ }
+ }
+
+ close(fd);
+}
++++++ startpar-0.53.dif ++++++
--- /var/tmp/diff_new_pack.Ik3301/_old 2009-04-01 18:18:33.000000000 +0200
+++ /var/tmp/diff_new_pack.Ik3301/_new 2009-04-01 18:18:33.000000000 +0200
@@ -35,85 +35,3 @@
#endif
/* mark all matching nodes */
if (ndirs >= 0) {
---- startpar.c
-+++ startpar.c 2009-02-12 14:49:10.987760000 +0100
-@@ -29,6 +29,8 @@
- #include
- #include
- #include
-+#include
-+#include
- #include
- #include
- #include
-@@ -64,6 +66,8 @@
- static char *run_mode = NULL;
- static struct makenode **nodevec;
-
-+static enum { Unknown, Preload, NoPreload } ispreload = Unknown;
-+
- #define PBUF_SIZE 8192
- struct prg {
- char *name;
-@@ -248,6 +252,10 @@
- if (read_proc(&prcs_run, &prcs_blked))
- return par;
-
-+ /* if we have preload running, we expect I/O not to be a problem */
-+ if (ispreload == Preload)
-+ prcs_blked = 0;
-+
- newpar = (par*numcpu) - prcs_run + 1; /* +1 for startpar its self */
- newpar -= (int)(((double)prcs_blked)*iorate); /* I/O load reduction */
-
-@@ -271,6 +279,8 @@
- return checksystem(par, start, false);
- }
-
-+#define SOCK_PATH "/dev/shm/preload_sock"
-+
- void run(struct prg *p)
- {
- char *m = 0;
-@@ -341,6 +351,40 @@
-
- closeall();
-
-+ if (!strcmp(arg, "start"))
-+ {
-+ int s, t, len;
-+ struct sockaddr_un remote;
-+ char str[100];
-+
-+ s = socket(AF_UNIX, SOCK_STREAM, 0);
-+ if (s != -1)
-+ {
-+ memset(&remote, 0, sizeof(struct sockaddr_un));
-+ remote.sun_family = AF_UNIX;
-+ strcpy(remote.sun_path, SOCK_PATH);
-+ len = strlen(remote.sun_path) + sizeof(remote.sun_family);
-+
-+ t = connect(s, (struct sockaddr *)&remote, len);
-+ if (t != -1)
-+ {
-+ ispreload = Preload;
-+ send(s, p->name, strlen(p->name), 0);
-+ recv(s, str, 100, 0);
-+ }
-+ else if ( ispreload == Unknown)
-+ {
-+ /*
-+ * if we connected to preload once, we know it ran.
-+ * In case we can't connect to it later, it means it did
-+ * its job and we can guess I/O is no longer a problem.
-+ */
-+ ispreload = NoPreload;
-+ }
-+ close(s);
-+ }
-+ }
-+
- if (run_mode)
- {
- char path[128];
-
++++++ startpar-bootchart.diff ++++++
--- /var/tmp/diff_new_pack.Ik3301/_old 2009-04-01 18:18:33.000000000 +0200
+++ /var/tmp/diff_new_pack.Ik3301/_new 2009-04-01 18:18:33.000000000 +0200
@@ -12,20 +12,20 @@
kill(parent, SIGUSR2);
}
close(s);
-+ /*
-+ * if we use preload, we fork again to make bootcharts easier to read.
-+ * The reason is that the name of the init script will otherwise be used
-+ * when in reality the above code waited for preload. If we fork away
-+ * before the exec, the waiting code will be folded into startpar
-+ */
++ /*
++ * if we use preload, we fork again to make bootcharts easier to read.
++ * The reason is that the name of the init script will otherwise be used
++ * when in reality the above code waited for preload. If we fork away
++ * before the exec, the waiting code will be folded into startpar
++ */
+ child = fork();
-+ if (child) {
++ if (child) {
+ int status;
+ int ret = waitpid(child, &status, 0);
+ if (ret == -1)
+ perror("waitpid");
+ exit(WEXITSTATUS(status));
-+ }
++ }
}
}
++++++ startpar-preload.diff ++++++
--- /var/tmp/diff_new_pack.Ik3301/_old 2009-04-01 18:18:33.000000000 +0200
+++ /var/tmp/diff_new_pack.Ik3301/_new 2009-04-01 18:18:33.000000000 +0200
@@ -1,6 +1,24 @@
---- startpar.c 2009-03-25 16:16:59.308479056 +0100
-+++ startpar.c 2009-03-25 16:52:25.357391610 +0100
-@@ -85,6 +85,19 @@
+--- startpar.c
++++ startpar.c 2009-03-27 11:48:00.080002479 +0100
+@@ -29,6 +29,8 @@
+ #include
+ #include
+ #include
++#include
++#include
+ #include
+ #include
+ #include
+@@ -64,6 +66,8 @@ static struct timeval lastlim;
+ static char *run_mode = NULL;
+ static struct makenode **nodevec;
+
++static enum { Unknown, Preload, NoPreload } ispreload = Unknown;
++
+ #define PBUF_SIZE 8192
+ struct prg {
+ char *name;
+@@ -81,6 +85,19 @@ static int inpar, par;
static int pidpipe[2];
static double iorate = 800.0;
@@ -20,14 +38,14 @@
void *xcalloc(size_t nmemb, size_t size)
{
void *r;
-@@ -253,14 +266,14 @@
+@@ -248,11 +265,15 @@ static int checksystem(const int par, co
+ if (read_proc(&prcs_run, &prcs_blked))
return par;
- /* if we have preload running, we expect I/O not to be a problem */
-- if (ispreload == Preload)
++ /* if we have preload running, we expect I/O not to be a problem */
+ if (ispreload != NoPreload)
- prcs_blked = 0;
-
++ prcs_blked = 0;
++
newpar = (par*numcpu) - prcs_run + 1; /* +1 for startpar its self */
newpar -= (int)(((double)prcs_blked)*iorate); /* I/O load reduction */
@@ -37,7 +55,12 @@
dump_status();
#endif
if (newpar <= 0)
-@@ -284,6 +297,7 @@
+@@ -271,9 +292,12 @@ static inline int checkpar(const int par
+ return checksystem(par, start, false);
+ }
+
++#define SOCK_PATH "/dev/shm/preload_sock"
++
void run(struct prg *p)
{
char *m = 0;
@@ -45,26 +68,49 @@
p->len = 0;
p->pid = (pid_t)0;
-@@ -368,7 +382,8 @@
- t = connect(s, (struct sockaddr *)&remote, len);
- if (t != -1)
- {
-- ispreload = Preload;
+@@ -341,6 +365,41 @@ void run(struct prg *p)
+
+ closeall();
+
++ if (!strcmp(arg, "start"))
++ {
++ int s, t, len;
++ struct sockaddr_un remote;
++ char str[100];
++
++ s = socket(AF_UNIX, SOCK_STREAM, 0);
++ if (s != -1)
++ {
++ memset(&remote, 0, sizeof(struct sockaddr_un));
++ remote.sun_family = AF_UNIX;
++ strcpy(remote.sun_path, SOCK_PATH);
++ len = strlen(remote.sun_path) + sizeof(remote.sun_family);
++
++ t = connect(s, (struct sockaddr *)&remote, len);
++ if (t != -1)
++ {
+ if (ispreload != Preload)
+ kill(parent, SIGUSR1);
- send(s, p->name, strlen(p->name), 0);
- recv(s, str, 100, 0);
- }
-@@ -379,7 +394,7 @@
- * In case we can't connect to it later, it means it did
- * its job and we can guess I/O is no longer a problem.
- */
-- ispreload = NoPreload;
++ send(s, p->name, strlen(p->name), 0);
++ recv(s, str, 100, 0);
++ }
++ else if ( ispreload == Unknown)
++ {
++ /*
++ * if we connected to preload once, we know it ran.
++ * In case we can't connect to it later, it means it did
++ * its job and we can guess I/O is no longer a problem.
++ */
+ kill(parent, SIGUSR2);
- }
- close(s);
- }
-@@ -601,6 +616,9 @@
++ }
++ close(s);
++ }
++ }
++
+ if (run_mode)
+ {
+ char path[128];
+@@ -557,6 +616,9 @@ int main(int argc, char **argv)
char *run_level = getenv("RUNLEVEL");
char *splashopt = 0;
@@ -74,4 +120,3 @@
(void)signal(SIGCHLD, SIG_DFL);
numcpu = sysconf(_SC_NPROCESSORS_ONLN);
myname = argv[0];
-
++++++ sysvinit-2.86-fuse-no-kill.patch ++++++
--- /var/tmp/diff_new_pack.Ik3301/_old 2009-04-01 18:18:33.000000000 +0200
+++ /var/tmp/diff_new_pack.Ik3301/_new 2009-04-01 18:18:33.000000000 +0200
@@ -1,5 +1,5 @@
--- src/killall5.c
-+++ src/killall5.c 2009-01-27 16:32:40.048701097 +0100
++++ src/killall5.c 2009-01-27 16:32:40.000000000 +0100
@@ -59,6 +59,8 @@ typedef struct proc {
pid_t pid; /* Process ID. */
int sid; /* Session ID. */
@@ -9,7 +9,7 @@
char nfs; /* Binary is loacted on NFS part. */
struct proc *next; /* Pointer to next struct. */
} PROC;
-@@ -283,6 +285,38 @@ int readarg(FILE *fp, char *buf, int sz)
+@@ -410,6 +412,38 @@ int readarg(FILE *fp, char *buf, int sz)
}
/*
@@ -48,7 +48,7 @@
* Read the proc filesystem.
*/
int readproc()
-@@ -438,13 +472,19 @@ int readproc()
+@@ -565,13 +599,19 @@ int readproc()
/* Try to stat the executable. */
snprintf(path, sizeof(path), "/proc/%s/exe", d->d_name);
@@ -69,9 +69,9 @@
/* Link it into the list. */
p->next = plist;
plist = p;
-@@ -779,14 +819,16 @@ int main(int argc, char **argv)
- exit(1);
+@@ -907,14 +947,16 @@ int main(int argc, char **argv)
}
+ clear_mnt();
- /* Now kill all processes except our session. */
+ /* Now kill all processes except init (pid 1), our session, and FUSE filesystems. */
++++++ sysvinit-2.86-nfs4pidof.patch ++++++
--- /var/tmp/diff_new_pack.Ik3301/_old 2009-04-01 18:18:33.000000000 +0200
+++ /var/tmp/diff_new_pack.Ik3301/_new 2009-04-01 18:18:33.000000000 +0200
@@ -1,5 +1,5 @@
--- src/killall5.c
-+++ src/killall5.c 2009-03-11 14:13:21.708001809 +0100
++++ src/killall5.c 2009-03-27 11:42:17.780766281 +0100
@@ -40,6 +40,8 @@
#include
#include
@@ -19,17 +19,32 @@
struct proc *next; /* Pointer to next struct. */
} PROC;
-@@ -73,9 +76,20 @@ typedef struct {
+@@ -73,9 +76,35 @@ typedef struct {
PIDQ *next;
} PIDQ_HEAD;
++typedef struct shadow
++{
++ struct shadow *next;
++ struct shadow *prev;
++ size_t nlen;
++ char * name;
++} SHADOW;
++
+typedef struct nfs
+{
+ struct nfs *next; /* Pointer to next struct. */
+ struct nfs *prev; /* Pointer to previous st. */
++ SHADOW *shadow; /* Pointer to shadows */
+ char * name;
+ size_t nlen;
+} NFS;
++#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L)
++# ifndef restrict
++# define restrict __restrict__
++# endif
++#endif
++#define alignof(type) ((sizeof(type)+(sizeof(void*)-1)) & ~(sizeof(void*)-1))
+
/* List of processes. */
PROC *plist;
@@ -40,7 +55,26 @@
/* Did we stop all processes ? */
int sent_sigstop;
-@@ -152,6 +166,116 @@ int mount_proc(void)
+@@ -102,6 +131,18 @@ void *xmalloc(int bytes)
+ return p;
+ }
+
++#ifdef __GNUC__
++static inline void xmemalign(void **, size_t, size_t) __attribute__ ((nonnull (1)));
++#endif
++static inline void xmemalign(void **memptr, size_t alignment, size_t size)
++{
++ if ((posix_memalign(memptr, alignment, size)) < 0) {
++ if (sent_sigstop) kill(-1, SIGCONT);
++ nsyslog(LOG_ERR, "out of memory");
++ exit(1);
++ }
++}
++
+ /*
+ * See if the proc filesystem is there. Mount if needed.
+ */
+@@ -152,6 +193,211 @@ int mount_proc(void)
return did_mount;
}
@@ -72,10 +106,14 @@
+
+ while ((ent = getmntent(mnt))) {
+ if (isnetfs(ent->mnt_type)) {
-+ NFS * p = (NFS*)xmalloc(sizeof(NFS));
-+ p->name = (char*)xmalloc(strlen(ent->mnt_dir)+1);
++ size_t nlen = strlen(ent->mnt_dir);
++ NFS *restrict p;
++ xmemalign((void*)&p, sizeof(void*), alignof(NFS)+(nlen+1));
++ p->name = ((char*)p)+alignof(NFS);
++ p->nlen = nlen;
++ p->shadow = (SHADOW*)0;
++
+ strcpy(p->name, ent->mnt_dir);
-+ p->nlen = strlen(p->name);
+ if (nlist)
+ nlist->prev = p;
+ p->next = nlist;
@@ -83,10 +121,102 @@
+ nlist = p;
+ }
+ }
++ endmntent(mnt);
+
++ if ((mnt = setmntent("/proc/mounts", "r")) == (FILE*)0)
++ return;
++
++ while ((ent = getmntent(mnt))) {
++ NFS *p;
++
++ for (p = nlist; p; p = p->next) {
++ SHADOW * restrict s;
++ size_t nlen;
++
++ if (strcmp(ent->mnt_dir, p->name) == 0)
++ continue;
++ if (strncmp(ent->mnt_dir, p->name, p->nlen) != 0)
++ continue;
++
++ nlen = strlen(ent->mnt_dir);
++ xmemalign((void*)&s, sizeof(void*), alignof(SHADOW)+(nlen+1));
++ s->name = ((char*)s)+alignof(SHADOW);
++ s->nlen = nlen;
++
++ strcpy(s->name, ent->mnt_dir);
++ if (p->shadow)
++ p->shadow->prev = s;
++ s->next = p->shadow;
++ s->prev = (SHADOW*)0;
++ p->shadow = s;
++ }
++ }
+ endmntent(mnt);
+}
+
++static void clear_shadow(SHADOW *restrict shadow)
++{
++ SHADOW *s, *n, *l;
++
++ n = shadow;
++ l = (SHADOW*)0;
++ for (s = shadow; n; s = n) {
++ l = s->prev;
++ n = s->next;
++ if (s == shadow) {
++ if (n) n->prev = (SHADOW*)0;
++ shadow = n;
++ } else if (l) {
++ if (n) n->prev = l;
++ l->next = n;
++ }
++ free(s);
++ }
++}
++
++static void clear_mnt(void)
++{
++ NFS *p, *n, *l;
++
++ n = nlist;
++ l = (NFS*)0;
++ for (p = nlist; n; p = n) {
++ l = p->prev;
++ n = p->next;
++ if (p == nlist) {
++ if (n) n->prev = (NFS*)0;
++ nlist = n;
++ } else if (l) {
++ if (n) n->prev = l;
++ l->next = n;
++ }
++ if (p->shadow)
++ clear_shadow(p->shadow);
++ free(p);
++ }
++}
++
++/*
++ * Check if path is ia shadow off a NFS partition.
++ */
++static int shadow(SHADOW *restrict this, const char *restrict name, const size_t nlen)
++{
++ SHADOW *s;
++
++ if (!this)
++ goto out;
++ for (s = this; s; s = s->next) {
++ if (nlen < s->nlen)
++ continue;
++ if (name[s->nlen] != '\0' && name[s->nlen] != '/')
++ continue;
++ if (strncmp(name, s->name, s->nlen) == 0)
++ return 1;
++ }
++out:
++ return 0;
++}
++
+/*
+ * Check path is located on a NFS partition.
+ */
@@ -136,18 +266,17 @@
+
+ if (errno == EINVAL) {
+ const size_t nlen = strlen(curr);
-+ NFS *p, *n, *l;
-+ n = nlist;
-+ l = (NFS*)0;
-+ for (p = nlist; n; p = n) {
-+ l = p->prev;
-+ n = p->next;
++ NFS *p;
++ for (p = nlist; p; p = p->next) {
+ if (nlen < p->nlen)
+ continue;
+ if (curr[p->nlen] != '\0' && curr[p->nlen] != '/')
+ continue;
-+ if (!strncmp(curr, p->name, p->nlen))
++ if (!strncmp(curr, p->name, p->nlen)) {
++ if (shadow(p->shadow, curr, nlen))
++ continue;
+ return 1;
++ }
+ }
+ }
+
@@ -157,7 +286,7 @@
int readarg(FILE *fp, char *buf, int sz)
{
int c = 0, f = 0;
-@@ -173,8 +297,8 @@ int readproc()
+@@ -173,8 +419,8 @@ int readproc()
PROC *p, *n;
struct dirent *d;
struct stat st;
@@ -168,7 +297,7 @@
char *s, *q;
unsigned long startcode, endcode;
int pid, f;
-@@ -191,6 +315,7 @@ int readproc()
+@@ -191,6 +437,7 @@ int readproc()
n = p->next;
if (p->argv0) free(p->argv0);
if (p->argv1) free(p->argv1);
@@ -176,7 +305,7 @@
free(p);
}
plist = NULL;
-@@ -225,6 +350,9 @@ int readproc()
+@@ -225,6 +472,9 @@ int readproc()
nsyslog(LOG_ERR,
"can't get program name from %s\n",
path);
@@ -186,7 +315,7 @@
free(p);
continue;
}
-@@ -248,6 +376,9 @@ int readproc()
+@@ -248,6 +498,9 @@ int readproc()
p->sid = 0;
nsyslog(LOG_ERR, "can't read sid from %s\n",
path);
@@ -196,7 +325,7 @@
free(p);
continue;
}
-@@ -256,6 +387,9 @@ int readproc()
+@@ -256,6 +509,9 @@ int readproc()
fclose(fp);
} else {
/* Process disappeared.. */
@@ -206,7 +335,7 @@
free(p);
continue;
}
-@@ -300,13 +434,18 @@ int readproc()
+@@ -300,13 +556,18 @@ int readproc()
} else {
/* Process disappeared.. */
@@ -226,7 +355,7 @@
p->dev = st.st_dev;
p->ino = st.st_ino;
}
-@@ -374,12 +513,25 @@ PIDQ_HEAD *pidof(char *prog)
+@@ -374,12 +635,25 @@ PIDQ_HEAD *pidof(char *prog)
PIDQ_HEAD *q;
struct stat st;
char *s;
@@ -253,7 +382,7 @@
/* Get basename of program. */
if ((s = strrchr(prog, '/')) == NULL)
-@@ -393,10 +545,30 @@ PIDQ_HEAD *pidof(char *prog)
+@@ -393,10 +667,30 @@ PIDQ_HEAD *pidof(char *prog)
/* First try to find a match based on dev/ino pair. */
if (dostat) {
for (p = plist; p; p = p->next) {
@@ -288,7 +417,7 @@
}
}
-@@ -428,7 +600,7 @@ PIDQ_HEAD *pidof(char *prog)
+@@ -428,7 +722,7 @@ PIDQ_HEAD *pidof(char *prog)
if (ok) add_pid_to_q(q, p);
}
@@ -297,7 +426,7 @@
}
/* Give usage message and exit. */
-@@ -477,6 +649,9 @@ int main_pidof(int argc, char **argv)
+@@ -477,6 +771,9 @@ int main_pidof(int argc, char **argv)
int first = 1;
int i, oind, opt, flags = 0;
@@ -307,7 +436,7 @@
for (oind = PIDOF_OMITSZ-1; oind > 0; oind--)
opid[oind] = 0;
opterr = 0;
-@@ -561,6 +736,7 @@ int main(int argc, char **argv)
+@@ -561,6 +858,7 @@ int main(int argc, char **argv)
PROC *p;
int pid, sid = -1;
int sig = SIGKILL;
@@ -315,7 +444,7 @@
/* Get program name. */
if ((progname = strrchr(argv[0], '/')) == NULL)
-@@ -583,7 +759,10 @@ int main(int argc, char **argv)
+@@ -583,7 +881,10 @@ int main(int argc, char **argv)
}
/* First get the /proc filesystem online. */
@@ -327,7 +456,12 @@
/*
* Ignoring SIGKILL and SIGSTOP do not make sense, but
-@@ -608,9 +787,13 @@ int main(int argc, char **argv)
+@@ -604,13 +905,18 @@ int main(int argc, char **argv)
+ kill(-1, SIGCONT);
+ exit(1);
+ }
++ clear_mnt();
+
/* Now kill all processes except our session. */
sid = (int)getsid(0);
pid = (int)getpid();
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org