Search code examples
linuxsignalslibc

What exactly SIG_DFL do?


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.


Solution

  • 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_DFL -1 in /usr/include/signal.h, but the decision on what to do is in the kernel.