Signal handlers cannot be set for
SIGKILL
or
SIGSTOP .
Unlike on BSD systems, signals under Linux are reset to their default
behavior when raised.
However, if you include
<bsd/signal.h>
instead of
<signal.h>
then
signal
is redefined as
__bsd_signal
and signal has the BSD semantics.
Both versions of
signal
are library routines built on top of
sigaction (2).
If you're confused by the prototype at the top of this manpage, it
may help to see it separated out thus:
typedef void (*sighandler_t)(int);
sighandler_t signal(int signum , sighandler_t handler );
According to POSIX, the behaviour of a process is undefined after it
ignores a SIGFPE, SIGILL, or SIGSEGV signal that was not generated
by the kill() or the raise() functions.
Integer division by zero has undefined result.
On some architectures it will generate a SIGFPE signal.
(Also dividing the most negative integer by -1 may generate SIGFPE.)
Ignoring this signal might lead to an endless loop.
According to POSIX (B.3.3.1.3) you must not set the action for SIGCHLD
to SIG_IGN. Here the BSD and SYSV behaviours differ, causing BSD software
that sets the action for SIGCHLD to SIG_IGN to fail on Linux.