[Toybox] Pidof extensions, -s and -o options.

Elie De Brauwer eliedebrauwer at gmail.com
Sat Dec 8 11:18:23 PST 2012


Hello all,

Toybox currently has the pidof command, but it lacks the -s (single 
shot) and -o (omit pid) options. I've added these in the patch in 
attach. A short demo:

$ ./toybox pidof bash
383 511 643 771 907 1047 1409 1637 1933 2069 3934 3958 5168 5704 6476 
6968 7072 7347 7594 7837 8404 12553 13804 19662 26146 28619 28798 29596 
29845 29858 29983 32088 32414 32571 32737

$ ./toybox pidof -s bash
383
$ ./toybox pidof -o 383,511,6,64,43,32737 bash
643 771 907 1047 1409 1637 1933 2069 3934 3958 5168 5704 6476 6968 7072 
7347 7594 7837 8404 12553 13804 19662 26146 28619 28798 29596 29845 
29858 29983 32088 32414 32571

(Observe first, second and last entry are gone but 643 is still present).

Both together:
$ ./toybox pidof -s -o 383,511,6,64,43,32737 bash
643

Both these options are present in the LSB specification ( 
http://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/pidof.html 
) only comment there is that the document specifies -o as "[-o 
omitpid...]" while man 8 pidof on my box allows "[-o 
omitpid[,omitpid..]]  [-o omitpid[,omit‐pid..]..]" while I implemented 
it as a single [-o omitpid[,omitpid..]..].

my 2 cents
E.



-- 
Elie De Brauwer

-------------- next part --------------
A non-text attachment was scrubbed...
Name: pidof_extensions.patch
Type: text/x-patch
Size: 3554 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20121208/9a862828/attachment-0006.bin>


More information about the Toybox mailing list