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