OBS User unknown 2008-10-01 16:03:48 +00:00 committed by Git OBS Bridge
parent 9610de7f12
commit ec091fc303
4 changed files with 61 additions and 25 deletions

View File

@ -1,6 +1,6 @@
--- src/killall5.c --- src/killall5.c
+++ src/killall5.c +++ src/killall5.c
@@ -274,6 +274,7 @@ @@ -284,6 +284,7 @@
/* /*
* Read the proc filesystem. * Read the proc filesystem.
@ -8,7 +8,7 @@
*/ */
int readproc() int readproc()
{ {
@@ -289,7 +290,7 @@ @@ -299,7 +300,7 @@
int pid, f; int pid, f;
/* Open the /proc directory. */ /* Open the /proc directory. */
@ -17,7 +17,7 @@
nsyslog(LOG_ERR, "cannot opendir(/proc)"); nsyslog(LOG_ERR, "cannot opendir(/proc)");
return -1; return -1;
} }
@@ -316,10 +317,10 @@ @@ -326,10 +327,10 @@
memset(p, 0, sizeof(PROC)); memset(p, 0, sizeof(PROC));
/* Open the status file. */ /* Open the status file. */
@ -30,7 +30,7 @@
buf[0] = 0; buf[0] = 0;
fgets(buf, sizeof(buf), fp); fgets(buf, sizeof(buf), fp);
@@ -333,7 +334,7 @@ @@ -343,7 +344,7 @@
if (q == NULL) { if (q == NULL) {
p->sid = 0; p->sid = 0;
nsyslog(LOG_ERR, nsyslog(LOG_ERR,
@ -39,7 +39,7 @@
path); path);
if (p->argv0) free(p->argv0); if (p->argv0) free(p->argv0);
if (p->argv1) free(p->argv1); if (p->argv1) free(p->argv1);
@@ -379,7 +380,7 @@ @@ -389,7 +390,7 @@
continue; continue;
} }
@ -48,7 +48,7 @@
if ((fp = fopen(path, "r")) != NULL) { if ((fp = fopen(path, "r")) != NULL) {
/* Now read argv[0] */ /* Now read argv[0] */
@@ -446,6 +447,39 @@ @@ -456,6 +457,39 @@
return 0; return 0;
} }
@ -88,7 +88,19 @@
PIDQ_HEAD *init_pid_q(PIDQ_HEAD *q) PIDQ_HEAD *init_pid_q(PIDQ_HEAD *q)
{ {
q->head = q->next = q->tail = NULL; 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? */ /* Which NFS partitions are online? */
init_nfs(); init_nfs();
@ -100,7 +112,7 @@
/* /*
* Ignoring SIGKILL and SIGSTOP do not make sense, but * Ignoring SIGKILL and SIGSTOP do not make sense, but
* someday kill(-1, sig) might kill ourself if we don't * someday kill(-1, sig) might kill ourself if we don't
@@ -769,11 +808,12 @@ @@ -779,11 +823,12 @@
exit(1); exit(1);
} }

View File

@ -1,5 +1,5 @@
--- src/killall5.c --- 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 @@ @@ -40,6 +40,8 @@
#include <syslog.h> #include <syslog.h>
#include <getopt.h> #include <getopt.h>
@ -40,10 +40,20 @@
/* Did we stop all processes ? */ /* Did we stop all processes ? */
int sent_sigstop; int sent_sigstop;
@@ -152,6 +166,101 @@ int mount_proc(void) @@ -152,6 +166,111 @@ int mount_proc(void)
return did_mount; 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. + * Remember all NFS typed partitions.
+ */ + */
@ -61,7 +71,7 @@
+ return; + return;
+ +
+ while ((ent = getmntent(mnt))) { + while ((ent = getmntent(mnt))) {
+ if (!strcasecmp(MNTTYPE_NFS, ent->mnt_type)) { + if (isnetfs(ent->mnt_type)) {
+ NFS * p = (NFS*)xmalloc(sizeof(NFS)); + NFS * p = (NFS*)xmalloc(sizeof(NFS));
+ p->name = (char*)xmalloc(strlen(ent->mnt_dir)+1); + p->name = (char*)xmalloc(strlen(ent->mnt_dir)+1);
+ strcpy(p->name, ent->mnt_dir); + strcpy(p->name, ent->mnt_dir);
@ -142,7 +152,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 +282,8 @@ int readproc() @@ -173,8 +292,8 @@ int readproc()
PROC *p, *n; PROC *p, *n;
struct dirent *d; struct dirent *d;
struct stat st; struct stat st;
@ -153,7 +163,7 @@
char *s, *q; char *s, *q;
unsigned long startcode, endcode; unsigned long startcode, endcode;
int pid, f; int pid, f;
@@ -191,6 +300,7 @@ int readproc() @@ -191,6 +310,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);
@ -161,7 +171,7 @@
free(p); free(p);
} }
plist = NULL; plist = NULL;
@@ -225,6 +335,9 @@ int readproc() @@ -225,6 +345,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);
@ -171,7 +181,7 @@
free(p); free(p);
continue; continue;
} }
@@ -248,6 +361,9 @@ int readproc() @@ -248,6 +371,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);
@ -181,7 +191,7 @@
free(p); free(p);
continue; continue;
} }
@@ -256,6 +372,9 @@ int readproc() @@ -256,6 +382,9 @@ int readproc()
fclose(fp); fclose(fp);
} else { } else {
/* Process disappeared.. */ /* Process disappeared.. */
@ -191,7 +201,7 @@
free(p); free(p);
continue; continue;
} }
@@ -300,13 +419,18 @@ int readproc() @@ -300,13 +429,18 @@ int readproc()
} else { } else {
/* Process disappeared.. */ /* Process disappeared.. */
@ -211,7 +221,7 @@
p->dev = st.st_dev; p->dev = st.st_dev;
p->ino = st.st_ino; 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; PIDQ_HEAD *q;
struct stat st; struct stat st;
char *s; char *s;
@ -238,7 +248,7 @@
/* Get basename of program. */ /* Get basename of program. */
if ((s = strrchr(prog, '/')) == NULL) 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. */ /* 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) {
@ -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); if (ok) add_pid_to_q(q, p);
} }
@ -282,7 +292,7 @@
} }
/* Give usage message and exit. */ /* 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 first = 1;
int i, oind, opt, flags = 0; int i, oind, opt, flags = 0;
@ -292,7 +302,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 +721,7 @@ int main(int argc, char **argv) @@ -561,6 +731,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;
@ -300,7 +310,7 @@
/* Get program name. */ /* Get program name. */
if ((progname = strrchr(argv[0], '/')) == NULL) 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. */ /* First get the /proc filesystem online. */
@ -312,7 +322,7 @@
/* /*
* Ignoring SIGKILL and SIGSTOP do not make sense, but * 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. */ /* 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,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 Wed Sep 17 14:06:04 CEST 2008 - uli@suse.de

View File

@ -30,7 +30,7 @@ Group: System/Base
PreReq: coreutils PreReq: coreutils
AutoReqProv: on AutoReqProv: on
Version: 2.86 Version: 2.86
Release: 183 Release: 184
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
@ -317,6 +317,10 @@ rm -rf ${RPM_BUILD_ROOT}
%doc %{_mandir}/man8/startpar.8.gz %doc %{_mandir}/man8/startpar.8.gz
%changelog %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 * Wed Sep 17 2008 uli@suse.de
- killall5: don't kill FUSE filesystems (Debian bug #476698) - killall5: don't kill FUSE filesystems (Debian bug #476698)
* Mon Sep 15 2008 ro@suse.de * Mon Sep 15 2008 ro@suse.de