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 2021-03-22 "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 *restrict " set ,
38 .BI " sigset_t *restrict " oldset );
40 .BR "#include <signal.h>" " /* Definition of " SIG_* " constants */"
41 .BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
42 .B #include <unistd.h>
44 /* Prototype for the underlying system call */
45 .BI "int syscall(SYS_rt_sigprocmask, int " how ", const kernel_sigset_t *" set ,
46 .BI " kernel_sigset_t *" oldset ", size_t " sigsetsize );
48 /* Prototype for the legacy system call (deprecated) */
49 .BI "int syscall(SYS_sigprocmask, int " how ", const old_kernel_sigset_t *" set ,
50 .BI " old_kernel_sigset_t *" oldset );
54 Feature Test Macro Requirements for glibc (see
55 .BR feature_test_macros (7)):
64 is used to fetch and/or change the signal mask of the calling thread.
65 The signal mask is the set of signals whose delivery is currently
66 blocked for the caller
71 The behavior of the call is dependent on the value of
76 The set of blocked signals is the union of the current set and the
83 are removed from the current set of blocked signals.
84 It is permissible to attempt to unblock a signal which is not blocked.
87 The set of blocked signals is set to the argument
92 is non-NULL, the previous value of the signal mask is stored in
97 is NULL, then the signal mask is unchanged (i.e.,
100 but the current value of the signal mask is nevertheless returned in
104 A set of functions for modifying and inspecting variables of type
106 ("signal sets") is described in
111 is unspecified in a multithreaded process; see
112 .BR pthread_sigmask (3).
115 returns 0 on success.
116 On failure, \-1 is returned and
118 is set to indicate the error.
126 argument points outside the process's allocated address space.
129 Either the value specified in
131 was invalid or the kernel does not support the size passed in
134 POSIX.1-2001, POSIX.1-2008.
136 It is not possible to block
137 .BR SIGKILL " or " SIGSTOP .
138 Attempts to do so are silently ignored.
140 Each of the threads in a process has its own signal mask.
144 inherits a copy of its parent's signal mask;
145 the signal mask is preserved across
155 while they are blocked, the result is undefined,
156 unless the signal was generated by
164 for details on manipulating signal sets.
166 Note that it is permissible (although not very useful) to specify both
172 .SS C library/kernel differences
173 The kernel's definition of
175 differs in size from that used
177 In this manual page, the former is referred to as
179 (it is nevertheless named
181 in the kernel sources).
183 The glibc wrapper function for
185 silently ignores attempts to block the two real-time signals that
186 are used internally by the NPTL threading implementation.
191 The original Linux system call was named
193 However, with the addition of real-time signals in Linux 2.2,
194 the fixed-size, 32-bit
197 .IR old_kernel_sigset_t
199 type supported by that system call was no longer fit for purpose.
200 Consequently, a new system call,
201 .BR rt_sigprocmask (),
202 was added to support an enlarged
207 in this manual page).
208 The new system call takes a fourth argument,
209 .IR "size_t sigsetsize" ,
210 which specifies the size in bytes of the signal sets in
214 This argument is currently required to have a fixed architecture specific value
216 .IR sizeof(kernel_sigset_t) ).
217 .\" sizeof(kernel_sigset_t) == _NSIG / 8,
218 .\" which equals to 8 on most architectures, but e.g. on MIPS it's 16.
222 wrapper function hides these details from us, transparently calling
223 .BR rt_sigprocmask ()
224 when the kernel provides it.
233 .BR pthread_sigmask (3),