HELPLIB.HLB  —  CRTL  sigprocmask
    Sets the current signal mask.

    Format

      #include  <signal.h>

      int sigprocmask  (int how, const sigset_t *set, sigset_t *o_set);

1  –  Arguments

 how

    An integer value that indicates how to change the set of masked
    signals. Use one of the following values:

    SIG_BLOCK     The resulting set is the union of the current set
                  and the signal set pointed to by the set argument.
    SIG_UNBLOCK   The resulting set is the intersection of the
                  current set and the complement of the signal set
                  pointed to by the set argument.
    SIG_SETMASK   The resulting set is the signal set pointed to by
                  the set argument.

 set

    The signal set. If the value of the set argument is:

    o  Not NULL - It points to a set of signals used to change the
       currently blocked set.

    o  NULL - The value of the how argument is not significant, and
       the process signal mask is unchanged, so you can use the call
       to inquire about currently blocked signals.

 o_set

    A non-NULL pointer to the location where the signal mask in
    effect at the time of the call is stored.

2  –  Description

    The sigprocmask function is used to examine or change the signal
    mask of the calling process.

    Typically, use the sigprocmask SIG_BLOCK value to block signals
    during a critical section of code, then use the sigprocmask SIG_
    SETMASK value to restore the mask to the previous value returned
    by the sigprocmask SIG_BLOCK value.

    If there are any unblocked signals pending after the call to the
    sigprocmask function, at least one of those signals is delivered
    before the sigprocmask function returns.

    You cannot block SIGKILL or SIGSTOP signals with the sigprocmask
    function. If a program attempts to block one of these signals,
    the sigprocmask function gives no indication of the error.

3  –  Example

      The following example shows how to set the signal mask to block
      only the SIGINT signal from delivery:

          #include <signal.h>

          int return_value;
          sigset_t newset;
           . . .
          sigemptyset(&newset);
          sigaddset(&newset, SIGINT);
          return_value = sigprocmask (SIG_SETMASK, &newset, NULL);

4  –  Return Values

    0                  Indicates success.
    -1                 Indicates an error. The signal mask of the
                       process is unchanged. errno is set to one of
                       the following values:

                       o  EINVAL - The value of the how argument is
                          not equal to one of the defined values.

                       o  EFAULT - The set or o_set argument points
                          to a location outside the allocated address
                          space of the process.
Close Help