[Toybox] Fix, killall is not allowed to kill itself

Rob Landley rob at landley.net
Mon Dec 17 00:57:39 PST 2012


On 12/16/2012 11:31:49 AM, David Seikel wrote:
> On Sun, 16 Dec 2012 16:54:24 +0100 Elie De Brauwer
> <eliedebrauwer at gmail.com> wrote:
> 
> > The LSB specification of killall says "A killall process never kills
> > itself (but may kill other killall processes)."
> >
> > The current implementation of killall does not adhere to this rule,
> > with the patch in attach killall will adhere to this rule.
> >
> > Before:
> > edb at lapedb:~/edb-stuff/toybox/toybox$ ./toybox killall -9 toybox
> > Killed
> >
> > After:
> > edb at lapedb:~/edb-stuff/toybox/toybox$ ./toybox killall -9 toybox
> > killall: No such process
> 
> It's 3AM and way past my bed time, but after it's run out of things to
> kill, it just kills itself.  Seems pointless to not allow suicide on
> something that will just suicide anyway, but I need sleep.
> 
> Like rm'ing something that does not exist, the end result is the same,
> except for the useless error.  The thing does not exist, killall is no
> longer running.  The error message is superfluous, as the result you
> wanted is exactly what you get.

I think the objection is that PIDs aren't monotonic (the PID namespace  
wraps), so if you kill things in increasing PID order this killall  
instance isn't guaranteed to be last so it won't necessarily kill  
everything it should.

Rob
 1355734659.0


More information about the Toybox mailing list