]>
Commit | Line | Data |
---|---|---|
53191f2f | 1 | '\" t |
c11b1abf | 2 | .\" Copyright (c) 2005 by Michael Kerrisk <mtk.manpages@gmail.com> |
53191f2f | 3 | .\" |
93015253 | 4 | .\" %%%LICENSE_START(VERBATIM) |
53191f2f MK |
5 | .\" Permission is granted to make and distribute verbatim copies of this |
6 | .\" manual provided the copyright notice and this permission notice are | |
7 | .\" preserved on all copies. | |
8 | .\" | |
9 | .\" Permission is granted to copy and distribute modified versions of this | |
10 | .\" manual under the conditions for verbatim copying, provided that the | |
11 | .\" entire resulting derived work is distributed under the terms of a | |
12 | .\" permission notice identical to this one. | |
13 | .\" | |
14 | .\" Since the Linux kernel and libraries are constantly changing, this | |
15 | .\" manual page may be incorrect or out-of-date. The author(s) assume no | |
16 | .\" responsibility for errors or omissions, or for damages resulting from | |
10d76543 MK |
17 | .\" the use of the information contained herein. The author(s) may not |
18 | .\" have taken the same level of care in the production of this manual, | |
19 | .\" which is licensed free of charge, as they might when working | |
20 | .\" professionally. | |
53191f2f MK |
21 | .\" |
22 | .\" Formatted or processed versions of this manual, if unaccompanied by | |
23 | .\" the source, must acknowledge the copyright and authors of this work. | |
4b72fb64 | 24 | .\" %%%LICENSE_END |
53191f2f | 25 | .\" |
4b8c67d9 | 26 | .TH SIGSET 3 2017-09-15 "Linux" "Linux Programmer's Manual" |
53191f2f MK |
27 | .SH NAME |
28 | sigset, sighold, sigrelse, sigignore \- System V signal API | |
29 | .SH SYNOPSIS | |
53191f2f | 30 | .B #include <signal.h> |
68e4db0a | 31 | .PP |
53191f2f | 32 | .B typedef void (*sighandler_t)(int); |
68e4db0a | 33 | .PP |
53191f2f | 34 | .BI "sighandler_t sigset(int " sig ", sighandler_t " disp ); |
68e4db0a | 35 | .PP |
53191f2f | 36 | .BI "int sighold(int " sig ); |
68e4db0a | 37 | .PP |
53191f2f | 38 | .BI "int sigrelse(int " sig ); |
68e4db0a | 39 | .PP |
53191f2f | 40 | .BI "int sigignore(int " sig ); |
68e4db0a | 41 | .PP |
0afed661 MK |
42 | .in -4n |
43 | Feature Test Macro Requirements for glibc (see | |
44 | .BR feature_test_macros (7)): | |
45 | .in | |
68e4db0a | 46 | .PP |
0afed661 MK |
47 | .ad l |
48 | .BR sigset (), | |
49 | .BR sighold (), | |
50 | .BR sigrelse (), | |
51 | .BR sigignore (): | |
52 | .br | |
53 | .RS 4 | |
cf7fa0a1 MK |
54 | _XOPEN_SOURCE\ >=\ 500 |
55 | .\" || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED | |
0afed661 MK |
56 | .RE |
57 | .ad | |
53191f2f MK |
58 | .SH DESCRIPTION |
59 | These functions are provided in glibc as a compatibility interface | |
60 | for programs that make use of the historical System V signal API. | |
c13182ef MK |
61 | This API is obsolete: new applications should use the POSIX signal API |
62 | .RB ( sigaction (2), | |
53191f2f MK |
63 | .BR sigprocmask (2), |
64 | etc.) | |
847e0d88 | 65 | .PP |
53191f2f MK |
66 | The |
67 | .BR sigset () | |
68 | function modifies the disposition of the signal | |
69 | .IR sig . | |
c13182ef | 70 | The |
53191f2f MK |
71 | .I disp |
72 | argument can be the address of a signal handler function, | |
73 | or one of the following constants: | |
74 | .TP | |
0daa9e92 | 75 | .B SIG_DFL |
53191f2f MK |
76 | Reset the disposition of |
77 | .I sig | |
78 | to the default. | |
79 | .TP | |
0daa9e92 | 80 | .B SIG_IGN |
53191f2f MK |
81 | Ignore |
82 | .IR sig . | |
83 | .TP | |
0daa9e92 | 84 | .B SIG_HOLD |
c13182ef | 85 | Add |
53191f2f MK |
86 | .I sig |
87 | to the process's signal mask, but leave the disposition of | |
88 | .I sig | |
89 | unchanged. | |
90 | .PP | |
c13182ef | 91 | If |
53191f2f MK |
92 | .I disp |
93 | specifies the address of a signal handler, then | |
94 | .I sig | |
95 | is added to the process's signal mask during execution of the handler. | |
96 | .PP | |
97 | If | |
98 | .I disp | |
99 | was specified as a value other than | |
ed149213 MK |
100 | .BR SIG_HOLD , |
101 | then | |
53191f2f MK |
102 | .I sig |
103 | is removed from the process's signal mask. | |
53191f2f MK |
104 | .PP |
105 | The dispositions for | |
106 | .B SIGKILL | |
c13182ef | 107 | and |
53191f2f MK |
108 | .B SIGSTOP |
109 | cannot be changed. | |
110 | .PP | |
c13182ef | 111 | The |
53191f2f | 112 | .BR sighold () |
c13182ef | 113 | function adds |
53191f2f MK |
114 | .I sig |
115 | to the calling process's signal mask. | |
847e0d88 | 116 | .PP |
53191f2f MK |
117 | The |
118 | .BR sigrelse () | |
119 | function removes | |
120 | .I sig | |
121 | from the calling process's signal mask. | |
847e0d88 | 122 | .PP |
53191f2f MK |
123 | The |
124 | .BR sigignore () | |
134c92ad | 125 | function sets the disposition of |
53191f2f MK |
126 | .I sig |
127 | to | |
128 | .BR SIG_IGN . | |
129 | .SH RETURN VALUE | |
130 | On success, | |
131 | .BR sigset () | |
132 | returns | |
133 | .B SIG_HOLD | |
c13182ef MK |
134 | if |
135 | .I sig | |
53191f2f MK |
136 | was blocked before the call, |
137 | or the signal's previous disposition | |
138 | if it was not blocked before the call. | |
139 | On error, | |
140 | .BR sigset () | |
c13182ef | 141 | returns \-1, with |
53191f2f MK |
142 | .I errno |
143 | set to indicate the error. | |
29548a3b | 144 | (But see BUGS below.) |
847e0d88 | 145 | .PP |
53191f2f MK |
146 | The |
147 | .BR sighold (), | |
148 | .BR sigrelse (), | |
149 | and | |
150 | .BR sigignore () | |
151 | functions return 0 on success; on error, these functions return \-1 and set | |
c13182ef | 152 | .I errno |
53191f2f MK |
153 | to indicate the error. |
154 | .SH ERRORS | |
155 | For | |
156 | .BR sigset () | |
157 | see the ERRORS under | |
158 | .BR sigaction (2) | |
159 | and | |
160 | .BR sigprocmask (2). | |
847e0d88 | 161 | .PP |
53191f2f MK |
162 | For |
163 | .BR sighold () | |
164 | and | |
165 | .BR sigrelse () | |
166 | see the ERRORS under | |
167 | .BR sigprocmask (2). | |
847e0d88 | 168 | .PP |
c13182ef | 169 | For |
53191f2f MK |
170 | .BR sigignore (), |
171 | see the errors under | |
172 | .BR sigaction (2). | |
f2f06e22 PH |
173 | .SH ATTRIBUTES |
174 | For an explanation of the terms used in this section, see | |
175 | .BR attributes (7). | |
176 | .TS | |
177 | allbox; | |
178 | lbw23 lb lb | |
179 | l l l. | |
180 | Interface Attribute Value | |
181 | T{ | |
182 | .BR sigset (), | |
183 | .BR sighold (), | |
184 | .br | |
185 | .BR sigrelse (), | |
186 | .BR sigignore () | |
187 | T} Thread safety MT-Safe | |
188 | .TE | |
47297adb | 189 | .SH CONFORMING TO |
17316d47 | 190 | SVr4, POSIX.1-2001, POSIX.1-2008. |
2b2581ee | 191 | These functions are obsolete: do not use them in new programs. |
ec27c7cd MK |
192 | POSIX.1-2008 marks |
193 | .BR sighold (), | |
194 | .BR sigignore (), | |
9f7a5b0e | 195 | .BR sigpause (3), |
ec27c7cd MK |
196 | .BR sigrelse (), |
197 | and | |
198 | .BR sigset () | |
e3a9cc13 MK |
199 | as obsolete, recommending the use of |
200 | .BR sigaction (2), | |
201 | .BR sigprocmask (2), | |
202 | .BR pthread_sigmask (3), | |
203 | and | |
204 | .BR sigsuspend (2) | |
205 | instead. | |
53191f2f | 206 | .SH NOTES |
500d7ebc | 207 | These functions appeared in glibc version 2.1. |
847e0d88 | 208 | .PP |
53191f2f MK |
209 | The |
210 | .I sighandler_t | |
33a0ccb2 | 211 | type is a GNU extension; it is used on this page only to make the |
53191f2f MK |
212 | .BR sigset () |
213 | prototype more easily readable. | |
847e0d88 | 214 | .PP |
53191f2f MK |
215 | The |
216 | .BR sigset () | |
c13182ef | 217 | function provides reliable signal handling semantics (as when calling |
fb186734 | 218 | .BR sigaction (2) |
53191f2f MK |
219 | with |
220 | .I sa_mask | |
ed149213 | 221 | equal to 0). |
847e0d88 | 222 | .PP |
53191f2f MK |
223 | On System V, the |
224 | .BR signal () | |
c13182ef | 225 | function provides unreliable semantics (as when calling |
fb186734 | 226 | .BR sigaction (2) |
53191f2f MK |
227 | with |
228 | .I sa_mask | |
c13182ef | 229 | equal to |
53191f2f | 230 | .IR "SA_RESETHAND | SA_NODEFER" ). |
c13182ef | 231 | On BSD, |
53191f2f MK |
232 | .BR signal () |
233 | provides reliable semantics. | |
c13182ef | 234 | POSIX.1-2001 leaves these aspects of |
53191f2f MK |
235 | .BR signal () |
236 | unspecified. | |
c13182ef | 237 | See |
53191f2f MK |
238 | .BR signal (2) |
239 | for further details. | |
847e0d88 | 240 | .PP |
53191f2f MK |
241 | In order to wait for a signal, |
242 | BSD and System V both provided a function named | |
7a056410 | 243 | .BR sigpause (3), |
53191f2f MK |
244 | but this function has a different argument on the two systems. |
245 | See | |
246 | .BR sigpause (3) | |
247 | for details. | |
500d7ebc MK |
248 | .SH BUGS |
249 | In versions of glibc before 2.2, | |
250 | .BR sigset () | |
c13182ef | 251 | did not unblock |
500d7ebc | 252 | .I sig |
c13182ef | 253 | if |
500d7ebc MK |
254 | .I disp |
255 | was specified as a value other than | |
256 | .BR SIG_HOLD . | |
847e0d88 | 257 | .PP |
3d9c3691 | 258 | In versions of glibc before 2.5, |
500d7ebc | 259 | .BR sigset () |
c13182ef | 260 | does not correctly return the previous disposition of the signal |
500d7ebc MK |
261 | in two cases. |
262 | First, if | |
263 | .I disp | |
c13182ef | 264 | is specified as |
500d7ebc MK |
265 | .BR SIG_HOLD , |
266 | then a successful | |
267 | .BR sigset () | |
268 | always returns | |
269 | .BR SIG_HOLD . | |
270 | Instead, it should return the previous disposition of the signal | |
271 | (unless the signal was blocked, in which case | |
0daa9e92 | 272 | .B SIG_HOLD |
500d7ebc MK |
273 | should be returned). |
274 | Second, if the signal is currently blocked, then | |
275 | the return value of a successful | |
276 | .BR sigset () | |
277 | should be | |
278 | .BR SIG_HOLD . | |
279 | Instead, the previous disposition of the signal is returned. | |
3d9c3691 | 280 | These problems have been fixed since glibc 2.5. |
500d7ebc | 281 | .\" See http://sourceware.org/bugzilla/show_bug.cgi?id=1951 |
47297adb | 282 | .SH SEE ALSO |
53191f2f MK |
283 | .BR kill (2), |
284 | .BR pause (2), | |
285 | .BR sigaction (2), | |
286 | .BR signal (2), | |
287 | .BR sigprocmask (2), | |
288 | .BR raise (3), | |
289 | .BR sigpause (3), | |
290 | .BR sigvec (3), | |
291 | .BR signal (7) |