diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2006-11-05 00:43:51 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2006-11-05 00:43:51 +0000 |
commit | 459e4d6cf77940977a064edab60c7162731554fb (patch) | |
tree | 5deb7d2b82c280440761cceb4281738867d5631a /procps/kill.c | |
parent | fa07680091d20f9da1f8fa2c145dd92b5d62ae09 (diff) | |
download | busybox-w32-459e4d6cf77940977a064edab60c7162731554fb.tar.gz busybox-w32-459e4d6cf77940977a064edab60c7162731554fb.tar.bz2 busybox-w32-459e4d6cf77940977a064edab60c7162731554fb.zip |
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.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/procps/kill.c b/procps/kill.c index 9b96b4c1a..18121f06f 100644 --- a/procps/kill.c +++ b/procps/kill.c | |||
@@ -82,7 +82,7 @@ do_it_now: | |||
82 | 82 | ||
83 | if (killall5) { | 83 | if (killall5) { |
84 | pid_t sid; | 84 | pid_t sid; |
85 | procps_status_t* p; | 85 | procps_status_t* p = NULL; |
86 | 86 | ||
87 | // Cannot happen anyway? We don't TERM ourself, we STOP | 87 | // Cannot happen anyway? We don't TERM ourself, we STOP |
88 | // /* kill(-1, sig) on Linux (at least 2.1.x) | 88 | // /* kill(-1, sig) on Linux (at least 2.1.x) |
@@ -94,8 +94,8 @@ do_it_now: | |||
94 | pid = getpid(); | 94 | pid = getpid(); |
95 | sid = getsid(pid); | 95 | sid = getsid(pid); |
96 | /* Now kill all processes except our session */ | 96 | /* Now kill all processes except our session */ |
97 | while ((p = procps_scan(0))!=0) { | 97 | while ((p = procps_scan(p, PSSCAN_PID|PSSCAN_SID))) { |
98 | if (getsid(p->pid)!=sid && p->pid!=pid && p->pid!=1) | 98 | if (p->sid != sid && p->pid != pid && p->pid != 1) |
99 | kill(p->pid, signo); | 99 | kill(p->pid, signo); |
100 | } | 100 | } |
101 | /* And let them continue */ | 101 | /* And let them continue */ |