OBS User unknown 2009-04-01 16:20:36 +00:00 committed by Git OBS Bridge
parent 7a8f1764ed
commit 7b82c4f0f1
11 changed files with 280 additions and 344 deletions

View File

@ -1,186 +0,0 @@
--- 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;
}

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2fb47ac91e1906275b4e3c609e53703f0707dc8ac15c0e25573cb45dedca46cf
size 36184

4
killproc-2.15.dif Normal file
View File

@ -0,0 +1,4 @@
--- .empty
+++ .empty 2009-03-26 18:47:25.048001558 +0100
@@ -0,0 +1 @@
+remove if patch applied

3
killproc-2.15.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:356a130e58e4b9fca3bdb64d6c1c3cafa64c64aad5587270d7da9a2caeeefb38
size 37327

View File

@ -35,85 +35,3 @@
#endif #endif
/* mark all matching nodes */ /* mark all matching nodes */
if (ndirs >= 0) { if (ndirs >= 0) {
--- startpar.c
+++ startpar.c 2009-02-12 14:49:10.987760000 +0100
@@ -29,6 +29,8 @@
#include <sys/select.h>
#include <sys/time.h>
#include <sys/ioctl.h>
+#include <sys/socket.h>
+#include <sys/un.h>
#include <sys/sysinfo.h>
#include <sys/stat.h>
#include <time.h>
@@ -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];

View File

@ -12,20 +12,20 @@
kill(parent, SIGUSR2); kill(parent, SIGUSR2);
} }
close(s); close(s);
+ /* + /*
+ * if we use preload, we fork again to make bootcharts easier to read. + * 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 + * 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 + * when in reality the above code waited for preload. If we fork away
+ * before the exec, the waiting code will be folded into startpar + * before the exec, the waiting code will be folded into startpar
+ */ + */
+ child = fork(); + child = fork();
+ if (child) { + if (child) {
+ int status; + int status;
+ int ret = waitpid(child, &status, 0); + int ret = waitpid(child, &status, 0);
+ if (ret == -1) + if (ret == -1)
+ perror("waitpid"); + perror("waitpid");
+ exit(WEXITSTATUS(status)); + exit(WEXITSTATUS(status));
+ } + }
} }
} }

View File

