Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ sigprocmask(2) — AIX PS/2 1.2.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

kill, kill3, killpg

sigaction, sigvec, signal

sigsuspend, sigpause



SIGPROCMASK(2,L)            AIX Technical Reference            SIGPROCMASK(2,L)



-------------------------------------------------------------------------------
sigprocmask, sigsetmask, sigblock



PURPOSE

Sets the current signal mask.

SYNTAX

int sigprocmask (how, set, oset)
int how;
sigset_t *set, *oset;

DESCRIPTION

The sigprocmask system call is used to examine and change the calling process's
signal mask.  If the value of the argument set is not NULL, it points to a
signal mask to be used to change the current signal mask.

The how parameter indicates the manner in which the mask is changed.  It may
have one of the following values:

SIG_BLOCK   The resulting mask is the union of the current mask and the signal
            mask pointed to by the set parameter.

SIG_UNBLOCK The resulting mask is the intersection of the current mask and the
            complement of the signal mask pointed to by the set parameter.

SIG_SETMASK The resulting mask is the signal mask pointed to by the set
            parameter.

If the oset parameter is not NULL, the signal mask in effect at the time of the
call is stored in the space pointed to by the oset parameter.  If the value of
the set parameter is NULL, the value of the how parameter is not significant
and the process's signal mask is unchanged.  Thus, the call can be used to
inquire about currently blocked signals.

Typically, you would use the sigprocmask(SIG_BLOCK,...)  system call to block
signals during a critical section of code and then use the
sigprocmask(SIG_SETMASK,...) system call to restore the mask to the previous
value returned by the sigprocmask(SIG_BLOCK,...) system call.

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

The sigprocmask system call does not allow the SIGKILL or SIGSTOP signals to be
blocked.  If a program attempts to block one of these signals, sigprocmask
gives no indication of the error.




Processed November 7, 1990     SIGPROCMASK(2,L)                               1





SIGPROCMASK(2,L)            AIX Technical Reference            SIGPROCMASK(2,L)



COMPATIBILITY INTERFACES

int sigsetmask (sigmask)
int sigmask;

The sigsetmask subroutine allows the changing the process's signal mask for
signal values 1-32.  This same function can be accomplished for all signal
values with the sigprocmask(SIG_SETMASK,...,...) system call.  The signal of
value i will be blocked if the i-th bit of sigmask parameter is set.

Upon successful completion, the sigsetmask subroutine returns the value of the
previous signal mask.  If the subroutine fails, a -1 is returned and errno is
set to indicate the error as in the sigprocmask system call.

int sigblock (sigmask)
int sigmask;

The sigblock subroutine allows signals with values 1-32 to be ORed into the
current process signal mask.  This same function can be accomplished for all
signal values with the sigprocmask(SIG_BLOCK,...,...) system call.  In addition
to those currently blocked, the signal of value i is blocked if the i-th bit of
sigmask parameter is set.

Upon successful completion, the sigblock subroutine returns the value of the
previous signal mask.  If the subroutine fails, a -1 is returned and errno is
set to indicate the error as in the sigprocmask system call.

RETURN VALUE

Upon successful completion, a value of 0 is returned.  If the sigprocmask
system call fails, the process's signal mask is unchanged, a value of -1 is
returned, and errno is set to indicate the error.

ERROR CONDITIONS

The sigprocmask system call fails if one of the following is true:

EINVAL  The value of the how parameter is not equal to one of the defined
        values.

EFAULT  The set or oset parameter points to a location outside the process's
        address space.

EXAMPLE

To set the signal mask to block only SIGINT from delivery:









Processed November 7, 1990     SIGPROCMASK(2,L)                               2





SIGPROCMASK(2,L)            AIX Technical Reference            SIGPROCMASK(2,L)



  #include <signal.h>
  #include <unistd.h>

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

RELATED INFORMATION

In this book:  "kill, kill3, killpg," "sigaction, sigvec, signal," and
"sigsuspend, sigpause."







































Processed November 7, 1990     SIGPROCMASK(2,L)                               3



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026