1 | /* A GNU-like <signal.h>.
|
---|
2 |
|
---|
3 | Copyright (C) 2006-2021 Free Software Foundation, Inc.
|
---|
4 |
|
---|
5 | This file is free software: you can redistribute it and/or modify
|
---|
6 | it under the terms of the GNU Lesser General Public License as
|
---|
7 | published by the Free Software Foundation; either version 2.1 of the
|
---|
8 | License, or (at your option) any later version.
|
---|
9 |
|
---|
10 | This file is distributed in the hope that it will be useful,
|
---|
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
13 | GNU Lesser General Public License for more details.
|
---|
14 |
|
---|
15 | You should have received a copy of the GNU Lesser General Public License
|
---|
16 | along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
---|
17 |
|
---|
18 | #if __GNUC__ >= 3
|
---|
19 | @PRAGMA_SYSTEM_HEADER@
|
---|
20 | #endif
|
---|
21 | @PRAGMA_COLUMNS@
|
---|
22 |
|
---|
23 | #if defined __need_sig_atomic_t || defined __need_sigset_t || defined _GL_ALREADY_INCLUDING_SIGNAL_H || (defined _SIGNAL_H && !defined __SIZEOF_PTHREAD_MUTEX_T)
|
---|
24 | /* Special invocation convention:
|
---|
25 | - Inside glibc header files.
|
---|
26 | - On glibc systems we have a sequence of nested includes
|
---|
27 | <signal.h> -> <ucontext.h> -> <signal.h>.
|
---|
28 | In this situation, the functions are not yet declared, therefore we cannot
|
---|
29 | provide the C++ aliases.
|
---|
30 | - On glibc systems with GCC 4.3 we have a sequence of nested includes
|
---|
31 | <csignal> -> </usr/include/signal.h> -> <sys/ucontext.h> -> <signal.h>.
|
---|
32 | In this situation, some of the functions are not yet declared, therefore
|
---|
33 | we cannot provide the C++ aliases. */
|
---|
34 |
|
---|
35 | # @INCLUDE_NEXT@ @NEXT_SIGNAL_H@
|
---|
36 |
|
---|
37 | #else
|
---|
38 | /* Normal invocation convention. */
|
---|
39 |
|
---|
40 | #ifndef _@GUARD_PREFIX@_SIGNAL_H
|
---|
41 |
|
---|
42 | #define _GL_ALREADY_INCLUDING_SIGNAL_H
|
---|
43 |
|
---|
44 | /* Define pid_t, uid_t.
|
---|
45 | Also, mingw defines sigset_t not in <signal.h>, but in <sys/types.h>.
|
---|
46 | On Solaris 10, <signal.h> includes <sys/types.h>, which eventually includes
|
---|
47 | us; so include <sys/types.h> now, before the second inclusion guard. */
|
---|
48 | #include <sys/types.h>
|
---|
49 |
|
---|
50 | /* The include_next requires a split double-inclusion guard. */
|
---|
51 | #@INCLUDE_NEXT@ @NEXT_SIGNAL_H@
|
---|
52 |
|
---|
53 | #undef _GL_ALREADY_INCLUDING_SIGNAL_H
|
---|
54 |
|
---|
55 | #ifndef _@GUARD_PREFIX@_SIGNAL_H
|
---|
56 | #define _@GUARD_PREFIX@_SIGNAL_H
|
---|
57 |
|
---|
58 | /* Mac OS X 10.3, FreeBSD 6.4, OpenBSD 3.8, OSF/1 4.0, Solaris 2.6, Android,
|
---|
59 | OS/2 kLIBC declare pthread_sigmask in <pthread.h>, not in <signal.h>.
|
---|
60 | But avoid namespace pollution on glibc systems.*/
|
---|
61 | #if (@GNULIB_PTHREAD_SIGMASK@ || defined GNULIB_POSIXCHECK) \
|
---|
62 | && ((defined __APPLE__ && defined __MACH__) \
|
---|
63 | || defined __FreeBSD__ || defined __OpenBSD__ || defined __osf__ \
|
---|
64 | || defined __sun || defined __ANDROID__ || defined __KLIBC__) \
|
---|
65 | && ! defined __GLIBC__
|
---|
66 | # include <pthread.h>
|
---|
67 | #endif
|
---|
68 |
|
---|
69 | /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
|
---|
70 |
|
---|
71 | /* The definition of _GL_ARG_NONNULL is copied here. */
|
---|
72 |
|
---|
73 | /* The definition of _GL_WARN_ON_USE is copied here. */
|
---|
74 |
|
---|
75 | /* On AIX, sig_atomic_t already includes volatile. C99 requires that
|
---|
76 | 'volatile sig_atomic_t' ignore the extra modifier, but C89 did not.
|
---|
77 | Hence, redefine this to a non-volatile type as needed. */
|
---|
78 | #if ! @HAVE_TYPE_VOLATILE_SIG_ATOMIC_T@
|
---|
79 | # if !GNULIB_defined_sig_atomic_t
|
---|
80 | typedef int rpl_sig_atomic_t;
|
---|
81 | # undef sig_atomic_t
|
---|
82 | # define sig_atomic_t rpl_sig_atomic_t
|
---|
83 | # define GNULIB_defined_sig_atomic_t 1
|
---|
84 | # endif
|
---|
85 | #endif
|
---|
86 |
|
---|
87 | /* A set or mask of signals. */
|
---|
88 | #if !@HAVE_SIGSET_T@
|
---|
89 | # if !GNULIB_defined_sigset_t
|
---|
90 | typedef unsigned int sigset_t;
|
---|
91 | # define GNULIB_defined_sigset_t 1
|
---|
92 | # endif
|
---|
93 | #endif
|
---|
94 |
|
---|
95 | /* Define sighandler_t, the type of signal handlers. A GNU extension. */
|
---|
96 | #if !@HAVE_SIGHANDLER_T@
|
---|
97 | # ifdef __cplusplus
|
---|
98 | extern "C" {
|
---|
99 | # endif
|
---|
100 | # if !GNULIB_defined_sighandler_t
|
---|
101 | typedef void (*sighandler_t) (int);
|
---|
102 | # define GNULIB_defined_sighandler_t 1
|
---|
103 | # endif
|
---|
104 | # ifdef __cplusplus
|
---|
105 | }
|
---|
106 | # endif
|
---|
107 | #endif
|
---|
108 |
|
---|
109 |
|
---|
110 | #if @GNULIB_SIGNAL_H_SIGPIPE@
|
---|
111 | # ifndef SIGPIPE
|
---|
112 | /* Define SIGPIPE to a value that does not overlap with other signals. */
|
---|
113 | # define SIGPIPE 13
|
---|
114 | # define GNULIB_defined_SIGPIPE 1
|
---|
115 | /* To actually use SIGPIPE, you also need the gnulib modules 'sigprocmask',
|
---|
116 | 'write', 'stdio'. */
|
---|
117 | # endif
|
---|
118 | #endif
|
---|
119 |
|
---|
120 |
|
---|
121 | /* Maximum signal number + 1. */
|
---|
122 | #ifndef NSIG
|
---|
123 | # if defined __TANDEM
|
---|
124 | # define NSIG 32
|
---|
125 | # endif
|
---|
126 | #endif
|
---|
127 |
|
---|
128 |
|
---|
129 | #if @GNULIB_PTHREAD_SIGMASK@
|
---|
130 | # if @REPLACE_PTHREAD_SIGMASK@
|
---|
131 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
132 | # undef pthread_sigmask
|
---|
133 | # define pthread_sigmask rpl_pthread_sigmask
|
---|
134 | # endif
|
---|
135 | _GL_FUNCDECL_RPL (pthread_sigmask, int,
|
---|
136 | (int how,
|
---|
137 | const sigset_t *restrict new_mask,
|
---|
138 | sigset_t *restrict old_mask));
|
---|
139 | _GL_CXXALIAS_RPL (pthread_sigmask, int,
|
---|
140 | (int how,
|
---|
141 | const sigset_t *restrict new_mask,
|
---|
142 | sigset_t *restrict old_mask));
|
---|
143 | # else
|
---|
144 | # if !(@HAVE_PTHREAD_SIGMASK@ || defined pthread_sigmask)
|
---|
145 | _GL_FUNCDECL_SYS (pthread_sigmask, int,
|
---|
146 | (int how,
|
---|
147 | const sigset_t *restrict new_mask,
|
---|
148 | sigset_t *restrict old_mask));
|
---|
149 | # endif
|
---|
150 | _GL_CXXALIAS_SYS (pthread_sigmask, int,
|
---|
151 | (int how,
|
---|
152 | const sigset_t *restrict new_mask,
|
---|
153 | sigset_t *restrict old_mask));
|
---|
154 | # endif
|
---|
155 | # if __GLIBC__ >= 2
|
---|
156 | _GL_CXXALIASWARN (pthread_sigmask);
|
---|
157 | # endif
|
---|
158 | #elif defined GNULIB_POSIXCHECK
|
---|
159 | # undef pthread_sigmask
|
---|
160 | # if HAVE_RAW_DECL_PTHREAD_SIGMASK
|
---|
161 | _GL_WARN_ON_USE (pthread_sigmask, "pthread_sigmask is not portable - "
|
---|
162 | "use gnulib module pthread_sigmask for portability");
|
---|
163 | # endif
|
---|
164 | #endif
|
---|
165 |
|
---|
166 |
|
---|
167 | #if @GNULIB_RAISE@
|
---|
168 | # if @REPLACE_RAISE@
|
---|
169 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
170 | # undef raise
|
---|
171 | # define raise rpl_raise
|
---|
172 | # endif
|
---|
173 | _GL_FUNCDECL_RPL (raise, int, (int sig));
|
---|
174 | _GL_CXXALIAS_RPL (raise, int, (int sig));
|
---|
175 | # else
|
---|
176 | # if !@HAVE_RAISE@
|
---|
177 | _GL_FUNCDECL_SYS (raise, int, (int sig));
|
---|
178 | # endif
|
---|
179 | _GL_CXXALIAS_SYS (raise, int, (int sig));
|
---|
180 | # endif
|
---|
181 | # if __GLIBC__ >= 2
|
---|
182 | _GL_CXXALIASWARN (raise);
|
---|
183 | # endif
|
---|
184 | #elif defined GNULIB_POSIXCHECK
|
---|
185 | # undef raise
|
---|
186 | /* Assume raise is always declared. */
|
---|
187 | _GL_WARN_ON_USE (raise, "raise can crash on native Windows - "
|
---|
188 | "use gnulib module raise for portability");
|
---|
189 | #endif
|
---|
190 |
|
---|
191 |
|
---|
192 | #if @GNULIB_SIGPROCMASK@
|
---|
193 | # if !@HAVE_POSIX_SIGNALBLOCKING@
|
---|
194 |
|
---|
195 | # ifndef GNULIB_defined_signal_blocking
|
---|
196 | # define GNULIB_defined_signal_blocking 1
|
---|
197 | # endif
|
---|
198 |
|
---|
199 | /* Maximum signal number + 1. */
|
---|
200 | # ifndef NSIG
|
---|
201 | # define NSIG 32
|
---|
202 | # endif
|
---|
203 |
|
---|
204 | /* This code supports only 32 signals. */
|
---|
205 | # if !GNULIB_defined_verify_NSIG_constraint
|
---|
206 | typedef int verify_NSIG_constraint[NSIG <= 32 ? 1 : -1];
|
---|
207 | # define GNULIB_defined_verify_NSIG_constraint 1
|
---|
208 | # endif
|
---|
209 |
|
---|
210 | # endif
|
---|
211 |
|
---|
212 | /* When also using extern inline, suppress the use of static inline in
|
---|
213 | standard headers of problematic Apple configurations, as Libc at
|
---|
214 | least through Libc-825.26 (2013-04-09) mishandles it; see, e.g.,
|
---|
215 | <https://lists.gnu.org/r/bug-gnulib/2012-12/msg00023.html>.
|
---|
216 | Perhaps Apple will fix this some day. */
|
---|
217 | #if (defined _GL_EXTERN_INLINE_IN_USE && defined __APPLE__ \
|
---|
218 | && (defined __i386__ || defined __x86_64__))
|
---|
219 | # undef sigaddset
|
---|
220 | # undef sigdelset
|
---|
221 | # undef sigemptyset
|
---|
222 | # undef sigfillset
|
---|
223 | # undef sigismember
|
---|
224 | #endif
|
---|
225 |
|
---|
226 | /* Test whether a given signal is contained in a signal set. */
|
---|
227 | # if @HAVE_POSIX_SIGNALBLOCKING@
|
---|
228 | /* This function is defined as a macro on Mac OS X. */
|
---|
229 | # if defined __cplusplus && defined GNULIB_NAMESPACE
|
---|
230 | # undef sigismember
|
---|
231 | # endif
|
---|
232 | # else
|
---|
233 | _GL_FUNCDECL_SYS (sigismember, int, (const sigset_t *set, int sig)
|
---|
234 | _GL_ARG_NONNULL ((1)));
|
---|
235 | # endif
|
---|
236 | _GL_CXXALIAS_SYS (sigismember, int, (const sigset_t *set, int sig));
|
---|
237 | _GL_CXXALIASWARN (sigismember);
|
---|
238 |
|
---|
239 | /* Initialize a signal set to the empty set. */
|
---|
240 | # if @HAVE_POSIX_SIGNALBLOCKING@
|
---|
241 | /* This function is defined as a macro on Mac OS X. */
|
---|
242 | # if defined __cplusplus && defined GNULIB_NAMESPACE
|
---|
243 | # undef sigemptyset
|
---|
244 | # endif
|
---|
245 | # else
|
---|
246 | _GL_FUNCDECL_SYS (sigemptyset, int, (sigset_t *set) _GL_ARG_NONNULL ((1)));
|
---|
247 | # endif
|
---|
248 | _GL_CXXALIAS_SYS (sigemptyset, int, (sigset_t *set));
|
---|
249 | _GL_CXXALIASWARN (sigemptyset);
|
---|
250 |
|
---|
251 | /* Add a signal to a signal set. */
|
---|
252 | # if @HAVE_POSIX_SIGNALBLOCKING@
|
---|
253 | /* This function is defined as a macro on Mac OS X. */
|
---|
254 | # if defined __cplusplus && defined GNULIB_NAMESPACE
|
---|
255 | # undef sigaddset
|
---|
256 | # endif
|
---|
257 | # else
|
---|
258 | _GL_FUNCDECL_SYS (sigaddset, int, (sigset_t *set, int sig)
|
---|
259 | _GL_ARG_NONNULL ((1)));
|
---|
260 | # endif
|
---|
261 | _GL_CXXALIAS_SYS (sigaddset, int, (sigset_t *set, int sig));
|
---|
262 | _GL_CXXALIASWARN (sigaddset);
|
---|
263 |
|
---|
264 | /* Remove a signal from a signal set. */
|
---|
265 | # if @HAVE_POSIX_SIGNALBLOCKING@
|
---|
266 | /* This function is defined as a macro on Mac OS X. */
|
---|
267 | # if defined __cplusplus && defined GNULIB_NAMESPACE
|
---|
268 | # undef sigdelset
|
---|
269 | # endif
|
---|
270 | # else
|
---|
271 | _GL_FUNCDECL_SYS (sigdelset, int, (sigset_t *set, int sig)
|
---|
272 | _GL_ARG_NONNULL ((1)));
|
---|
273 | # endif
|
---|
274 | _GL_CXXALIAS_SYS (sigdelset, int, (sigset_t *set, int sig));
|
---|
275 | _GL_CXXALIASWARN (sigdelset);
|
---|
276 |
|
---|
277 | /* Fill a signal set with all possible signals. */
|
---|
278 | # if @HAVE_POSIX_SIGNALBLOCKING@
|
---|
279 | /* This function is defined as a macro on Mac OS X. */
|
---|
280 | # if defined __cplusplus && defined GNULIB_NAMESPACE
|
---|
281 | # undef sigfillset
|
---|
282 | # endif
|
---|
283 | # else
|
---|
284 | _GL_FUNCDECL_SYS (sigfillset, int, (sigset_t *set) _GL_ARG_NONNULL ((1)));
|
---|
285 | # endif
|
---|
286 | _GL_CXXALIAS_SYS (sigfillset, int, (sigset_t *set));
|
---|
287 | _GL_CXXALIASWARN (sigfillset);
|
---|
288 |
|
---|
289 | /* Return the set of those blocked signals that are pending. */
|
---|
290 | # if !@HAVE_POSIX_SIGNALBLOCKING@
|
---|
291 | _GL_FUNCDECL_SYS (sigpending, int, (sigset_t *set) _GL_ARG_NONNULL ((1)));
|
---|
292 | # endif
|
---|
293 | _GL_CXXALIAS_SYS (sigpending, int, (sigset_t *set));
|
---|
294 | _GL_CXXALIASWARN (sigpending);
|
---|
295 |
|
---|
296 | /* If OLD_SET is not NULL, put the current set of blocked signals in *OLD_SET.
|
---|
297 | Then, if SET is not NULL, affect the current set of blocked signals by
|
---|
298 | combining it with *SET as indicated in OPERATION.
|
---|
299 | In this implementation, you are not allowed to change a signal handler
|
---|
300 | while the signal is blocked. */
|
---|
301 | # if !@HAVE_POSIX_SIGNALBLOCKING@
|
---|
302 | # define SIG_BLOCK 0 /* blocked_set = blocked_set | *set; */
|
---|
303 | # define SIG_SETMASK 1 /* blocked_set = *set; */
|
---|
304 | # define SIG_UNBLOCK 2 /* blocked_set = blocked_set & ~*set; */
|
---|
305 | _GL_FUNCDECL_SYS (sigprocmask, int,
|
---|
306 | (int operation,
|
---|
307 | const sigset_t *restrict set,
|
---|
308 | sigset_t *restrict old_set));
|
---|
309 | # endif
|
---|
310 | _GL_CXXALIAS_SYS (sigprocmask, int,
|
---|
311 | (int operation,
|
---|
312 | const sigset_t *restrict set,
|
---|
313 | sigset_t *restrict old_set));
|
---|
314 | _GL_CXXALIASWARN (sigprocmask);
|
---|
315 |
|
---|
316 | /* Install the handler FUNC for signal SIG, and return the previous
|
---|
317 | handler. */
|
---|
318 | # ifdef __cplusplus
|
---|
319 | extern "C" {
|
---|
320 | # endif
|
---|
321 | # if !GNULIB_defined_function_taking_int_returning_void_t
|
---|
322 | typedef void (*_gl_function_taking_int_returning_void_t) (int);
|
---|
323 | # define GNULIB_defined_function_taking_int_returning_void_t 1
|
---|
324 | # endif
|
---|
325 | # ifdef __cplusplus
|
---|
326 | }
|
---|
327 | # endif
|
---|
328 | # if !@HAVE_POSIX_SIGNALBLOCKING@
|
---|
329 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
330 | # define signal rpl_signal
|
---|
331 | # endif
|
---|
332 | _GL_FUNCDECL_RPL (signal, _gl_function_taking_int_returning_void_t,
|
---|
333 | (int sig, _gl_function_taking_int_returning_void_t func));
|
---|
334 | _GL_CXXALIAS_RPL (signal, _gl_function_taking_int_returning_void_t,
|
---|
335 | (int sig, _gl_function_taking_int_returning_void_t func));
|
---|
336 | # else
|
---|
337 | /* On OpenBSD, the declaration of 'signal' may not be present at this point,
|
---|
338 | because it occurs in <sys/signal.h>, not <signal.h> directly. */
|
---|
339 | # if defined __OpenBSD__
|
---|
340 | _GL_FUNCDECL_SYS (signal, _gl_function_taking_int_returning_void_t,
|
---|
341 | (int sig, _gl_function_taking_int_returning_void_t func));
|
---|
342 | # endif
|
---|
343 | _GL_CXXALIAS_SYS (signal, _gl_function_taking_int_returning_void_t,
|
---|
344 | (int sig, _gl_function_taking_int_returning_void_t func));
|
---|
345 | # endif
|
---|
346 | # if __GLIBC__ >= 2
|
---|
347 | _GL_CXXALIASWARN (signal);
|
---|
348 | # endif
|
---|
349 |
|
---|
350 | # if !@HAVE_POSIX_SIGNALBLOCKING@ && GNULIB_defined_SIGPIPE
|
---|
351 | /* Raise signal SIGPIPE. */
|
---|
352 | _GL_EXTERN_C int _gl_raise_SIGPIPE (void);
|
---|
353 | # endif
|
---|
354 |
|
---|
355 | #elif defined GNULIB_POSIXCHECK
|
---|
356 | # undef sigaddset
|
---|
357 | # if HAVE_RAW_DECL_SIGADDSET
|
---|
358 | _GL_WARN_ON_USE (sigaddset, "sigaddset is unportable - "
|
---|
359 | "use the gnulib module sigprocmask for portability");
|
---|
360 | # endif
|
---|
361 | # undef sigdelset
|
---|
362 | # if HAVE_RAW_DECL_SIGDELSET
|
---|
363 | _GL_WARN_ON_USE (sigdelset, "sigdelset is unportable - "
|
---|
364 | "use the gnulib module sigprocmask for portability");
|
---|
365 | # endif
|
---|
366 | # undef sigemptyset
|
---|
367 | # if HAVE_RAW_DECL_SIGEMPTYSET
|
---|
368 | _GL_WARN_ON_USE (sigemptyset, "sigemptyset is unportable - "
|
---|
369 | "use the gnulib module sigprocmask for portability");
|
---|
370 | # endif
|
---|
371 | # undef sigfillset
|
---|
372 | # if HAVE_RAW_DECL_SIGFILLSET
|
---|
373 | _GL_WARN_ON_USE (sigfillset, "sigfillset is unportable - "
|
---|
374 | "use the gnulib module sigprocmask for portability");
|
---|
375 | # endif
|
---|
376 | # undef sigismember
|
---|
377 | # if HAVE_RAW_DECL_SIGISMEMBER
|
---|
378 | _GL_WARN_ON_USE (sigismember, "sigismember is unportable - "
|
---|
379 | "use the gnulib module sigprocmask for portability");
|
---|
380 | # endif
|
---|
381 | # undef sigpending
|
---|
382 | # if HAVE_RAW_DECL_SIGPENDING
|
---|
383 | _GL_WARN_ON_USE (sigpending, "sigpending is unportable - "
|
---|
384 | "use the gnulib module sigprocmask for portability");
|
---|
385 | # endif
|
---|
386 | # undef sigprocmask
|
---|
387 | # if HAVE_RAW_DECL_SIGPROCMASK
|
---|
388 | _GL_WARN_ON_USE (sigprocmask, "sigprocmask is unportable - "
|
---|
389 | "use the gnulib module sigprocmask for portability");
|
---|
390 | # endif
|
---|
391 | #endif /* @GNULIB_SIGPROCMASK@ */
|
---|
392 |
|
---|
393 |
|
---|
394 | #if @GNULIB_SIGACTION@
|
---|
395 | # if !@HAVE_SIGACTION@
|
---|
396 |
|
---|
397 | # if !@HAVE_SIGINFO_T@
|
---|
398 |
|
---|
399 | # if !GNULIB_defined_siginfo_types
|
---|
400 |
|
---|
401 | /* Present to allow compilation, but unsupported by gnulib. */
|
---|
402 | union sigval
|
---|
403 | {
|
---|
404 | int sival_int;
|
---|
405 | void *sival_ptr;
|
---|
406 | };
|
---|
407 |
|
---|
408 | /* Present to allow compilation, but unsupported by gnulib. */
|
---|
409 | struct siginfo_t
|
---|
410 | {
|
---|
411 | int si_signo;
|
---|
412 | int si_code;
|
---|
413 | int si_errno;
|
---|
414 | pid_t si_pid;
|
---|
415 | uid_t si_uid;
|
---|
416 | void *si_addr;
|
---|
417 | int si_status;
|
---|
418 | long si_band;
|
---|
419 | union sigval si_value;
|
---|
420 | };
|
---|
421 | typedef struct siginfo_t siginfo_t;
|
---|
422 |
|
---|
423 | # define GNULIB_defined_siginfo_types 1
|
---|
424 | # endif
|
---|
425 |
|
---|
426 | # endif /* !@HAVE_SIGINFO_T@ */
|
---|
427 |
|
---|
428 | /* We assume that platforms which lack the sigaction() function also lack
|
---|
429 | the 'struct sigaction' type, and vice versa. */
|
---|
430 |
|
---|
431 | # if !GNULIB_defined_struct_sigaction
|
---|
432 |
|
---|
433 | struct sigaction
|
---|
434 | {
|
---|
435 | union
|
---|
436 | {
|
---|
437 | void (*_sa_handler) (int);
|
---|
438 | /* Present to allow compilation, but unsupported by gnulib. POSIX
|
---|
439 | says that implementations may, but not must, make sa_sigaction
|
---|
440 | overlap with sa_handler, but we know of no implementation where
|
---|
441 | they do not overlap. */
|
---|
442 | void (*_sa_sigaction) (int, siginfo_t *, void *);
|
---|
443 | } _sa_func;
|
---|
444 | sigset_t sa_mask;
|
---|
445 | /* Not all POSIX flags are supported. */
|
---|
446 | int sa_flags;
|
---|
447 | };
|
---|
448 | # define sa_handler _sa_func._sa_handler
|
---|
449 | # define sa_sigaction _sa_func._sa_sigaction
|
---|
450 | /* Unsupported flags are not present. */
|
---|
451 | # define SA_RESETHAND 1
|
---|
452 | # define SA_NODEFER 2
|
---|
453 | # define SA_RESTART 4
|
---|
454 |
|
---|
455 | # define GNULIB_defined_struct_sigaction 1
|
---|
456 | # endif
|
---|
457 |
|
---|
458 | _GL_FUNCDECL_SYS (sigaction, int, (int, const struct sigaction *restrict,
|
---|
459 | struct sigaction *restrict));
|
---|
460 |
|
---|
461 | # elif !@HAVE_STRUCT_SIGACTION_SA_SIGACTION@
|
---|
462 |
|
---|
463 | # define sa_sigaction sa_handler
|
---|
464 |
|
---|
465 | # endif /* !@HAVE_SIGACTION@, !@HAVE_STRUCT_SIGACTION_SA_SIGACTION@ */
|
---|
466 |
|
---|
467 | _GL_CXXALIAS_SYS (sigaction, int, (int, const struct sigaction *restrict,
|
---|
468 | struct sigaction *restrict));
|
---|
469 | _GL_CXXALIASWARN (sigaction);
|
---|
470 |
|
---|
471 | #elif defined GNULIB_POSIXCHECK
|
---|
472 | # undef sigaction
|
---|
473 | # if HAVE_RAW_DECL_SIGACTION
|
---|
474 | _GL_WARN_ON_USE (sigaction, "sigaction is unportable - "
|
---|
475 | "use the gnulib module sigaction for portability");
|
---|
476 | # endif
|
---|
477 | #endif
|
---|
478 |
|
---|
479 | /* Some systems don't have SA_NODEFER. */
|
---|
480 | #ifndef SA_NODEFER
|
---|
481 | # define SA_NODEFER 0
|
---|
482 | #endif
|
---|
483 |
|
---|
484 |
|
---|
485 | #endif /* _@GUARD_PREFIX@_SIGNAL_H */
|
---|
486 | #endif /* _@GUARD_PREFIX@_SIGNAL_H */
|
---|
487 | #endif
|
---|