]>
Commit | Line | Data |
---|---|---|
9c2866d7 | 1 | '\" t |
c11b1abf | 2 | .\" Copyright (c) 2005 by Michael Kerrisk <mtk.manpages@gmail.com> |
9c2866d7 | 3 | .\" |
93015253 | 4 | .\" %%%LICENSE_START(VERBATIM) |
9c2866d7 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. | |
9c2866d7 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 |
9c2866d7 | 25 | .\" |
b8efb414 | 26 | .TH SIGVEC 3 2016-10-08 "Linux" "Linux Programmer's Manual" |
9c2866d7 MK |
27 | .SH NAME |
28 | sigvec, sigblock, sigsetmask, siggetmask, sigmask \- BSD signal API | |
29 | .SH SYNOPSIS | |
9c2866d7 MK |
30 | .B #include <signal.h> |
31 | .sp | |
7accd937 | 32 | .BI "int sigvec(int " sig ", const struct sigvec *" vec ", struct sigvec *" ovec ); |
9c2866d7 MK |
33 | .sp |
34 | .BI "int sigmask(int " signum ); | |
35 | .sp | |
36 | .BI "int sigblock(int " mask ); | |
37 | .sp | |
38 | .BI "int sigsetmask(int " mask ); | |
39 | .sp | |
40 | .B int siggetmask(void); | |
cc4615cc MK |
41 | .sp |
42 | .in -4n | |
43 | Feature Test Macro Requirements for glibc (see | |
44 | .BR feature_test_macros (7)): | |
45 | .in | |
46 | .sp | |
cfc2d88d | 47 | All functions shown above: |
51c612fb MK |
48 | Since glibc 2.19: |
49 | _DEFAULT_SOURCE | |
50 | Glibc 2.19 and earlier: | |
51 | _BSD_SOURCE | |
9c2866d7 MK |
52 | .SH DESCRIPTION |
53 | These functions are provided in glibc as a compatibility interface | |
54 | for programs that make use of the historical BSD signal API. | |
c13182ef MK |
55 | This API is obsolete: new applications should use the POSIX signal API |
56 | .RB ( sigaction (2), | |
9c2866d7 | 57 | .BR sigprocmask (2), |
1bea464c | 58 | etc.). |
9c2866d7 MK |
59 | |
60 | The | |
61 | .BR sigvec () | |
62 | function sets and/or gets the disposition of the signal | |
c13182ef | 63 | .I sig |
9c2866d7 MK |
64 | (like the POSIX |
65 | .BR sigaction (2)). | |
c13182ef | 66 | If |
9c2866d7 MK |
67 | .I vec |
68 | is not NULL, it points to a | |
69 | .I sigvec | |
c13182ef | 70 | structure that defines the new disposition for |
9c2866d7 MK |
71 | .IR sig . |
72 | If | |
73 | .I ovec | |
c13182ef | 74 | is not NULL, it points to a |
9c2866d7 MK |
75 | .I sigvec |
76 | structure that is used to return the previous disposition of | |
77 | .IR sig . | |
c13182ef | 78 | To obtain the current disposition of |
9c2866d7 MK |
79 | .I sig |
80 | without changing it, specify NULL for | |
c13182ef | 81 | .IR vec , |
b437fdd9 | 82 | and a non-null pointer for |
9c2866d7 MK |
83 | .IR ovec . |
84 | ||
85 | The dispositions for | |
86 | .B SIGKILL | |
c13182ef | 87 | and |
9c2866d7 MK |
88 | .B SIGSTOP |
89 | cannot be changed. | |
90 | ||
91 | The | |
92 | .I sigvec | |
93 | structure has the following form: | |
088a639b | 94 | .in +4n |
9c2866d7 MK |
95 | .nf |
96 | ||
97 | struct sigvec { | |
559a2b66 MK |
98 | void (*sv_handler)(int); /* Signal disposition */ |
99 | int sv_mask; /* Signals to be blocked in handler */ | |
100 | int sv_flags; /* Flags */ | |
9c2866d7 MK |
101 | }; |
102 | ||
103 | .fi | |
d4f3dcff | 104 | .in |
9c2866d7 MK |
105 | The |
106 | .I sv_handler | |
107 | field specifies the disposition of the signal, and is either: | |
4eaa04c5 | 108 | the address of a signal handler function; |
1bea464c | 109 | .BR SIG_DFL , |
9c2866d7 | 110 | meaning the default disposition applies for the signal; or |
1bea464c | 111 | .BR SIG_IGN , |
9c2866d7 MK |
112 | meaning that the signal is ignored. |
113 | ||
114 | If | |
115 | .I sv_handler | |
116 | specifies the address of a signal handler, then | |
117 | .I sv_mask | |
c13182ef | 118 | specifies a mask of signals that are to be blocked while |
9c2866d7 | 119 | the handler is executing. |
c13182ef | 120 | In addition, the signal for which the handler is invoked is |
e191c685 | 121 | also blocked. |
9c2866d7 MK |
122 | Attempts to block |
123 | .B SIGKILL | |
c13182ef | 124 | or |
9c2866d7 MK |
125 | .B SIGSTOP |
126 | are silently ignored. | |
127 | ||
128 | If | |
129 | .I sv_handler | |
130 | specifies the address of a signal handler, then the | |
131 | .I sv_flags | |
132 | field specifies flags controlling what happens when the handler is called. | |
133 | This field may contain zero or more of the following flags: | |
134 | .TP | |
135 | .B SV_INTERRUPT | |
136 | If the signal handler interrupts a blocking system call, | |
137 | then upon return from the handler the system call will not be restarted: | |
138 | instead it will fail with the error | |
7b2b5ea4 | 139 | .BR EINTR . |
c13182ef | 140 | If this flag is not specified, then system calls are restarted |
9c2866d7 MK |
141 | by default. |
142 | .TP | |
143 | .B SV_RESETHAND | |
c13182ef | 144 | Reset the disposition of the signal to the default |
9c2866d7 MK |
145 | before calling the signal handler. |
146 | If this flag is not specified, then the handler remains established | |
c13182ef | 147 | until explicitly removed by a later call to |
9c2866d7 MK |
148 | .BR sigvec () |
149 | or until the process performs an | |
150 | .BR execve (2). | |
151 | .TP | |
152 | .B SV_ONSTACK | |
c13182ef MK |
153 | Handle the signal on the alternate signal stack |
154 | (historically established under BSD using the obsolete | |
9c2866d7 | 155 | .BR sigstack () |
c13182ef | 156 | function; the POSIX replacement is |
fb186734 | 157 | .BR sigaltstack (2)). |
9c2866d7 | 158 | .PP |
c13182ef | 159 | The |
9c2866d7 | 160 | .BR sigmask () |
c1729f52 | 161 | macro constructs and returns a "signal mask" for |
9c2866d7 | 162 | .IR signum . |
d9bfdb9c | 163 | For example, we can initialize the |
c13182ef MK |
164 | .I vec.sv_mask |
165 | field given to | |
9c2866d7 MK |
166 | .BR sigvec () |
167 | using code such as the following: | |
168 | .nf | |
169 | ||
71008621 | 170 | vec.sv_mask = sigmask(SIGQUIT) | sigmask(SIGABRT); |
c13182ef | 171 | /* Block SIGQUIT and SIGABRT during |
9c2866d7 MK |
172 | handler execution */ |
173 | .fi | |
174 | .PP | |
175 | The | |
176 | .BR sigblock () | |
177 | function adds the signals in | |
178 | .I mask | |
179 | to the process's signal mask | |
c13182ef | 180 | (like POSIX |
9c2866d7 MK |
181 | .IR sigprocmask(SIG_BLOCK) ), |
182 | and returns the process's previous signal mask. | |
183 | Attempts to block | |
184 | .B SIGKILL | |
c13182ef | 185 | or |
9c2866d7 MK |
186 | .B SIGSTOP |
187 | are silently ignored. | |
188 | .PP | |
c13182ef | 189 | The |
9c2866d7 MK |
190 | .BR sigsetmask () |
191 | function sets the process's signal mask to the value given in | |
c13182ef MK |
192 | .I mask |
193 | (like POSIX | |
9c2866d7 MK |
194 | .IR sigprocmask(SIG_SETMASK) ), |
195 | and returns the process's previous signal mask. | |
196 | .PP | |
197 | The | |
198 | .BR siggetmask () | |
199 | function returns the process's current signal mask. | |
200 | This call is equivalent to | |
201 | .IR sigblock(0) . | |
202 | .SH RETURN VALUE | |
c13182ef | 203 | The |
9c2866d7 MK |
204 | .BR sigvec () |
205 | function returns 0 on success; on error, it returns \-1 and sets | |
c13182ef | 206 | .I errno |
9c2866d7 MK |
207 | to indicate the error. |
208 | ||
209 | The | |
210 | .BR sigblock () | |
211 | and | |
212 | .BR sigsetmask () | |
213 | functions return the previous signal mask. | |
214 | ||
215 | The | |
216 | .BR sigmask () | |
c1729f52 | 217 | macro returns the signal mask for |
9c2866d7 MK |
218 | .IR signum . |
219 | .SH ERRORS | |
220 | See the ERRORS under | |
221 | .BR sigaction (2) | |
222 | and | |
223 | .BR sigprocmask (2). | |
84f6b067 MK |
224 | .SH VERSIONS |
225 | Starting with version 2.21, the GNU C library no longer exports the | |
226 | .BR sigvec () | |
227 | function as part of the ABI. | |
228 | (To ensure backward compatibility, | |
229 | the glibc symbol versioning scheme continues to export the interface | |
230 | to binaries linked against older versions of the library.) | |
74fe2018 | 231 | .SH ATTRIBUTES |
3c180819 PH |
232 | For an explanation of the terms used in this section, see |
233 | .BR attributes (7). | |
234 | .TS | |
235 | allbox; | |
236 | lbw32 lb lb | |
237 | l l l. | |
238 | Interface Attribute Value | |
239 | T{ | |
74fe2018 | 240 | .BR sigvec (), |
3c180819 | 241 | .BR sigmask (), |
74fe2018 PH |
242 | .BR sigblock (), |
243 | .BR sigsetmask (), | |
74fe2018 | 244 | .BR siggetmask () |
3c180819 PH |
245 | T} Thread safety MT-Safe |
246 | .TE | |
47297adb | 247 | .SH CONFORMING TO |
2b2581ee MK |
248 | All of these functions were in |
249 | 4.3BSD, except | |
250 | .BR siggetmask (), | |
251 | whose origin is unclear. | |
252 | These functions are obsolete: do not use them in new programs. | |
9c2866d7 MK |
253 | .SH NOTES |
254 | On 4.3BSD, the | |
255 | .BR signal () | |
c13182ef | 256 | function provided reliable semantics (as when calling |
9c2866d7 MK |
257 | .BR sigvec () |
258 | with | |
259 | .I vec.sv_mask | |
260 | equal to 0). | |
261 | On System V, | |
262 | .BR signal () | |
263 | provides unreliable semantics. | |
9041febd | 264 | POSIX.1 leaves these aspects of |
9c2866d7 MK |
265 | .BR signal () |
266 | unspecified. | |
c13182ef | 267 | See |
9c2866d7 MK |
268 | .BR signal (2) |
269 | for further details. | |
270 | ||
271 | In order to wait for a signal, | |
272 | BSD and System V both provided a function named | |
7a056410 | 273 | .BR sigpause (3), |
9c2866d7 MK |
274 | but this function has a different argument on the two systems. |
275 | See | |
276 | .BR sigpause (3) | |
277 | for details. | |
47297adb | 278 | .SH SEE ALSO |
9c2866d7 MK |
279 | .BR kill (2), |
280 | .BR pause (2), | |
9c2866d7 MK |
281 | .BR sigaction (2), |
282 | .BR signal (2), | |
283 | .BR sigprocmask (2), | |
9fe51d8d | 284 | .BR raise (3), |
46c721e7 MK |
285 | .BR sigpause (3), |
286 | .BR sigset (3), | |
9c2866d7 | 287 | .BR signal (7) |