1753971 Members
8071 Online
108811 Solutions
New Discussion

Re: about sigaction .

 
jack_8
Contributor

about sigaction .

I have a program using sigaction. I set sa_handler = func and sa_sigaction = func1. I didn't set sa_flags. but when the program caught the signal, it invokes func1 not func.
but in sigaction man ,they said when I clear SA_SIGINFO, the sa_handler member must be used to describe the signal catching function.
I don't know why my program's action is not like what described in the sigaction man .
1 REPLY 1
Thomas Kollig
Trusted Contributor

Re: about sigaction .

Hi!

You never should set both "sa_handler" and "sa_sigaction", because in "struct sigaction" the entry of both are combined using "union".
I've tried a little bit with two signals, where I set both. For one signal it uses the function defined with "sa_handler" and for the other the function defined with "sa_sigaction". Strange behaviour due to the "union" definition, I think.

Hope this helps, Thomas