]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man2/sigprocmask.2
intro.1, _exit.2, access.2, alarm.2, alloc_hugepages.2, arch_prctl.2, bind.2, chdir...
[thirdparty/man-pages.git] / man2 / sigprocmask.2
1 .\" Copyright (c) 2005 Michael Kerrisk
2 .\" based on earlier work by faith@cs.unc.edu and
3 .\" Mike Battersby <mib@deakin.edu.au>
4 .\"
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.
9 .\"
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.
14 .\"
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
21 .\" professionally.
22 .\"
23 .\" Formatted or processed versions of this manual, if unaccompanied by
24 .\" the source, must acknowledge the copyright and authors of this work.
25 .\" %%%LICENSE_END
26 .\"
27 .\" 2005-09-15, mtk, Created new page by splitting off from sigaction.2
28 .\"
29 .TH SIGPROCMASK 2 2012-04-15 "Linux" "Linux Programmer's Manual"
30 .SH NAME
31 sigprocmask \- examine and change blocked signals
32 .SH SYNOPSIS
33 .B #include <signal.h>
34 .sp
35 .BI "int sigprocmask(int " how ", const sigset_t *" set ,
36 .BI "sigset_t *" oldset );
37 .sp
38 .in -4n
39 Feature Test Macro Requirements for glibc (see
40 .BR feature_test_macros (7)):
41 .in
42 .sp
43 .ad l
44 .BR sigprocmask ():
45 _POSIX_C_SOURCE\ >=\ 1 || _XOPEN_SOURCE || _POSIX_SOURCE
46 .ad b
47 .SH DESCRIPTION
48 .BR sigprocmask ()
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
52 (see also
53 .BR signal (7)
54 for more details).
55
56 The behavior of the call is dependent on the value of
57 .IR how ,
58 as follows.
59 .TP
60 .B SIG_BLOCK
61 The set of blocked signals is the union of the current set and the
62 .I set
63 argument.
64 .TP
65 .B SIG_UNBLOCK
66 The signals in
67 .I set
68 are removed from the current set of blocked signals.
69 It is permissible to attempt to unblock a signal which is not blocked.
70 .TP
71 .B SIG_SETMASK
72 The set of blocked signals is set to the argument
73 .IR set .
74 .PP
75 If
76 .I oldset
77 is non-NULL, the previous value of the signal mask is stored in
78 .IR oldset .
79
80 If
81 .I set
82 is NULL, then the signal mask is unchanged (i.e.,
83 .I how
84 is ignored),
85 but the current value of the signal mask is nevertheless returned in
86 .I oldset
87 (if it is not NULL).
88
89 The use of
90 .BR sigprocmask ()
91 is unspecified in a multithreaded process; see
92 .BR pthread_sigmask (3).
93 .SH RETURN VALUE
94 .BR sigprocmask ()
95 returns 0 on success and \-1 on error.
96 .SH ERRORS
97 .TP
98 .B EFAULT
99 the
100 .I set
101 or
102 .I oldset
103 argument points outside the process's allocated address space.
104 .TP
105 .B EINVAL
106 The value specified in
107 .I how
108 was invalid.
109 .SH CONFORMING TO
110 POSIX.1-2001.
111 .SH NOTES
112 It is not possible to block
113 .BR SIGKILL " or " SIGSTOP .
114 Attempts to do so are silently ignored.
115
116 Each of the threads in a process has its own signal mask.
117
118 A child created via
119 .BR fork (2)
120 inherits a copy of its parent's signal mask;
121 the signal mask is preserved across
122 .BR execve (2).
123
124 If
125 .BR SIGBUS ,
126 .BR SIGFPE ,
127 .BR SIGILL ,
128 or
129 .B SIGSEGV
130 are generated
131 while they are blocked, the result is undefined,
132 unless the signal was generated by
133 .BR kill (2),
134 .BR sigqueue (3),
135 or
136 .BR raise (3).
137 .PP
138 See
139 .BR sigsetops (3)
140 for details on manipulating signal sets.
141 .SH SEE ALSO
142 .BR kill (2),
143 .BR pause (2),
144 .BR sigaction (2),
145 .BR signal (2),
146 .BR sigpending (2),
147 .BR sigsuspend (2),
148 .BR pthread_sigmask (3),
149 .BR sigqueue (3),
150 .BR sigsetops (3),
151 .BR signal (7)