1 .\" Copyright (c) 2005 Michael Kerrisk
2 .\" based on earlier work by faith@cs.unc.edu and
3 .\" Mike Battersby <mib@deakin.edu.au>
5 .\" %%%LICENSE_START(VERBATIM)
6 .\" Permission is granted to make and distribute verbatim copies of this
7 .\" manual provided the copyright notice and this permission notice are
8 .\" preserved on all copies.
10 .\" Permission is granted to copy and distribute modified versions of this
11 .\" manual under the conditions for verbatim copying, provided that the
12 .\" entire resulting derived work is distributed under the terms of a
13 .\" permission notice identical to this one.
15 .\" Since the Linux kernel and libraries are constantly changing, this
16 .\" manual page may be incorrect or out-of-date. The author(s) assume no
17 .\" responsibility for errors or omissions, or for damages resulting from
18 .\" the use of the information contained herein. The author(s) may not
19 .\" have taken the same level of care in the production of this manual,
20 .\" which is licensed free of charge, as they might when working
23 .\" Formatted or processed versions of this manual, if unaccompanied by
24 .\" the source, must acknowledge the copyright and authors of this work.
27 .\" 2005-09-15, mtk, Created new page by splitting off from sigaction.2
29 .TH SIGPROCMASK 2 2017-05-03 "Linux" "Linux Programmer's Manual"
31 sigprocmask, rt_sigprocmask \- examine and change blocked signals
33 .B #include <signal.h>
36 /* Prototype for the glibc wrapper function */
37 .BI "int sigprocmask(int " how ", const sigset_t *" set ", sigset_t *" oldset );
39 /* Prototype for the underlying system call */
40 .BI "int rt_sigprocmask(int " how ", const kernel_sigset_t *" set ,
41 .BI " kernel_sigset_t *" oldset ", size_t " sigsetsize );
43 /* Prototype for the legacy system call (deprecated) */
44 .BI "int sigprocmask(int " how ", const old_kernel_sigset_t *" set ,
45 .BI " old_kernel_sigset_t *" oldset ); "
50 Feature Test Macro Requirements for glibc (see
51 .BR feature_test_macros (7)):
60 is used to fetch and/or change the signal mask of the calling thread.
61 The signal mask is the set of signals whose delivery is currently
62 blocked for the caller
67 The behavior of the call is dependent on the value of
72 The set of blocked signals is the union of the current set and the
79 are removed from the current set of blocked signals.
80 It is permissible to attempt to unblock a signal which is not blocked.
83 The set of blocked signals is set to the argument
88 is non-NULL, the previous value of the signal mask is stored in
93 is NULL, then the signal mask is unchanged (i.e.,
96 but the current value of the signal mask is nevertheless returned in
100 A set of functions for modifying and inspecting variables of type
102 ("signal sets") is described in
107 is unspecified in a multithreaded process; see
108 .BR pthread_sigmask (3).
111 returns 0 on success and \-1 on error.
112 In the event of an error,
114 is set to indicate the cause.
122 argument points outside the process's allocated address space.
125 Either the value specified in
127 was invalid or the kernel does not support the size passed in
130 POSIX.1-2001, POSIX.1-2008.
132 It is not possible to block
133 .BR SIGKILL " or " SIGSTOP .
134 Attempts to do so are silently ignored.
136 Each of the threads in a process has its own signal mask.
140 inherits a copy of its parent's signal mask;
141 the signal mask is preserved across
151 while they are blocked, the result is undefined,
152 unless the signal was generated by
160 for details on manipulating signal sets.
162 Note that it is permissible (although not very useful) to specify both
168 .SS C library/kernel differences
170 The kernel's definition of
172 differs in size from that used
174 In this manual page, the former is referred to as
176 (it is nevertheless named
178 in the kernel sources).
180 The glibc wrapper function for
182 silently ignores attempts to block the two real-time signals that
183 are used internally by the NPTL threading implementation.
188 The original Linux system call was named
190 However, with the addition of real-time signals in Linux 2.2,
191 the fixed-size, 32-bit
194 .IR old_kernel_sigset_t
196 type supported by that system call was no longer fit for purpose.
197 Consequently, a new system call,
198 .BR rt_sigprocmask (),
199 was added to support an enlarged
204 in this manual page).
205 The new system call takes a fourth argument,
206 .IR "size_t sigsetsize" ,
207 which specifies the size in bytes of the signal sets in
211 This argument is currently required to have a fixed architecture specific value
213 .IR sizeof(kernel_sigset_t) ).
214 .\" sizeof(kernel_sigset_t) == _NSIG / 8,
215 .\" which equals to 8 on most architectures, but e.g. on MIPS it's 16.
219 wrapper function hides these details from us, transparently calling
220 .BR rt_sigprocmask ()
221 when the kernel provides it.
230 .BR pthread_sigmask (3),