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

Denys Vlasenko vda.linux at googlemail.com
Tue Feb 13 20:41:11 UTC 2018


On Sat, Nov 25, 2017 at 3:09 AM, Deb McLemore <debmc at linux.vnet.ibm.com> wrote:
> Add an abstract socket to synchronize the readiness of init to receive
> the SIGUSR2 to catch poweroff/reboot during an IPL phase (e.g. soft power
> off via BMC).
>
> Signed-off-by: Deb McLemore <debmc at linux.vnet.ibm.com>
> ---
>  include/libbb.h |  5 +++++
>  init/halt.c     | 33 +++++++++++++++++++++++++++++++++
>  init/init.c     | 22 ++++++++++++++++++++++
>  3 files changed, 60 insertions(+)
>
> diff --git a/include/libbb.h b/include/libbb.h
> index daccf15..9f9bfc2 100644
> --- a/include/libbb.h
> +++ b/include/libbb.h
> @@ -174,6 +174,11 @@
>  # define STRERROR_ERRNO  ,strerror(errno)
>  #endif
>
> +#ifdef __linux
> +#define BB_SIGNALS_SOCKET_STRING "\0bb_signals"

Probably should be "\0bb_init_signals".

But I wonder. Can't you probe for existence of process 1
using kill(1,0) syscall returning 0 or ESRCH?


More information about the busybox mailing list