What exactly SIG_DFL (defaut handler for signals) does? I'm interested in debugging SIGTSTP. It misbehaves slightly under weird conditions. I have suspicion it is doing something strange if one the threads is in the TASK_ININTERRUPTBLE state.
Where is SIG_DFL source code? Libc?
Thanks.
SIG_DFL specifies the default action for the particular signal. The default actions for various kinds of signals are stated in Standard Signals. SIG_IGN. SIG_IGN specifies that the signal should be ignored.
Portability Note: The basic signal function is a feature of ISO C, while sigaction is part of the POSIX. 1 standard. If you are concerned about portability to non-POSIX systems, then you should use the signal function instead.
If you want to ignore the signal specified by the first argument (i.e., pretending that the signal never happens), use SIG_IGN for the second argument. In the above two lines, SIGINT and SIGALRM are ignored. If you want the system to use the default way to handle a signal, use SIG_DFL for the second argument.
What exactly SIG_DFL (defaut handler for signals) do?
It does exactly what one would expect: informs the kernel that there is no user signal handler for the given signal, and that the kernel should take default action for it (the action itself may be to ignore the signal, to terminate the program (with or without core dump), etc. depending on the signal).
Where is SIG_DFL source code? Libc?
There is usually a #define SIG_DLF -1
in /usr/include/signal.h
, but the decision on what to do is in the kernel.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With