Patchwork [RFC] sysvinit: make pidof usuable in a standalone setting

login
register
mail settings
Submitter Koen Kooi
Date May 28, 2011, 11:21 a.m.
Message ID <1306581686-17625-1-git-send-email-koen@dominion.thruhere.net>
Download mbox | patch
Permalink /patch/4953/
State New, archived
Headers show

Comments

Koen Kooi - May 28, 2011, 11:21 a.m.
Currently it's a symlink to killall5:

$ dpkg-deb -c sysvinit-pidof_2.88dsf-r1_armv7a.ipk  | grep pidof
lrwxrwxrwx root/root         0 2011-05-27 11:05 ./bin/pidof.sysvinit -> /sbin/killall5

The point of the pidof subpackage was to have a pidof without needing sysvinit, this restores that behaviour. The trade-off is a 14KiB (armv7a, uncompressed) increase in size.

Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
---

The alternative is to just move 'killall5' into the pidof subpackage and to RDPEPENDS_${PN} += "${PN}-pidof"

The change in this patch was the least amounts of edits to the recipe, let me know which way you prefer.

 meta/recipes-core/sysvinit/sysvinit_2.88dsf.bb |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
Koen Kooi - May 30, 2011, 11:45 a.m.
ping

Op 28 mei 2011, om 13:21 heeft Koen Kooi het volgende geschreven:

> Currently it's a symlink to killall5:
> 
> $ dpkg-deb -c sysvinit-pidof_2.88dsf-r1_armv7a.ipk  | grep pidof
> lrwxrwxrwx root/root         0 2011-05-27 11:05 ./bin/pidof.sysvinit -> /sbin/killall5
> 
> The point of the pidof subpackage was to have a pidof without needing sysvinit, this restores that behaviour. The trade-off is a 14KiB (armv7a, uncompressed) increase in size.
> 
> Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
> ---
> 
> The alternative is to just move 'killall5' into the pidof subpackage and to RDPEPENDS_${PN} += "${PN}-pidof"
> 
> The change in this patch was the least amounts of edits to the recipe, let me know which way you prefer.
> 
> meta/recipes-core/sysvinit/sysvinit_2.88dsf.bb |    4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/meta/recipes-core/sysvinit/sysvinit_2.88dsf.bb b/meta/recipes-core/sysvinit/sysvinit_2.88dsf.bb
> index 7d5e936..f0e73bb 100644
> --- a/meta/recipes-core/sysvinit/sysvinit_2.88dsf.bb
> +++ b/meta/recipes-core/sysvinit/sysvinit_2.88dsf.bb
> @@ -5,7 +5,7 @@ SECTION = "base"
> LICENSE = "GPLv2+"
> LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe \
>                     file://COPYRIGHT;endline=15;md5=349c872e0066155e1818b786938876a4"
> -PR = "r1"
> +PR = "r2"
> 
> # USE_VT and SERIAL_CONSOLE are generally defined by the MACHINE .conf.
> # Set PACKAGE_ARCH appropriately.
> @@ -100,7 +100,7 @@ EOF
> 		ln -s ../init.d/stop-bootlogd ${D}${sysconfdir}/rc$level.d/S99stop-bootlogd
> 	done
> 	mv                 ${D}${base_sbindir}/init               ${D}${base_sbindir}/init.${PN}
> -	mv ${D}${base_bindir}/pidof ${D}${base_bindir}/pidof.${PN}
> +	cp ${D}${base_sbindir}/killall5 ${D}${base_bindir}/pidof.${PN}
> 	mv ${D}${base_sbindir}/halt ${D}${base_sbindir}/halt.${PN}
> 	mv ${D}${base_sbindir}/reboot ${D}${base_sbindir}/reboot.${PN}
> 	mv ${D}${base_sbindir}/shutdown ${D}${base_sbindir}/shutdown.${PN}
> -- 
> 1.6.6.1
>
Koen Kooi - May 31, 2011, 8:27 a.m.
No comments at all?

Op 28 mei 2011, om 13:21 heeft Koen Kooi het volgende geschreven:

> Currently it's a symlink to killall5:
> 
> $ dpkg-deb -c sysvinit-pidof_2.88dsf-r1_armv7a.ipk  | grep pidof
> lrwxrwxrwx root/root         0 2011-05-27 11:05 ./bin/pidof.sysvinit -> /sbin/killall5
> 
> The point of the pidof subpackage was to have a pidof without needing sysvinit, this restores that behaviour. The trade-off is a 14KiB (armv7a, uncompressed) increase in size.
> 
> Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
> ---
> 
> The alternative is to just move 'killall5' into the pidof subpackage and to RDPEPENDS_${PN} += "${PN}-pidof"
> 
> The change in this patch was the least amounts of edits to the recipe, let me know which way you prefer.
> 
> meta/recipes-core/sysvinit/sysvinit_2.88dsf.bb |    4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/meta/recipes-core/sysvinit/sysvinit_2.88dsf.bb b/meta/recipes-core/sysvinit/sysvinit_2.88dsf.bb
> index 7d5e936..f0e73bb 100644
> --- a/meta/recipes-core/sysvinit/sysvinit_2.88dsf.bb
> +++ b/meta/recipes-core/sysvinit/sysvinit_2.88dsf.bb
> @@ -5,7 +5,7 @@ SECTION = "base"
> LICENSE = "GPLv2+"
> LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe \
>                     file://COPYRIGHT;endline=15;md5=349c872e0066155e1818b786938876a4"
> -PR = "r1"
> +PR = "r2"
> 
> # USE_VT and SERIAL_CONSOLE are generally defined by the MACHINE .conf.
> # Set PACKAGE_ARCH appropriately.
> @@ -100,7 +100,7 @@ EOF
> 		ln -s ../init.d/stop-bootlogd ${D}${sysconfdir}/rc$level.d/S99stop-bootlogd
> 	done
> 	mv                 ${D}${base_sbindir}/init               ${D}${base_sbindir}/init.${PN}
> -	mv ${D}${base_bindir}/pidof ${D}${base_bindir}/pidof.${PN}
> +	cp ${D}${base_sbindir}/killall5 ${D}${base_bindir}/pidof.${PN}
> 	mv ${D}${base_sbindir}/halt ${D}${base_sbindir}/halt.${PN}
> 	mv ${D}${base_sbindir}/reboot ${D}${base_sbindir}/reboot.${PN}
> 	mv ${D}${base_sbindir}/shutdown ${D}${base_sbindir}/shutdown.${PN}
> -- 
> 1.6.6.1
>
Richard Purdie - May 31, 2011, 8:59 a.m.
On Tue, 2011-05-31 at 10:27 +0200, Koen Kooi wrote:
> No comments at all?

