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 2015-07-23 "Linux" "Linux Programmer's Manual"
31 sigprocmask, rt_sigprocmask \- examine and change blocked signals
33 .B #include <signal.h>
35 .BI "int sigprocmask(int " how ", const sigset_t *" set ,
36 .BI "sigset_t *" oldset );
39 Feature Test Macro Requirements for glibc (see
40 .BR feature_test_macros (7)):
45 _POSIX_C_SOURCE\ >=\ 1 || _XOPEN_SOURCE || _POSIX_SOURCE
49 is used to fetch and/or change the signal mask of the calling thread.
50 The signal mask is the set of signals whose delivery is currently
51 blocked for the caller
56 The behavior of the call is dependent on the value of
61 The set of blocked signals is the union of the current set and the
68 are removed from the current set of blocked signals.
69 It is permissible to attempt to unblock a signal which is not blocked.
72 The set of blocked signals is set to the argument
77 is non-NULL, the previous value of the signal mask is stored in
82 is NULL, then the signal mask is unchanged (i.e.,
85 but the current value of the signal mask is nevertheless returned in
91 is unspecified in a multithreaded process; see
92 .BR pthread_sigmask (3).
95 returns 0 on success and \-1 on error.
96 In the event of an error,
98 is set to indicate the cause.
106 argument points outside the process's allocated address space.
109 The value specified in
113 POSIX.1-2001, POSIX.1-2008.
115 It is not possible to block
116 .BR SIGKILL " or " SIGSTOP .
117 Attempts to do so are silently ignored.
119 Each of the threads in a process has its own signal mask.
123 inherits a copy of its parent's signal mask;
124 the signal mask is preserved across
134 while they are blocked, the result is undefined,
135 unless the signal was generated by
143 for details on manipulating signal sets.
145 .SS C library/kernel differences
146 The glibc wrapper function for
148 silently ignores attempts to block the two real-time signals that
149 are used internally by the NPTL threading implementation.
154 The original Linux system call was named
156 However, with the addition of real-time signals in Linux 2.2,
157 the fixed-size, 32-bit
159 type supported by that system call was no longer fit for purpose.
160 Consequently, a new system call,
161 .BR rt_sigprocmask (),
162 was added to support an enlarged
165 The new system call takes a fourth argument,
166 .IR "size_t sigsetsize" ,
167 which specifies the size in bytes of the signal sets in
171 This argument is currently required to have the value
178 wrapper function hides these details from us, transparently calling
179 .BR rt_sigprocmask ()
180 when the kernel provides it.
189 .BR pthread_sigmask (3),