Find the answer to your Linux question:
Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    sigaction third paramenter use


    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 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.

  2. #2
    Just Joined! krokoziabla's Avatar
    Join Date
    Sep 2012
    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.

  3. #3
    Linux Engineer
    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.

  4. $spacer_open

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts