1SIGPROCMASK(2)             Linux Programmer's Manual            SIGPROCMASK(2)
2
3
4

NAME

6       sigprocmask, rt_sigprocmask - examine and change blocked signals
7

SYNOPSIS

9       #include <signal.h>
10
11       /* Prototype for the glibc wrapper function */
12       int sigprocmask(int how, const sigset_t *set, sigset_t *oldset);
13
14       /* Prototype for the underlying system call */
15       int rt_sigprocmask(int how, const kernel_sigset_t *set,
16                          kernel_sigset_t *oldset, size_t sigsetsize);
17
18       /* Prototype for the legacy system call (deprecated) */
19       int sigprocmask(int how, const old_kernel_sigset_t *set,
20                       old_kernel_sigset_t *oldset);
21
22   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
23
24       sigprocmask(): _POSIX_C_SOURCE
25

DESCRIPTION

27       sigprocmask()  is  used  to  fetch and/or change the signal mask of the
28       calling thread.  The signal mask is the set of signals  whose  delivery
29       is  currently  blocked  for  the  caller  (see  also signal(7) for more
30       details).
31
32       The behavior of the call is dependent on the value of how, as follows.
33
34       SIG_BLOCK
35              The set of blocked signals is the union of the current  set  and
36              the set argument.
37
38       SIG_UNBLOCK
39              The  signals  in set are removed from the current set of blocked
40              signals.  It is permissible to attempt to unblock a signal which
41              is not blocked.
42
43       SIG_SETMASK
44              The set of blocked signals is set to the argument set.
45
46       If  oldset is non-NULL, the previous value of the signal mask is stored
47       in oldset.
48
49       If set is NULL, then  the  signal  mask  is  unchanged  (i.e.,  how  is
50       ignored),  but  the  current  value  of the signal mask is nevertheless
51       returned in oldset (if it is not NULL).
52
53       A set of functions for  modifying  and  inspecting  variables  of  type
54       sigset_t ("signal sets") is described in sigsetops(3).
55
56       The use of sigprocmask() is unspecified in a multithreaded process; see
57       pthread_sigmask(3).
58

RETURN VALUE

60       sigprocmask() returns 0 on success and -1 on error.  In the event of an
61       error, errno is set to indicate the cause.
62

ERRORS

64       EFAULT The  set  or  oldset argument points outside the process's allo‐
65              cated address space.
66
67       EINVAL Either the value specified in how was invalid or the kernel does
68              not support the size passed in sigsetsize.
69

CONFORMING TO

71       POSIX.1-2001, POSIX.1-2008.
72

NOTES

74       It  is not possible to block SIGKILL or SIGSTOP.  Attempts to do so are
75       silently ignored.
76
77       Each of the threads in a process has its own signal mask.
78
79       A child created via fork(2) inherits a  copy  of  its  parent's  signal
80       mask; the signal mask is preserved across execve(2).
81
82       If  SIGBUS,  SIGFPE,  SIGILL,  or  SIGSEGV are generated while they are
83       blocked, the result is undefined, unless the signal  was  generated  by
84       kill(2), sigqueue(3), or raise(3).
85
86       See sigsetops(3) for details on manipulating signal sets.
87
88       Note  that it is permissible (although not very useful) to specify both
89       set and oldset as NULL.
90
91   C library/kernel differences
92       The kernel's definition of sigset_t differs in size from that  used  by
93       the  C library.  In this manual page, the former is referred to as ker‐
94       nel_sigset_t (it is nevertheless named sigset_t in the kernel sources).
95
96       The glibc wrapper function for sigprocmask() silently ignores  attempts
97       to block the two real-time signals that are used internally by the NPTL
98       threading implementation.  See nptl(7) for details.
99
100       The original Linux system call was named sigprocmask().  However,  with
101       the  addition of real-time signals in Linux 2.2, the fixed-size, 32-bit
102       sigset_t (referred to as old_kernel_sigset_t in this manual page)  type
103       supported  by  that  system call was no longer fit for purpose.  Conse‐
104       quently, a new system call, rt_sigprocmask(), was added to  support  an
105       enlarged  sigset_t  type (referred to as kernel_sigset_t in this manual
106       page).  The new system call takes a fourth argument, size_t sigsetsize,
107       which specifies the size in bytes of the signal sets in set and oldset.
108       This argument is currently required to have a fixed  architecture  spe‐
109       cific value (equal to sizeof(kernel_sigset_t)).
110
111       The  glibc  sigprocmask() wrapper function hides these details from us,
112       transparently calling rt_sigprocmask() when the kernel provides it.
113

SEE ALSO

115       kill(2),  pause(2),  sigaction(2),  signal(2),  sigpending(2),  sigsus‐
116       pend(2), pthread_sigmask(3), sigqueue(3), sigsetops(3), signal(7)
117

COLOPHON

119       This  page  is  part of release 5.04 of the Linux man-pages project.  A
120       description of the project, information about reporting bugs,  and  the
121       latest     version     of     this    page,    can    be    found    at
122       https://www.kernel.org/doc/man-pages/.
123
124
125
126Linux                             2017-09-15                    SIGPROCMASK(2)
Impressum