Patience ;-). It was a US/UK holiday yesterday and lots of people have
been taking a long weekend. Personally, whilst I did merge a few things
yesterday, this one didn't look that urgent so its on today's to look at
and reply to list.

> Op 28 mei 2011, om 13:21 heeft Koen Kooi het volgende geschreven:
> 
> > Currently it's a symlink to killall5:
> > 
> > $ dpkg-deb -c sysvinit-pidof_2.88dsf-r1_armv7a.ipk  | grep pidof
> > lrwxrwxrwx root/root         0 2011-05-27 11:05 ./bin/pidof.sysvinit -> /sbin/killall5
> > 
> > The point of the pidof subpackage was to have a pidof without
> needing sysvinit, this restores that behaviour. The trade-off is a
> 14KiB (armv7a, uncompressed) increase in size.
> > 
> > Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
> > ---
> > 
> > The alternative is to just move 'killall5' into the pidof subpackage and to RDPEPENDS_${PN} += "${PN}-pidof"

I think I prefer the alternative to duplicating binaries...

Cheers,

Richard

> > The change in this patch was the least amounts of edits to the recipe, let me know which way you prefer.
> > 
> > meta/recipes-core/sysvinit/sysvinit_2.88dsf.bb |    4 ++--
> > 1 files changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/meta/recipes-core/sysvinit/sysvinit_2.88dsf.bb b/meta/recipes-core/sysvinit/sysvinit_2.88dsf.bb
> > index 7d5e936..f0e73bb 100644
> > --- a/meta/recipes-core/sysvinit/sysvinit_2.88dsf.bb
> > +++ b/meta/recipes-core/sysvinit/sysvinit_2.88dsf.bb
> > @@ -5,7 +5,7 @@ SECTION = "base"
> > LICENSE = "GPLv2+"
> > LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe \
> >                     file://COPYRIGHT;endline=15;md5=349c872e0066155e1818b786938876a4"
> > -PR = "r1"
> > +PR = "r2"
> > 
> > # USE_VT and SERIAL_CONSOLE are generally defined by the MACHINE .conf.
> > # Set PACKAGE_ARCH appropriately.
> > @@ -100,7 +100,7 @@ EOF
> > 		ln -s ../init.d/stop-bootlogd ${D}${sysconfdir}/rc$level.d/S99stop-bootlogd
> > 	done
> > 	mv                 ${D}${base_sbindir}/init               ${D}${base_sbindir}/init.${PN}
> > -	mv ${D}${base_bindir}/pidof ${D}${base_bindir}/pidof.${PN}
> > +	cp ${D}${base_sbindir}/killall5 ${D}${base_bindir}/pidof.${PN}
> > 	mv ${D}${base_sbindir}/halt ${D}${base_sbindir}/halt.${PN}
> > 	mv ${D}${base_sbindir}/reboot ${D}${base_sbindir}/reboot.${PN}
> > 	mv ${D}${base_sbindir}/shutdown ${D}${base_sbindir}/shutdown.${PN}
> > -- 
> > 1.6.6.1
> > 
> 
> 
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
Phil Blundell - May 31, 2011, 9:27 a.m.
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.

Patch

diff --git a/meta/recipes-core/sysvinit/sysvinit_2.88dsf.bb b/meta/recipes-core/sysvinit/sysvinit_2.88dsf.bb
index 7d5e936..f0e73bb 100644
--- a/meta/recipes-core/sysvinit/sysvinit_2.88dsf.bb
+++ b/meta/recipes-core/sysvinit/sysvinit_2.88dsf.bb
@@ -5,7 +5,7 @@  SECTION = "base"
 LICENSE = "GPLv2+"
 LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe \
                     file://COPYRIGHT;endline=15;md5=349c872e0066155e1818b786938876a4"
-PR = "r1"
+PR = "r2"
 
 # USE_VT and SERIAL_CONSOLE are generally defined by the MACHINE .conf.
 # Set PACKAGE_ARCH appropriately.
@@ -100,7 +100,7 @@  EOF
 		ln -s ../init.d/stop-bootlogd ${D}${sysconfdir}/rc$level.d/S99stop-bootlogd
 	done
 	mv                 ${D}${base_sbindir}/init               ${D}${base_sbindir}/init.${PN}
-	mv ${D}${base_bindir}/pidof ${D}${base_bindir}/pidof.${PN}
+	cp ${D}${base_sbindir}/killall5 ${D}${base_bindir}/pidof.${PN}
 	mv ${D}${base_sbindir}/halt ${D}${base_sbindir}/halt.${PN}
 	mv ${D}${base_sbindir}/reboot ${D}${base_sbindir}/reboot.${PN}
 	mv ${D}${base_sbindir}/shutdown ${D}${base_sbindir}/shutdown.${PN}