Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Your premise is wrong. The whole set gets blocked and unblocked with a single call of <code>sigprocmask</code>. </p> <p>Also, normally you would create a set containing every signal you want to block, then you would attempt to block them all with <code>sigprocmask(SIG_BLOCK, pointer_to_sigset);</code>.</p> <p>Your code doesn't really unblock SIGSEGV though. Here's what i would write WITHOUT error handling, because it would make the snippet unnecessarily long. Check every function for errors though, the lists of possible errors are provided by man pages:</p> <pre><code>/* ... */ sigset_t signal_set; /* We don't need oldset in this program. You can add it, but it's best to use different sigsets for the second and third argument of sigprocmask. */ sigemptyset(&amp;signal_set); sigaddset(&amp;signal_set, SIGSEGV); sigaddset(&amp;signal_set, SIGRTMIN); /* now signal_set == {SIGSEGV, SIGRTMIN} */ sigprocmask(SIG_BLOCK, &amp;signal_set, NULL): /* As i said, we don't bother with the oldset argument. */ kill(0,SIGSEGV); kill(0,SIGSEGV); /* SIGSEGV is not a realtime signal, so we can send it twice, but it will be recieved just once */ sigprocmask(SIG_UNBLOCK, &amp;signal_set, NULL); /* Again, don't bother with oldset */ /* SIGSEGV will be received here */ </code></pre> <p>Of course, you might want to split blocking the signals into two operations on separate sets. The mechanism works like this: there is some set of blocked signals, which would replace oldset if you provided an oldset argument. You can add to that set with <code>SIG_BLOCK</code>, remove from that set with <code>SIG_UNBLOCK</code>, and change the whole set to your liking with <code>SIG_SETMASK</code> arguments of the <code>sigprocmask</code> function.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload