[PATCH] init: Add handshake to poweroff/reboot for signal handler setup

Laurent Bercot ska-dietlibc at skarnet.org
Wed Feb 14 02:32:14 UTC 2018


>Even when process=1 is started, it still leaves a window when the
>signal handler setup has not been completed.

  Yes, but you can still use kill(pid, 0) to check whether init is
ready to receive signals: doublefork a zombie and repeatedly kill it
with signal 0. When you get -1 ESRCH, it means init has reapt the
zombie, so it's in its reaping loop, and at that point you know it
has installed its signal handlers.

  See http://lists.busybox.net/pipermail/busybox/2017-October/085888.html

  That's arguably uglier than using abstract sockets, but it can
be done without modifying the init code at all.

--
  Laurent



More information about the busybox mailing list