@ -1,6 +1,24 @@
--- startpar.c 2009-03-25 16:16:59.308479056 +0100 --- startpar.c
+++ startpar.c 2009-03-25 16:52:25.357391610 +0100 +++ startpar.c 2009-03-27 11:48:00.080002479 +0100
@@ -85,6 +85,19 @@ @@ -29,6 +29,8 @@
#include <sys/select.h>
#include <sys/time.h>
#include <sys/ioctl.h>
+#include <sys/socket.h>
+#include <sys/un.h>
#include <sys/sysinfo.h>
#include <sys/stat.h>
#include <time.h>
@@ -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 int pidpipe[2];
static double iorate = 800.0; static double iorate = 800.0;
@ -20,14 +38,14 @@
void *xcalloc(size_t nmemb, size_t size) void *xcalloc(size_t nmemb, size_t size)
{ {
void *r; 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; return par;
/* if we have preload running, we expect I/O not to be a problem */ + /* if we have preload running, we expect I/O not to be a problem */
- if (ispreload == Preload)
+ if (ispreload != NoPreload) + if (ispreload != NoPreload)
prcs_blked = 0; + prcs_blked = 0;
+
newpar = (par*numcpu) - prcs_run + 1; /* +1 for startpar its self */ newpar = (par*numcpu) - prcs_run + 1; /* +1 for startpar its self */
newpar -= (int)(((double)prcs_blked)*iorate); /* I/O load reduction */ newpar -= (int)(((double)prcs_blked)*iorate); /* I/O load reduction */
@ -37,7 +55,12 @@
dump_status(); dump_status();
#endif #endif
if (newpar <= 0) 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) void run(struct prg *p)
{ {
char *m = 0; char *m = 0;
@ -45,26 +68,49 @@
p->len = 0; p->len = 0;
p->pid = (pid_t)0; p->pid = (pid_t)0;
@@ -368,7 +382,8 @@ @@ -341,6 +365,41 @@ void run(struct prg *p)
t = connect(s, (struct sockaddr *)&remote, len);
if (t != -1) closeall();
{
- ispreload = Preload; + 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) + if (ispreload != Preload)
+ kill(parent, SIGUSR1); + kill(parent, SIGUSR1);
send(s, p->name, strlen(p->name), 0); + send(s, p->name, strlen(p->name), 0);
recv(s, str, 100, 0); + recv(s, str, 100, 0);
} + }
@@ -379,7 +394,7 @@ + else if ( ispreload == Unknown)
* 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. + /*
*/ + * if we connected to preload once, we know it ran.
- ispreload = NoPreload; + * 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); + kill(parent, SIGUSR2);
} + }
close(s); + close(s);
} + }
@@ -601,6 +616,9 @@ + }
+
if (run_mode)
{
char path[128];
@@ -557,6 +616,9 @@ int main(int argc, char **argv)
char *run_level = getenv("RUNLEVEL"); char *run_level = getenv("RUNLEVEL");
char *splashopt = 0; char *splashopt = 0;
@ -74,4 +120,3 @@
(void)signal(SIGCHLD, SIG_DFL); (void)signal(SIGCHLD, SIG_DFL);
numcpu = sysconf(_SC_NPROCESSORS_ONLN); numcpu = sysconf(_SC_NPROCESSORS_ONLN);
myname = argv[0]; myname = argv[0];

View File

@ -1,5 +1,5 @@
--- src/killall5.c --- 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 { @@ -59,6 +59,8 @@ typedef struct proc {
pid_t pid; /* Process ID. */ pid_t pid; /* Process ID. */
int sid; /* Session ID. */ int sid; /* Session ID. */
@ -9,7 +9,7 @@
char nfs; /* Binary is loacted on NFS part. */ char nfs; /* Binary is loacted on NFS part. */
struct proc *next; /* Pointer to next struct. */ struct proc *next; /* Pointer to next struct. */
} PROC; } 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. * Read the proc filesystem.
*/ */
int readproc() int readproc()
@@ -438,13 +472,19 @@ int readproc() @@ -565,13 +599,19 @@ int readproc()
/* Try to stat the executable. */ /* Try to stat the executable. */
snprintf(path, sizeof(path), "/proc/%s/exe", d->d_name); snprintf(path, sizeof(path), "/proc/%s/exe", d->d_name);
@ -69,9 +69,9 @@
/* Link it into the list. */ /* Link it into the list. */
p->next = plist; p->next = plist;
plist = p; plist = p;
@@ -779,14 +819,16 @@ int main(int argc, char **argv) @@ -907,14 +947,16 @@ int main(int argc, char **argv)
exit(1);
} }
clear_mnt();
- /* Now kill all processes except our session. */ - /* Now kill all processes except our session. */
+ /* Now kill all processes except init (pid 1), our session, and FUSE filesystems. */ + /* Now kill all processes except init (pid 1), our session, and FUSE filesystems. */

View File

