How to reinstall a signal handler after exec ( Strange behaviour in signal handling )
Hi
The following program is born totally out of curiosity and as far as i can think has no real use ? (Kindly point out if i am wrong anywhere) I am trying to install signal handler for SIGSEGV. Code:
#include<iostream> exec i guess clears all the signal dispositions and reinstalls the default signal dispositions. But since the new process starts from the main, i can again reinstall the signal handler for SIGSEGV( and infact the output verifies it but still i get the following behaviour which i don't expect) Quote:
I have googled for more than 2 hours without any satisfactory answer. I also learned from somewhere that when a signal handler is being executed, that signal is masked i.e SIGSEGV in my case would be masked and when i do exec in the signal handler, the signal SIGSEGV would remain masked in the execed process. But if that is the case then i should never get "Segmentation fault" because if SIGSEGV gets masked, it won't be delivered and in that case my program should execute completely, isn't it ? But infact the statement "Before return" never gets printed as you can see from the output. May be i am missing something and there could be some flaw in the way i have understood things to be. Waiting eagerly for your response. Thanks & Regards lali.cpp |
All times are GMT -5. The time now is 04:13 PM. |