2

I am a newbie and have basic understanding of linux.

Whenever the kernel encounters a signal for a particular process, first it checks the signal handler table in the process control block(PCB) of the particular process. If the signal handler is registered it calls the function. if the flag is SIG_DEFAULT then it calls the signal handler registered in the global signal table of kernel. If the flag is SIG_IGNORE then kernel just ignores the signal for the particular process.

All signals have default signal handlers already registered in signal table by kernel.

I just want to know how a process can change the flag from SIG_DEFAULT TO SIG_IGNORE. Please explain the mechanism(either using system call or changes in the signal table or PCB). Next time when the signal is again captured what optimizations does the kernel do.

Santosh Sahu
  • 2,134
  • 6
  • 27
  • 51
  • 1
    A user process? It calls `signal` or `sigaction` to change the disposition. – Duck Aug 31 '13 at 18:38
  • Is there any optimazations done by compiler when it again captures the signal?? – Santosh Sahu Aug 31 '13 at 18:40
  • 1
    Not that I am aware but I suppose you can check the glibc source that wraps the sys_calls. – Duck Aug 31 '13 at 18:43
  • Read [Ctrl+C interrupt event handling in a C++ program on Linux](http://stackoverflow.com/questions/17766550/ctrlc-interrupt-event-handling-in-a-c-program-on-linux/17766999#17766999) and [Simple Linux Signal Handling](http://stackoverflow.com/questions/17942034/simple-linux-signal-handling/17942230#17942230) – Grijesh Chauhan Aug 31 '13 at 19:43

1 Answers1

1

Call the signal function. Note that some signals may not be ultimately ignoreable.

James McNellis
  • 348,265
  • 75
  • 913
  • 977
  • signal or sigaction can be used but wanted to know the next time signal handling optimizations of kernel, what changes made in global symbol table. – Santosh Sahu Aug 31 '13 at 18:49
  • @SantoshSahu: So it might have been a good idea to put this in the title of the question. Perhaps now pose another, new question asking exactly this. – alk Sep 01 '13 at 06:55