public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
From: "Khem Raj" <raj.khem@gmail.com>
To: Andre McCurdy <armccurdy@gmail.com>
Cc: OE Core mailing list <openembedded-core@lists.openembedded.org>
Subject: Re: [OE-core] [PATCH 3/4] busybox: Run mdev as daemon
Date: Fri, 18 Dec 2020 08:33:42 -0800	[thread overview]
Message-ID: <84681f38-9023-1c0c-7e68-582307f2e63c@gmail.com> (raw)
In-Reply-To: <CAJ86T=XE6Woyb7-yXKyQpGi+CqqZOc2PK9vkyBVZypiLa69_dw@mail.gmail.com>



On 12/17/20 10:07 PM, Andre McCurdy wrote:
> On Thu, Dec 17, 2020 at 7:52 PM Khem Raj <raj.khem@gmail.com> wrote:
>>
>> On Thu, Dec 17, 2020 at 3:59 PM Andre McCurdy <armccurdy@gmail.com> wrote:
>>>
>>> On Thu, Dec 17, 2020 at 2:54 PM Khem Raj <raj.khem@gmail.com> wrote:
>>>>
>>>> When busybox is used for device management, kernel needs to support
>>>> older/obsolete mechanism via CONFIG_UEVENT_HELPER and
>>>> CONFIG_UEVENT_HELPER_PATH to enable /proc/sys/kernel/hotplug but this
>>>> would require kernel defconfig change and will always be needed when
>>>> mdev is used, intead run it in daemon mode
>>>>
>>>> Update mdev init script to run mdev in daemon mode
>>>>
>>>> Signed-off-by: Khem Raj <raj.khem@gmail.com>
>>>> ---
>>>>   meta/recipes-core/busybox/busybox/mdev.cfg |  2 +
>>>>   meta/recipes-core/busybox/files/mdev       | 56 +++++++++++++++-------
>>>>   2 files changed, 41 insertions(+), 17 deletions(-)
>>>>
>>>> diff --git a/meta/recipes-core/busybox/busybox/mdev.cfg b/meta/recipes-core/busybox/busybox/mdev.cfg
>>>> index 6aefe90e43..143e6097cb 100644
>>>> --- a/meta/recipes-core/busybox/busybox/mdev.cfg
>>>> +++ b/meta/recipes-core/busybox/busybox/mdev.cfg
>>>> @@ -9,3 +9,5 @@ CONFIG_SETSID=y
>>>>   CONFIG_CTTYHACK=y
>>>>
>>>>   CONFIG_FEATURE_SHADOWPASSWDS=y
>>>> +CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM=y
>>>> +CONFIG_FEATURE_MDEV_DAEMON=y
>>>> diff --git a/meta/recipes-core/busybox/files/mdev b/meta/recipes-core/busybox/files/mdev
>>>> index 8c9c06e96c..2fbdfb073e 100755
>>>> --- a/meta/recipes-core/busybox/files/mdev
>>>> +++ b/meta/recipes-core/busybox/files/mdev
>>>> @@ -1,21 +1,43 @@
>>>>   #!/bin/sh
>>>> -mount -t proc proc /proc
>>>> -mount -t sysfs sysfs /sys
>>>> -mount -t tmpfs tmpfs /dev  -o size=64k,mode=0755
>>>> -mkdir /dev/pts /dev/shm
>>>> -chmod 777 /dev/shm
>>>> -mount -t devpts devpts /dev/pts
>>>> -touch /dev/mdev.seq
>>>> -#sysctl -w kernel.hotplug=/sbin/mdev
>>>> -echo "/sbin/mdev" > /proc/sys/kernel/hotplug
>>>> -mdev -s
>>>> -
>>>>   #
>>>> -# We might have mounted something over /dev, see if /dev/initctl is there.
>>>> +# Run the mdev daemon
>>>>   #
>>>> -if test ! -p /dev/initctl
>>>> -then
>>>> -        rm -f /dev/initctl
>>>> -        mknod -m 600 /dev/initctl p
>>>> -fi
>>>> +
>>>> +DAEMON="mdev"
>>>> +PIDFILE="/var/run/$DAEMON.pid"
>>>> +
>>>> +
>>>> +start() {
>>>> +  echo -n "Starting $DAEMON... "
>>>> +  start-stop-daemon -S -b -m -p $PIDFILE -x /sbin/mdev -- -df
>>>
>>> Where do these start-stop-daemon options come from? Using -b for an
>>> application which is designed to run as a daemon (and deliberately
>>> telling that app to run in the foreground) looks odd, etc.
>>>
>>> Are there bugs or limitations in mdev which you are trying to workaround?
>>
>> its using start-stop-daemon applet from busybox which does have these options
>> implemented, its so that start-stop-daemon takes the control of the daemon
> 
> The question is not whether start-stop-daemon supports using PID files
> but whether the busybox mdev application supports creating them.
> 
> It looks like although most of the busybox daemons do, mdev does not:
> 

right it does not, letting start-stop-daemon works well though and is 
used in lot of places

> .../busybox-1.32.0 $ grep -r write_pidfile *
> debianutils/start_stop_daemon.c:        write_pidfile(pidfile);
> include/libbb.h:void write_pidfile(const char *path) FAST_FUNC;
> include/libbb.h:void write_pidfile_std_path_and_ext(const char *path) FAST_FUNC;
> include/libbb.h:#define write_pidfile_std_path_and_ext(path)  ((void)0)
> include/libbb.h:#define write_pidfile(path)  ((void)0)
> libbb/pidfile.c:void FAST_FUNC write_pidfile(const char *path)
> libbb/pidfile.c:void FAST_FUNC write_pidfile_std_path_and_ext(const char *name)
> libbb/pidfile.c:    write_pidfile(buf);
> miscutils/watchdog.c:    write_pidfile_std_path_and_ext("watchdog");
> miscutils/crond.c:    write_pidfile_std_path_and_ext("crond");
> networking/ifplugd.c:    write_pidfile(pidfile_name);
> networking/ntpd.c:        write_pidfile_std_path_and_ext("ntpd");
> networking/inetd.c:    write_pidfile_std_path_and_ext("inetd");
> networking/udhcp/dhcpc.c:    write_pidfile(client_data.pidfile);
> networking/udhcp/dhcpc.c:    write_pidfile(client_data.pidfile);
> networking/udhcp/dhcpd.c:    write_pidfile(server_data.pidfile);
> networking/udhcp/d6_dhcpc.c:    write_pidfile(client_data.pidfile);
> networking/udhcp/d6_dhcpc.c:    write_pidfile(client_data.pidfile);
> sysklogd/syslogd.c:    write_pidfile_std_path_and_ext("syslogd");
> sysklogd/klogd.c:    write_pidfile_std_path_and_ext("klogd");
> util-linux/acpid.c:    write_pidfile(opt_pidfile);
> 

  reply	other threads:[~2020-12-18 16:33 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-17 22:54 [PATCH 1/4] initscripts: use quotes for shell variable comparision Khem Raj
2020-12-17 22:54 ` [PATCH 2/4] busybox: Install /etc/default/rcS when used as init system Khem Raj
2020-12-17 22:54 ` [PATCH 3/4] busybox: Run mdev as daemon Khem Raj
2020-12-17 23:59   ` [OE-core] " Andre McCurdy
2020-12-18  2:45     ` Christopher Larson
2020-12-18  3:52     ` Khem Raj
2020-12-18  6:07       ` Andre McCurdy
2020-12-18 16:33         ` Khem Raj [this message]
2020-12-17 22:54 ` [PATCH 4/4] initscripts: Use initctl on sysvinit only Khem Raj
2020-12-18 18:29   ` [OE-core] " Sinan Kaya
2020-12-18 18:46     ` Khem Raj
2020-12-18 19:18       ` Sinan Kaya
2020-12-19  1:56         ` Khem Raj
2020-12-18 18:49   ` Peter Kjellerstedt
2020-12-17 23:51 ` [OE-core] [PATCH 1/4] initscripts: use quotes for shell variable comparision Andre McCurdy
2020-12-17 23:53   ` Khem Raj
2020-12-18  0:02     ` Andre McCurdy
2020-12-18  3:53       ` Khem Raj

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=84681f38-9023-1c0c-7e68-582307f2e63c@gmail.com \
    --to=raj.khem@gmail.com \
    --cc=armccurdy@gmail.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox