path: toybox_0.8.9+dfsg-1.1/tests/pidof.test chmod a+x pidof-$$.test cp pidof-$$.test toybox.pidof-$$.test.script (./pidof-$$.test & echo $! > pid.txt) pid=$(cat pid.txt) testcmd "short argv[1]" "pidof-$$.test" "" "" "" path: toybox_0.8.9+dfsg-1.1/tests/pidof.test # echo -e "#!$(which sh)\nread i < /proc/self/fd/1" > pidof-$$.test chmod a+x pidof-$$.test cp pidof-$$.test toybox.pidof-$$.test.script path: toybox_0.8.9+dfsg-1.1/tests/pidof.test echo -e "#!$(which sh)\nread i < /proc/self/fd/1" > pidof-$$.test chmod a+x pidof-$$.test cp pidof-$$.test toybox.pidof-$$.test.script (./pidof-$$.test & echo $! > pid.txt) path: toybox_0.8.9+dfsg-1.1/tests/pidof.test # # pidof (unlike killall) doesn't match argv[1] unless you supply -x. # path: toybox_0.8.9+dfsg-1.1/tests/pidof.test kill $pid (./toybox.pidof-$$.test.script & echo $! > pid.txt) pid=$(cat pid.txt) testcmd "long argv[1]" "toybox.pidof-$$.test.script" "" "" "" path: toybox_0.8.9+dfsg-1.1/tests/pidof.test (./toybox.pidof-$$.test.script & echo $! > pid.txt) pid=$(cat pid.txt) testcmd "long argv[1]" "toybox.pidof-$$.test.script" "" "" "" testcmd "long argv[1] -x" "-x toybox.pidof-$$.test.script" "$pid\n" "" "" kill $pid path: toybox_0.8.9+dfsg-1.1/tests/pidof.test pid=$(cat pid.txt) testcmd "short argv[1]" "pidof-$$.test" "" "" "" testcmd "short argv[1] -x" "-x pidof-$$.test" "$pid\n" "" "" kill $pid path: toybox_0.8.9+dfsg-1.1/tests/pidof.test pid=$(cat pid.txt) testcmd "long argv[1]" "toybox.pidof-$$.test.script" "" "" "" testcmd "long argv[1] -x" "-x toybox.pidof-$$.test.script" "$pid\n" "" "" kill $pid path: toybox_0.8.9+dfsg-1.1/tests/pidof.test echo -e "#!$(which sh)\nread i < /proc/self/fd/1" > pidof-$$.test chmod a+x pidof-$$.test cp pidof-$$.test toybox.pidof-$$.test.script (./pidof-$$.test & echo $! > pid.txt) pid=$(cat pid.txt) path: toybox_0.8.9+dfsg-1.1/tests/pidof.test rm -f toybox.pidof-$$.test.script pidof-$$.test pid.txt # pidof (unlike killall) will match itself. testcmd "pidof pidof" "pidof > /dev/null && echo found" "found\n" "" "" path: toybox_0.8.9+dfsg-1.1/tests/pidof.test (./pidof-$$.test & echo $! > pid.txt) pid=$(cat pid.txt) testcmd "short argv[1]" "pidof-$$.test" "" "" "" testcmd "short argv[1] -x" "-x pidof-$$.test" "$pid\n" "" "" kill $pid path: toybox_0.8.9+dfsg-1.1/tests/pidof.test kill $pid rm -f toybox.pidof-$$.test.script pidof-$$.test pid.txt # pidof (unlike killall) will match itself. path: toybox_0.8.9+dfsg-1.1/tests/pidof.test # pidof (unlike killall) will match itself. testcmd "pidof pidof" "pidof > /dev/null && echo found" "found\n" "" "" path: toybox_0.8.9+dfsg-1.1/toys/lsb/pidof.c } void pidof_main(void) { toys.exitval = 1; path: toybox_0.8.9+dfsg-1.1/toys/lsb/pidof.c config PIDOF bool "pidof" default y help path: toybox_0.8.9+dfsg-1.1/toys/lsb/pidof.c * http://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/pidof.html USE_PIDOF(NEWTOY(pidof, "so:x", TOYFLAG_BIN)) config PIDOF path: toybox_0.8.9+dfsg-1.1/toys/lsb/pidof.c * Copyright 2012 Elie De Brauwer * * http://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/pidof.html USE_PIDOF(NEWTOY(pidof, "so:x", TOYFLAG_BIN)) path: toybox_0.8.9+dfsg-1.1/toys/lsb/pidof.c default y help usage: pidof [-s] [-o omitpid[,omitpid...]] [NAME...] Print the PIDs of all processes with the given names. path: toybox_0.8.9+dfsg-1.1/toys/lsb/pidof.c /* pidof.c - Print the Process IDs of all processes with the given names. * * Copyright 2012 Andreas Heck path: toybox_0.8.9+dfsg-1.1/toys/lsb/pidof.c */ #define FOR_pidof #include "toys.h"