[Toybox] [PATCH] newtoy: kill

Daniel Walter d.walter at 0x90.at
Mon Feb 27 03:03:46 PST 2012


On Sun, Feb 26, 2012 at 01:48:39PM -0600, Rob Landley wrote:
> On 02/22/2012 09:56 AM, Daniel Walter wrote:
> > On Tue, Feb 21, 2012 at 07:46:44PM -0600, Rob Landley wrote:
> >> On 02/19/2012 10:55 AM, Daniel Walter wrote:
> >>> Hi,
> >>>
> >>> I've implemented a SUS compliant kill command.
> >>>
> >>> Comments and suggestions are welcome.
> >>
> >> Cool.
> >>
> >> I note that "killall" already has about half this infrastructure.  And
> >> you're not using any of toybox's option parsing code:
> >>
> >>   http://landley.net/toybox/code.html#lib_args
> >>
> >> Also, kill needs to be able to integrate with the shell's job support,
> >> so you can kill a background job.  I'm not sure how to handle that, the
> >> relevant shell bits haven't been written yet...
> >>
> >> That said, I can merge this, factor out the common killall and option
> >> parsing bits, and then worry about shell integration later.
> >>
> >> Thanks,
> >>
> >> Rob
> > 
> > I wrote kill just before killall was pushed into your repo, so some code 
> > is duplicated.
> > 
> > I did try to use lib_args but I ran into multiple problems when trying to
> > use it and allow -HUP or any other -SIGNALNAME, so I gave up and did it
> > the way I submitted it. 
> 
> Gah!
> 
> I've _almost_ got it working with the lib/args.c stuff, and I hit this:
> 
>   kill -stop 123 8walrus 456
> 
> It should sent SIGSTOP to 123 and 456, and complain that 8walrus isn't a
> valid PID name, and it_almost_ does, except:
> 
>   kill: Unknown signal 'top'
> 
> Why, do you ask, is it doing this?
> 
>   kill -s top
> 
> GAAAAHHHH!!!!
> 
> (Because "make -j 3" and "make -j3" are synonymous.  I thought making
> "echo -nex" work right covered most of the interesting cases, but no...)
> 
> Let's see...
> 
> landley at brillig:~/toybox/toybox$ sleep 500 &
> [1] 11541
> landley at brillig:~/toybox/toybox$ kill -scont 11541
> bash: kill: scont: invalid signal specification
> landley at brillig:~/toybox/toybox$ kill -sCONT 11541
> bash: kill: sCONT: invalid signal specification
> landley at brillig:~/toybox/toybox$
> 
> Ok, it's not a case sensitivity issue, and it's not a "scan for known
> -signal names first" issue. I actually _do_ have to teach lib/args.c
> about strings that _must_ be a separate argument.
> 
> Sigh. I'll check in what I have, and then I need to fix this...
> 
> Rob
hi,

yeah, all this stuff were my main reason not to use lib/args ;)

did you try how it all behaves if you try to do something like this

kill -HUP -1140 -1141 4490
or 
kill -9 -1

both are perfectly legal, but I had no chance to get them working with
lib/args

regards,
daniel

 1330340626.0


More information about the Toybox mailing list