[Toybox] [PATCH] newtoy: kill

Rob Landley rob at landley.net
Sun Feb 26 11:48:39 PST 2012


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

 1330285719.0


More information about the Toybox mailing list