- 论坛徽章:
- 16
|
供参考:
man signal
......
Upon arrival of a signal with number signum the following happens. If the corre-
sponding handler is set to SIG_IGN, then the signal is ignored. If the handler is
set to SIG_DFL, then the default action associated with the signal (see signal(7))
occurs. Finally, if the handler is set to a function sighandler then first either
the handler is reset to SIG_DFL or an implementation-dependent blocking of the sig-
nal is performed and next sighandler is called with argument signum.
Using a signal handler function for a signal is called "catching the signal". The
signals SIGKILL and SIGSTOP cannot be caught or ignored.
RETURN VALUE
The signal() function returns the previous value of the signal handler, or SIG_ERR
on error.
PORTABILITY
The original Unix signal() would reset the handler to SIG_DFL, and System V (and the
Linux kernel and libc4,5) does the same. On the other hand, BSD does not reset the
handler, but blocks new instances of this signal from occurring during a call of the
handler. The glibc2 library follows the BSD behaviour.
...... |
|