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-09-15 "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 ); "
49 Feature Test Macro Requirements for glibc (see
50 .BR feature_test_macros (7)):
59 is used to fetch and/or change the signal mask of the calling thread.
60 The signal mask is the set of signals whose delivery is currently
61 blocked for the caller
66 The behavior of the call is dependent on the value of
71 The set of blocked signals is the union of the current set and the
78 are removed from the current set of blocked signals.
79 It is permissible to attempt to unblock a signal which is not blocked.
82 The set of blocked signals is set to the argument
87 is non-NULL, the previous value of the signal mask is stored in
92 is NULL, then the signal mask is unchanged (i.e.,
95 but the current value of the signal mask is nevertheless returned in
99 A set of functions for modifying and inspecting variables of type
101 ("signal sets") is described in
106 is unspecified in a multithreaded process; see
107 .BR pthread_sigmask (3).
110 returns 0 on success and \-1 on error.
111 In the event of an error,
113 is set to indicate the cause.
121 argument points outside the process's allocated address space.
124 Either the value specified in
126 was invalid or the kernel does not support the size passed in
129 POSIX.1-2001, POSIX.1-2008.
131 It is not possible to block
132 .BR SIGKILL " or " SIGSTOP .
133 Attempts to do so are silently ignored.
135 Each of the threads in a process has its own signal mask.
139 inherits a copy of its parent's signal mask;
140 the signal mask is preserved across
150 while they are blocked, the result is undefined,
151 unless the signal was generated by
159 for details on manipulating signal sets.
161 Note that it is permissible (although not very useful) to specify both
167 .SS C library/kernel differences
169 The kernel's definition of
171 differs in size from that used
173 In this manual page, the former is referred to as
175 (it is nevertheless named
177 in the kernel sources).
179 The glibc wrapper function for
181 silently ignores attempts to block the two real-time signals that
182 are used internally by the NPTL threading implementation.
187 The original Linux system call was named
189 However, with the addition of real-time signals in Linux 2.2,
190 the fixed-size, 32-bit
193 .IR old_kernel_sigset_t
195 type supported by that system call was no longer fit for purpose.
196 Consequently, a new system call,
197 .BR rt_sigprocmask (),
198 was added to support an enlarged
203 in this manual page).
204 The new system call takes a fourth argument,
205 .IR "size_t sigsetsize" ,
206 which specifies the size in bytes of the signal sets in
210 This argument is currently required to have a fixed architecture specific value
212 .IR sizeof(kernel_sigset_t) ).
213 .\" sizeof(kernel_sigset_t) == _NSIG / 8,
214 .\" which equals to 8 on most architectures, but e.g. on MIPS it's 16.
218 wrapper function hides these details from us, transparently calling
219 .BR rt_sigprocmask ()
220 when the kernel provides it.
229 .BR pthread_sigmask (3),