#! /bin/sh /usr/share/dpatch/dpatch-run ## 84-killall_no_stat.patch.dpatch by ## ## All lines beginning with `## DP:' are a description of the patch. ## DP: No description. @DPATCH@ diff -urNad sysvinit-2.86.ds1~/src/killall5.c sysvinit-2.86.ds1/src/killall5.c --- sysvinit-2.86.ds1~/src/killall5.c 2008-04-18 13:29:03.090299248 +0200 +++ sysvinit-2.86.ds1/src/killall5.c 2008-04-18 13:29:45.899768395 +0200 @@ -40,10 +40,13 @@ #include #include #include +#include char *Version = "@(#)killall5 2.86 31-Jul-2004 miquels@cistron.nl"; #define STATNAMELEN 15 +#define DO_STAT 1 +#define NO_STAT 0 /* Info about a process. */ typedef struct proc { @@ -166,7 +169,7 @@ /* * Read the proc filesystem. */ -int readproc() +int readproc(int do_stat) { DIR *dir; FILE *fp; @@ -306,7 +309,7 @@ /* Try to stat the executable. */ snprintf(path, sizeof(path), "/proc/%s/exe", d->d_name); - if (stat(path, &st) == 0) { + if (do_stat && stat(path, &st) == 0) { p->dev = st.st_dev; p->ino = st.st_ino; } @@ -546,7 +549,7 @@ argv += optind; /* Print out process-ID's one by one. */ - readproc(); + readproc(DO_STAT); for(f = 0; f < argc; f++) { if ((q = pidof(argv[f])) != NULL) { spid = 0; @@ -626,12 +629,15 @@ signal(SIGSTOP, SIG_IGN); signal(SIGKILL, SIG_IGN); + /* lock us into memory */ + mlockall(MCL_CURRENT | MCL_FUTURE); + /* Now stop all processes. */ kill(-1, SIGSTOP); sent_sigstop = 1; /* Read /proc filesystem */ - if (readproc() < 0) { + if (readproc(NO_STAT) < 0) { kill(-1, SIGCONT); return(1); } diff -urNad sysvinit-2.86.ds1~/src/killall5.c.rej sysvinit-2.86.ds1/src/killall5.c.rej --- sysvinit-2.86.ds1~/src/killall5.c.rej 1970-01-01 01:00:00.000000000 +0100 +++ sysvinit-2.86.ds1/src/killall5.c.rej 2008-04-18 13:29:03.207281402 +0200 @@ -0,0 +1,17 @@ +*************** +*** 49,54 **** + + #define FALSE 0 + #define TRUE 1 + + /* Info about a process. */ + typedef struct proc { +--- 50,57 ---- + + #define FALSE 0 + #define TRUE 1 ++ #define DO_STAT 1 ++ #define NO_STAT 0 + + /* Info about a process. */ + typedef struct proc {