@ -1,5 +1,5 @@
--- src/killall5.c --- 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 @@ @@ -40,6 +40,8 @@
#include <syslog.h> #include <syslog.h>
#include <getopt.h> #include <getopt.h>
@ -19,17 +19,32 @@
struct proc *next; /* Pointer to next struct. */ struct proc *next; /* Pointer to next struct. */
} PROC; } PROC;
@@ -73,9 +76,20 @@ typedef struct { @@ -73,9 +76,35 @@ typedef struct {
PIDQ *next; PIDQ *next;
} PIDQ_HEAD; } PIDQ_HEAD;
+typedef struct shadow
+{
+ struct shadow *next;
+ struct shadow *prev;
+ size_t nlen;
+ char * name;
+} SHADOW;
+
+typedef struct nfs +typedef struct nfs
+{ +{
+ struct nfs *next; /* Pointer to next struct. */ + struct nfs *next; /* Pointer to next struct. */
+ struct nfs *prev; /* Pointer to previous st. */ + struct nfs *prev; /* Pointer to previous st. */
+ SHADOW *shadow; /* Pointer to shadows */
+ char * name; + char * name;
+ size_t nlen; + size_t nlen;
+} NFS; +} 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. */ /* List of processes. */
PROC *plist; PROC *plist;
@ -40,7 +55,26 @@
/* Did we stop all processes ? */ /* Did we stop all processes ? */
int sent_sigstop; 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; return did_mount;
} }
@ -72,10 +106,14 @@
+ +
+ while ((ent = getmntent(mnt))) { + while ((ent = getmntent(mnt))) {
+ if (isnetfs(ent->mnt_type)) { + if (isnetfs(ent->mnt_type)) {
+ NFS * p = (NFS*)xmalloc(sizeof(NFS)); + size_t nlen = strlen(ent->mnt_dir);
+ p->name = (char*)xmalloc(strlen(ent->mnt_dir)+1); + 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); + strcpy(p->name, ent->mnt_dir);
+ p->nlen = strlen(p->name);
+ if (nlist) + if (nlist)
+ nlist->prev = p; + nlist->prev = p;
+ p->next = nlist; + p->next = nlist;
@ -83,8 +121,100 @@
+ nlist = p; + nlist = p;
+ } + }
+ } + }
+
+ endmntent(mnt); + 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;
+} +}
+ +
+/* +/*
@ -136,18 +266,17 @@
+ +
+ if (errno == EINVAL) { + if (errno == EINVAL) {
+ const size_t nlen = strlen(curr); + const size_t nlen = strlen(curr);
+ NFS *p, *n, *l; + NFS *p;
+ n = nlist; + for (p = nlist; p; p = p->next) {
+ l = (NFS*)0;
+ for (p = nlist; n; p = n) {
+ l = p->prev;
+ n = p->next;
+ if (nlen < p->nlen) + if (nlen < p->nlen)
+ continue; + continue;
+ if (curr[p->nlen] != '\0' && curr[p->nlen] != '/') + if (curr[p->nlen] != '\0' && curr[p->nlen] != '/')
+ continue; + continue;
+ if (!strncmp(curr, p->name, p->nlen)) + if (!strncmp(curr, p->name, p->nlen)) {
+ if (shadow(p->shadow, curr, nlen))
+ continue;
+ return 1; + return 1;
+ }
+ } + }
+ } + }
+ +
@ -157,7 +286,7 @@
int readarg(FILE *fp, char *buf, int sz) int readarg(FILE *fp, char *buf, int sz)
{ {
int c = 0, f = 0; int c = 0, f = 0;
@@ -173,8 +297,8 @@ int readproc() @@ -173,8 +419,8 @@ int readproc()
PROC *p, *n; PROC *p, *n;
struct dirent *d; struct dirent *d;
struct stat st; struct stat st;
@ -168,7 +297,7 @@
char *s, *q; char *s, *q;
unsigned long startcode, endcode; unsigned long startcode, endcode;
int pid, f; int pid, f;
@@ -191,6 +315,7 @@ int readproc() @@ -191,6 +437,7 @@ int readproc()
n = p->next; n = p->next;
if (p->argv0) free(p->argv0); if (p->argv0) free(p->argv0);
if (p->argv1) free(p->argv1); if (p->argv1) free(p->argv1);
@ -176,7 +305,7 @@
free(p); free(p);
} }
plist = NULL; plist = NULL;
@@ -225,6 +350,9 @@ int readproc() @@ -225,6 +472,9 @@ int readproc()
nsyslog(LOG_ERR, nsyslog(LOG_ERR,
"can't get program name from %s\n", "can't get program name from %s\n",
path); path);
@ -186,7 +315,7 @@
free(p); free(p);
continue; continue;
} }
@@ -248,6 +376,9 @@ int readproc() @@ -248,6 +498,9 @@ int readproc()
p->sid = 0; p->sid = 0;
nsyslog(LOG_ERR, "can't read sid from %s\n", nsyslog(LOG_ERR, "can't read sid from %s\n",
path); path);
@ -196,7 +325,7 @@
free(p); free(p);
continue; continue;
} }
@@ -256,6 +387,9 @@ int readproc() @@ -256,6 +509,9 @@ int readproc()
fclose(fp); fclose(fp);
} else { } else {
/* Process disappeared.. */ /* Process disappeared.. */
@ -206,7 +335,7 @@
free(p); free(p);
continue; continue;
} }
@@ -300,13 +434,18 @@ int readproc() @@ -300,13 +556,18 @@ int readproc()
} else { } else {
/* Process disappeared.. */ /* Process disappeared.. */
@ -226,7 +355,7 @@
p->dev = st.st_dev; p->dev = st.st_dev;
p->ino = st.st_ino; 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; PIDQ_HEAD *q;
struct stat st; struct stat st;
char *s; char *s;
@ -253,7 +382,7 @@
/* Get basename of program. */ /* Get basename of program. */
if ((s = strrchr(prog, '/')) == NULL) 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. */ /* First try to find a match based on dev/ino pair. */
if (dostat) { if (dostat) {
for (p = plist; p; p = p->next) { 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); if (ok) add_pid_to_q(q, p);
} }
@ -297,7 +426,7 @@
} }
/* Give usage message and exit. */ /* 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 first = 1;
int i, oind, opt, flags = 0; int i, oind, opt, flags = 0;
@ -307,7 +436,7 @@
for (oind = PIDOF_OMITSZ-1; oind > 0; oind--) for (oind = PIDOF_OMITSZ-1; oind > 0; oind--)
opid[oind] = 0; opid[oind] = 0;
opterr = 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; PROC *p;
int pid, sid = -1; int pid, sid = -1;
int sig = SIGKILL; int sig = SIGKILL;
@ -315,7 +444,7 @@
/* Get program name. */ /* Get program name. */
if ((progname = strrchr(argv[0], '/')) == NULL) 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. */ /* First get the /proc filesystem online. */
@ -327,7 +456,12 @@
/* /*
* Ignoring SIGKILL and SIGSTOP do not make sense, but * 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. */ /* Now kill all processes except our session. */
sid = (int)getsid(0); sid = (int)getsid(0);
pid = (int)getpid(); pid = (int)getpid();

