[Toybox] [PATCH] killall should kill scripts too.

Rob Landley rob at landley.net
Tue Dec 19 14:35:50 PST 2017



On 12/18/2017 11:15 PM, enh wrote:
> On Mon, Dec 18, 2017 at 5:07 PM, enh <enh at google.com> wrote:
>>> Having killall need to do similar grinding over a large number of
>>> processes seems unnecessary. That said, it looks like to match ubuntu's
>>> killall we would need to read two files _and_ stat /proc/$$/exe.
>>
>> that's still a lot lighter weight than all the work pgrep/pkill have
>> to do, and it's what everyone's already living with anyway...
> 
> (and toybox lsof is still 10x faster than FSF lsof on my machines.

$ sleep 999 > test3 &
$ time lsof test3
COMMAND   PID    USER   FD   TYPE DEVICE SIZE/OFF     NODE NAME
sleep   31117 landley    1w   REG    8,1        0 11944128 test3

real	0m3.134s
user	0m0.988s
sys	0m2.084s
$ time ./lsof ../toy3/test3
COMMAND     PID       USER   FD      TYPE             DEVICE  SIZE/OFF
    NODE NAME
sleep     31117    landley    1w      REG                8,1         0
11944128 /home/landley/toybox/toy3/test3

real	0m3.279s
user	0m1.032s
sys	0m2.000s

$ ps ax |wc
    376    3041   98906

Same 3 seconds to iterate over 376 processes in the simple case. (lsof
-i takes 6 seconds, toybox doesn't have -i yet...)

> don't think lsof is high on the list of things to worry about. even
> for top, i'm more worried about the fact that it crashes if you leave
> it running long enough, or the broken ps -AT...)

I have a tab open for ps -AT, but I thought I'd gotten all the ps/top
crashes out of the way? Is that still a thing?

Rob



More information about the Toybox mailing list