summaryrefslogtreecommitdiff
path: root/procps/kill.c
diff options
context:
space:
mode:
authorDenis Vlasenko2006-11-05 00:43:51 +0000
committerDenis Vlasenko2006-11-05 00:43:51 +0000
commit459e4d6cf77940977a064edab60c7162731554fb (patch)
tree5deb7d2b82c280440761cceb4281738867d5631a /procps/kill.c
parentfa07680091d20f9da1f8fa2c145dd92b5d62ae09 (diff)
downloadbusybox-459e4d6cf77940977a064edab60c7162731554fb.zip
busybox-459e4d6cf77940977a064edab60c7162731554fb.tar.gz
replace /proc scanning code by more versatile one.
Use it where appropriate. Stop scanning /etc/passwd *for every process*!!! (uid->username) top: reduce memory usage - we won't save unneeded fields from /proc info anymore. Downside: ~+250 bytes of code
Diffstat (limited to 'procps/kill.c')
-rw-r--r--procps/kill.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/procps/kill.c b/procps/kill.c
index 9b96b4c..18121f0 100644
--- a/procps/kill.c
+++ b/procps/kill.c
@@ -82,7 +82,7 @@ do_it_now:
if (killall5) {
pid_t sid;
- procps_status_t* p;
+ procps_status_t* p = NULL;
// Cannot happen anyway? We don't TERM ourself, we STOP
// /* kill(-1, sig) on Linux (at least 2.1.x)
@@ -94,8 +94,8 @@ do_it_now:
pid = getpid();
sid = getsid(pid);
/* Now kill all processes except our session */
- while ((p = procps_scan(0))!=0) {
- if (getsid(p->pid)!=sid && p->pid!=pid && p->pid!=1)
+ while ((p = procps_scan(p, PSSCAN_PID|PSSCAN_SID))) {
+ if (p->sid != sid && p->pid != pid && p->pid != 1)
kill(p->pid, signo);
}
/* And let them continue */