Hi Denys !

>You can simply run "kill -INT 1", it should do the same thing as
>C-A-Del: C-A-Del only makes kernel send SIGINT to PID 1.

For process 1 it is not! Signals send from another user to process 1
are handled somewhat different than signals send from the kernel. This
includes automatically blocking of signals not handled by pid 1
(installed signal handler).


>sigprocmask_allsigs(SIG_UNBLOCK);

May be the signal is not blocked but ignored, that is one of two issues
leading to same problems. So in addition to sigprocmask you need to set
all interrupts to there default action.

Remember: If you exec to another program, signals ignored before the
exec stay ignored after the exec. So if you ignore a signal for any
purpose and forget to restore it's action to default the forked process
will not receive such signals if it does not install a signal handler
(can't receive ignored signal with signalfd or sigwaitinfo).

From manpage of execve(2):

       *  POSIX.1-2001  specifies  that the dispositions of any signals
         that are ignored or set to the default are left unchanged.
         POSIX.1-2001 specifies one exception: if SIGCHLD is being
         ignored, then an  implementa‐ tion may leave the disposition
         unchanged or reset it to the default; Linux does the former.

And shells usually tend to not enable SIGINT if the signal is ignored
on invocation of the shell (for none interactive shells = scripts). The
caveat from this is, forking another shell from such a script does not
restore SIGINT from it's ignored state. This blocks Ctrl-C in the
forked shell even if the controlling tty is set correct.

Hence my suggestion to add this sigprocmask to unblock all signals
*AND* restore all signal actions to there default as part of the
cttyhack applet.

--
Harald
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to