Results 1 to 3 of 3
Hi Code: int sigaction( int signum , const struct sigaction *act, struct sigaction *oldact); I used the sigaction with second paramter properly loaded with appropriate data and signal handler. And ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 09-06-2012 #1
- Join Date
- Dec 2011
sigaction third paramenter use
int sigaction( int signum , const struct sigaction *act, struct sigaction *oldact);
And i understand the behaviour,but i dont understand the usage of the third parameter oldact.
Can somebody please show me how to use the third parameter in a program.
I have read the man page and it says "the previous action will be saved", i could not understand what this previous action means.
Is it having any advantage or necessity in programming.
- 09-06-2012 #2
I think you get in oldact the previous handler of the signal, that is it could be a default signal handler or the one you have previously set up. It could be useful, for instance, if you would like to temporaryly change the signal handler, or if you has allocated the previous struct signaction dynamicly, you can use oldact to free this memory.
- 09-07-2012 #3
- Join Date
- Jan 2005
- Saint Paul, MN
The third argument should be kept and restored when you do not wish to have control of that signal. Also when used in a library or a plugin and the old action is not the default action, the code handling the action should put the old action back and raise the signal and then re-register it's action when it gets control back from the raise so that it can catch the signal a second time.
We had to do the pass along when we added code to verilog simulators so that when the user paused the simulation, we would release our license and re-obtain the license on wake-up. Since the user might be using other products (which were added to that same as our product) might also free-up their licenses as well.