[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openembedded-core
Subject:    [OE-core] [RFC][PATCH] sysvinit: make pidof usuable in a standalone setting
From:       pb () pbcl ! net (Phil Blundell)
Date:       2011-05-31 9:27:22
Message-ID: 1306834042.2525.477.camel () phil-desktop
[Download RAW message or body]

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.


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic