From ec091fc3033e4ff037f59121df5ee23e95ca3284eebc8a1131f9ce2fd6844945 Mon Sep 17 00:00:00 2001 From: OBS User unknown Date: Wed, 1 Oct 2008 16:03:48 +0000 Subject: [PATCH] OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/sysvinit?expand=0&rev=27 --- sysvinit-2.86-fuse-no-kill.patch | 28 +++++++++++++++------ sysvinit-2.86-nfs4pidof.patch | 42 ++++++++++++++++++++------------ sysvinit.changes | 10 ++++++++ sysvinit.spec | 6 ++++- 4 files changed, 61 insertions(+), 25 deletions(-) diff --git a/sysvinit-2.86-fuse-no-kill.patch b/sysvinit-2.86-fuse-no-kill.patch index 2be70e9..b0ef40d 100644 --- a/sysvinit-2.86-fuse-no-kill.patch +++ b/sysvinit-2.86-fuse-no-kill.patch @@ -1,6 +1,6 @@ --- src/killall5.c +++ src/killall5.c -@@ -274,6 +274,7 @@ +@@ -284,6 +284,7 @@ /* * Read the proc filesystem. @@ -8,7 +8,7 @@ */ int readproc() { -@@ -289,7 +290,7 @@ +@@ -299,7 +300,7 @@ int pid, f; /* Open the /proc directory. */ @@ -17,7 +17,7 @@ nsyslog(LOG_ERR, "cannot opendir(/proc)"); return -1; } -@@ -316,10 +317,10 @@ +@@ -326,10 +327,10 @@ memset(p, 0, sizeof(PROC)); /* Open the status file. */ @@ -30,7 +30,7 @@ buf[0] = 0; fgets(buf, sizeof(buf), fp); -@@ -333,7 +334,7 @@ +@@ -343,7 +344,7 @@ if (q == NULL) { p->sid = 0; nsyslog(LOG_ERR, @@ -39,7 +39,7 @@ path); if (p->argv0) free(p->argv0); if (p->argv1) free(p->argv1); -@@ -379,7 +380,7 @@ +@@ -389,7 +390,7 @@ continue; } @@ -48,7 +48,7 @@ if ((fp = fopen(path, "r")) != NULL) { /* Now read argv[0] */ -@@ -446,6 +447,39 @@ +@@ -456,6 +457,39 @@ return 0; } @@ -88,7 +88,19 @@ PIDQ_HEAD *init_pid_q(PIDQ_HEAD *q) { q->head = q->next = q->tail = NULL; -@@ -749,6 +783,11 @@ +@@ -688,6 +722,11 @@ + argc -= optind; + argv += optind; + ++ if (chdir("/proc") == -1) { ++ nsyslog(LOG_ERR, "chdir /proc failed"); ++ return(1); ++ } ++ + /* Print out process-ID's one by one. */ + readproc(); + for(f = 0; f < argc; f++) { +@@ -759,6 +798,11 @@ /* Which NFS partitions are online? */ init_nfs(); @@ -100,7 +112,7 @@ /* * Ignoring SIGKILL and SIGSTOP do not make sense, but * someday kill(-1, sig) might kill ourself if we don't -@@ -769,11 +808,12 @@ +@@ -779,11 +823,12 @@ exit(1); } diff --git a/sysvinit-2.86-nfs4pidof.patch b/sysvinit-2.86-nfs4pidof.patch index 14ae707..42ed040 100644 --- a/sysvinit-2.86-nfs4pidof.patch +++ b/sysvinit-2.86-nfs4pidof.patch @@ -1,5 +1,5 @@ --- src/killall5.c -+++ src/killall5.c 2006-12-14 15:53:19.000000000 +0100 ++++ src/killall5.c 2008-10-01 16:42:51.186708662 +0200 @@ -40,6 +40,8 @@ #include #include @@ -40,10 +40,20 @@ /* Did we stop all processes ? */ int sent_sigstop; -@@ -152,6 +166,101 @@ int mount_proc(void) +@@ -152,6 +166,111 @@ int mount_proc(void) return did_mount; } ++static inline int isnetfs(const char * type) ++{ ++ static const char* netfs[] = {"nfs", "nfs4", "smbfs", "cifs", "afs", "ncpfs", (char*)0}; ++ int n; ++ for (n = 0; netfs[n]; n++) ++ if (!strcasecmp(netfs[n], type)) ++ return 1; ++ return 0; ++} ++ +/* + * Remember all NFS typed partitions. + */ @@ -61,7 +71,7 @@ + return; + + while ((ent = getmntent(mnt))) { -+ if (!strcasecmp(MNTTYPE_NFS, ent->mnt_type)) { ++ if (isnetfs(ent->mnt_type)) { + NFS * p = (NFS*)xmalloc(sizeof(NFS)); + p->name = (char*)xmalloc(strlen(ent->mnt_dir)+1); + strcpy(p->name, ent->mnt_dir); @@ -142,7 +152,7 @@ int readarg(FILE *fp, char *buf, int sz) { int c = 0, f = 0; -@@ -173,8 +282,8 @@ int readproc() +@@ -173,8 +292,8 @@ int readproc() PROC *p, *n; struct dirent *d; struct stat st; @@ -153,7 +163,7 @@ char *s, *q; unsigned long startcode, endcode; int pid, f; -@@ -191,6 +300,7 @@ int readproc() +@@ -191,6 +310,7 @@ int readproc() n = p->next; if (p->argv0) free(p->argv0); if (p->argv1) free(p->argv1); @@ -161,7 +171,7 @@ free(p); } plist = NULL; -@@ -225,6 +335,9 @@ int readproc() +@@ -225,6 +345,9 @@ int readproc() nsyslog(LOG_ERR, "can't get program name from %s\n", path); @@ -171,7 +181,7 @@ free(p); continue; } -@@ -248,6 +361,9 @@ int readproc() +@@ -248,6 +371,9 @@ int readproc() p->sid = 0; nsyslog(LOG_ERR, "can't read sid from %s\n", path); @@ -181,7 +191,7 @@ free(p); continue; } -@@ -256,6 +372,9 @@ int readproc() +@@ -256,6 +382,9 @@ int readproc() fclose(fp); } else { /* Process disappeared.. */ @@ -191,7 +201,7 @@ free(p); continue; } -@@ -300,13 +419,18 @@ int readproc() +@@ -300,13 +429,18 @@ int readproc() } else { /* Process disappeared.. */ @@ -211,7 +221,7 @@ p->dev = st.st_dev; p->ino = st.st_ino; } -@@ -374,12 +498,25 @@ PIDQ_HEAD *pidof(char *prog) +@@ -374,12 +508,25 @@ PIDQ_HEAD *pidof(char *prog) PIDQ_HEAD *q; struct stat st; char *s; @@ -238,7 +248,7 @@ /* Get basename of program. */ if ((s = strrchr(prog, '/')) == NULL) -@@ -393,10 +530,30 @@ PIDQ_HEAD *pidof(char *prog) +@@ -393,10 +540,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) { @@ -273,7 +283,7 @@ } } -@@ -428,7 +585,7 @@ PIDQ_HEAD *pidof(char *prog) +@@ -428,7 +595,7 @@ PIDQ_HEAD *pidof(char *prog) if (ok) add_pid_to_q(q, p); } @@ -282,7 +292,7 @@ } /* Give usage message and exit. */ -@@ -477,6 +634,9 @@ int main_pidof(int argc, char **argv) +@@ -477,6 +644,9 @@ int main_pidof(int argc, char **argv) int first = 1; int i, oind, opt, flags = 0; @@ -292,7 +302,7 @@ for (oind = PIDOF_OMITSZ-1; oind > 0; oind--) opid[oind] = 0; opterr = 0; -@@ -561,6 +721,7 @@ int main(int argc, char **argv) +@@ -561,6 +731,7 @@ int main(int argc, char **argv) PROC *p; int pid, sid = -1; int sig = SIGKILL; @@ -300,7 +310,7 @@ /* Get program name. */ if ((progname = strrchr(argv[0], '/')) == NULL) -@@ -583,7 +744,10 @@ int main(int argc, char **argv) +@@ -583,7 +754,10 @@ int main(int argc, char **argv) } /* First get the /proc filesystem online. */ @@ -312,7 +322,7 @@ /* * Ignoring SIGKILL and SIGSTOP do not make sense, but -@@ -608,9 +772,13 @@ int main(int argc, char **argv) +@@ -608,9 +782,13 @@ int main(int argc, char **argv) /* Now kill all processes except our session. */ sid = (int)getsid(0); pid = (int)getpid(); diff --git a/sysvinit.changes b/sysvinit.changes index edd21f9..7c86215 100644 --- a/sysvinit.changes +++ b/sysvinit.changes @@ -1,3 +1,13 @@ +------------------------------------------------------------------- +Wed Oct 1 17:43:52 CEST 2008 - ro@suse.de + +- fix fuse_kill patch so that it does not break pidof + +------------------------------------------------------------------- +Wed Oct 1 16:39:27 CEST 2008 - werner@suse.de + +- Avoid stat(2) for all network based file systems (bnc#409011) + ------------------------------------------------------------------- Wed Sep 17 14:06:04 CEST 2008 - uli@suse.de diff --git a/sysvinit.spec b/sysvinit.spec index 3f47bdc..de28bfa 100644 --- a/sysvinit.spec +++ b/sysvinit.spec @@ -30,7 +30,7 @@ Group: System/Base PreReq: coreutils AutoReqProv: on Version: 2.86 -Release: 183 +Release: 184 Summary: SysV-Style init BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: libselinux-devel libsepol-devel @@ -317,6 +317,10 @@ rm -rf ${RPM_BUILD_ROOT} %doc %{_mandir}/man8/startpar.8.gz %changelog +* Wed Oct 01 2008 ro@suse.de +- fix fuse_kill patch so that it does not break pidof +* Wed Oct 01 2008 werner@suse.de +- Avoid stat(2) for all network based file systems (bnc#409011) * Wed Sep 17 2008 uli@suse.de - killall5: don't kill FUSE filesystems (Debian bug #476698) * Mon Sep 15 2008 ro@suse.de