View File

@ -1,3 +1,15 @@
-------------------------------------------------------------------
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
------------------------------------------------------------------- -------------------------------------------------------------------
Wed Mar 25 21:32:51 CET 2009 - coolo@suse.de Wed Mar 25 21:32:51 CET 2009 - coolo@suse.de
@ -46,7 +58,7 @@ Mon Mar 9 13:54:55 CET 2009 - werner@suse.de
------------------------------------------------------------------- -------------------------------------------------------------------
Thu Mar 5 17:27:33 CET 2009 - werner@suse.de Thu Mar 5 17:27:33 CET 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. use openat(2), readlinkat(2), and opendirat(2) system calls.
- Remove /dev/initctl from file list, do not create blogd pipe - Remove /dev/initctl from file list, do not create blogd pipe
/dev/blogd (bnc#475580) /dev/blogd (bnc#475580)

View File

@ -21,7 +21,7 @@
Name: sysvinit Name: sysvinit
%define MGVER 0.9.6s %define MGVER 0.9.6s
%define PDVER 2.0.2 %define PDVER 2.0.2
%define KPVER 2.14 %define KPVER 2.15
%define SCVER 1.09 %define SCVER 1.09
%define SIVER 2.86 %define SIVER 2.86
%define START 0.53 %define START 0.53
@ -30,12 +30,12 @@ Group: System/Base
PreReq: coreutils PreReq: coreutils
AutoReqProv: on AutoReqProv: on
Version: 2.86 Version: 2.86
Release: 202 Release: 203
Summary: SysV-Style init Summary: SysV-Style init
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: libselinux-devel libsepol-devel BuildRequires: libselinux-devel libsepol-devel
Source: sysvinit-2.86.tar.bz2 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 Source3: powerd-2.0.2.tar.bz2
Source4: showconsole-1.09.tar.bz2 Source4: showconsole-1.09.tar.bz2
Source5: startpar-0.53.tar.bz2 Source5: startpar-0.53.tar.bz2
@ -47,7 +47,7 @@ Source10: mkinitrd-kill2.sh
Patch: sysvinit-2.86.dif Patch: sysvinit-2.86.dif
Patch1: sysvinit-2.86-nfs4pidof.patch Patch1: sysvinit-2.86-nfs4pidof.patch
Patch2: powerd-2.0.2.dif Patch2: powerd-2.0.2.dif
Patch3: killproc-2.14.dif Patch3: killproc-2.15.dif
Patch5: sysvinit-2.86-sulogin.patch Patch5: sysvinit-2.86-sulogin.patch
Patch6: sysvinit-2.82-startstop.patch Patch6: sysvinit-2.82-startstop.patch
Patch7: sysvinit-2.85-suse.patch Patch7: sysvinit-2.85-suse.patch
@ -327,6 +327,15 @@ rm -rf ${RPM_BUILD_ROOT}
%doc %{_mandir}/man8/mkill.8.gz %doc %{_mandir}/man8/mkill.8.gz
%changelog %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 * Wed Mar 25 2009 coolo@suse.de
- exec one more time so that the preload part does not appear - exec one more time so that the preload part does not appear
under the name of the init script in bootcharts under the name of the init script in bootcharts
@ -349,7 +358,7 @@ rm -rf ${RPM_BUILD_ROOT}
* Mon Mar 09 2009 werner@suse.de * Mon Mar 09 2009 werner@suse.de
- Add patch from Debian people to startpar and mode to version 0.53 - Add patch from Debian people to startpar and mode to version 0.53
* Thu Mar 05 2009 werner@suse.de * 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. use openat(2), readlinkat(2), and opendirat(2) system calls.
- Remove /dev/initctl from file list, do not create blogd pipe - Remove /dev/initctl from file list, do not create blogd pipe
/dev/blogd (bnc#475580) /dev/blogd (bnc#475580)