[OE-core] [RFC][PATCH] sysvinit: make pidof usuable in a standalone setting

Phil Blundell pb at pbcl.net
Tue May 31 09:27:22 UTC 2011


On Sat, 2011-05-28 at 13:21 +0200, Koen Kooi wrote:
> The alternative is to just move 'killall5' into the pidof subpackage and to RDPEPENDS_${PN} += "${PN}-pidof"

I think I like that better.  Duplicating the binary doesn't sound very
desirable.

For what it's worth, also note that:

- busybox provides an implementation of pidof too, which might be worth
considering if you aren't otherwise using sysvinit; and

- it would be fairly trivial to implement pidof as a standalone shell
script.  As a starting point, something like:

#!/bin/sh
p="($1)"
cd /proc
out=
for i in [0123456789]*/stat; do
  read a b c < $i
  if [ $p = $b ]; then
    out="`dirname $i` $out"
  fi
done
echo $out

gives you the basic behaviour of "pidof <name>".

p.






More information about the Openembedded-core mailing list