We have a daemon server program which forks one child. When the child exits, Parent is receiving SIGTERM signal. So, we want to know
1) Who sent this SIGTERM?
2) Whether the SIGTERM is only for parent or its group?
3) What are the possible ways SIGTERM can be generated under this scenario?
4) Is it possible to mask this SIGTERM signal? If yes what would be the side effect of this call?
You need a sig-handler of type SA_SIGINFO.
Then you will get the siginfo_t which contains si_pid which is signalling process.
http://linux.die.net/man/2/sigaction