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

Deb McLemore debmc at linux.vnet.ibm.com
Wed Feb 14 01:26:22 UTC 2018


Even when process=1 is started, it still leaves a window when the

signal handler setup has not been completed.


bb_signals is for all signal handling setup.


On 02/13/2018 02:41 PM, Denys Vlasenko wrote:
> 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