I know /sbin/init has special protection against SIGKILL
and SIGSTOP
from kernel for obvious reasons.
I have tried telling kernel I want to receive SIGSTOP
with ioctl()
(similar to SIGABRT
and SIGSEGV
reqs in main()):
if (ioctl (0, KDSIGACCEPT, SIGSTOP) == 0) {
nih_signal_set_handler (SIGSTOP, stop_handler);
but SIGSTOP
doesn't arrive to the stop_handler()
(from all I know, as nih_error()
isn't printed in logs).
In stop_handler()
, I'm resetting the SIGSTOP
signal handler to SIG_DFL
(otherwise it would come back to our handler anyways), but this probably leads it being ignored by the kernel again.
How do I tell kernel I want to have init STOPPED?