2

I understand that there is a default signal handler, that is a function for each signal , such as SIGKILL etc. In which file it is written? I tried looking at signal.h, but could not find it there.

I am expecting each signal handler is having at least one function (handler).

Kindly help me locate this file

6

There is no "file" like you want to see, unless you want to read kernel code.

This is a little oversimplified. See the chapter in Rago & Stevens on Signals in 'Advanced Programming in the UNIX Environment' for a lot more information.

There are two parts to 'default signal handling'. These are built into the kernel. When the scheduler notices that there is a pending signal for a process, it gives the process the cpu if necessary (a context switch). Next the signal is delivered to the process. The process has a signal mask which allows it to ignore a lot of signals if the mask is deliberately set, two signals SIGKILL and SIGSTOP cannot be ignored or blocked. So the process now has a signal. If there is no handler set the kernel takes the default action for the signal.

There is a list of default actions for signals. SIGSEGV, for instance, terminates the process after it has dumped core. Michael Kerrisk has an explanation of the default actions. This is what I think you want.

http://man7.org/linux/man-pages/man7/signal.7.html

The kernel has code to handle all of these signal's default responses for the process.

If the kernel gets a signal for "itself" (depending on what flavor of UNIX we are talking about) the kernel panics, writes a crash dump, and leaves you with headache. - which is not what you want.

  • Thanks for your answer. I actually want to access kernel code. so there has to be default definitions for each handler. Where is that? – user3891236 Dec 14 '14 at 6:21
  • What operating system do you have? – jim mcnamara Dec 14 '14 at 10:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.