* lib/fcntl_.h: Prefer #include_next <foo.h> to #include
[gnulib.git] / lib / signal_.h
1 /* A GNU-like <signal.h>.
2
3    Copyright (C) 2006-2007 Free Software Foundation, Inc.
4
5    This program is free software; you can redistribute it and/or modify
6    it under the terms of the GNU General Public License as published by
7    the Free Software Foundation; either version 2, or (at your option)
8    any later version.
9
10    This program 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 General Public License for more details.
14
15    You should have received a copy of the GNU General Public License
16    along with this program; if not, write to the Free Software Foundation,
17    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
18
19 #if defined __need_sig_atomic_t || defined __need_sigset_t
20 /* Special invocation convention inside glibc header files.  */
21
22 # if @HAVE_INCLUDE_NEXT@
23 #  include_next <signal.h>
24 # else
25 #  include @ABSOLUTE_SIGNAL_H@
26 # endif
27
28 #else
29 /* Normal invocation convention.  */
30
31 #ifndef _GL_SIGNAL_H
32 #define _GL_SIGNAL_H
33
34 #if @HAVE_INCLUDE_NEXT@
35 # include_next <signal.h>
36 #else
37 # include @ABSOLUTE_SIGNAL_H@
38 #endif
39
40 /* The definition of GL_LINK_WARNING is copied here.  */
41
42
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46
47
48 #if !@HAVE_POSIX_SIGNALBLOCKING@
49
50 /* Mingw defines sigset_t not in <signal.h>, but in <sys/types.h>.  */
51 # include <sys/types.h>
52
53 /* Maximum signal number + 1.  */
54 # ifndef NSIG
55 #  define NSIG 32
56 # endif
57
58 /* This code supports only 32 signals.  */
59 typedef int verify_NSIG_constraint[2 * (NSIG <= 32) - 1];
60
61 /* A set or mask of signals.  */
62 # if !@HAVE_SIGSET_T@
63 typedef unsigned int sigset_t;
64 # endif
65
66 /* Test whether a given signal is contained in a signal set.  */
67 extern int sigismember (const sigset_t *set, int sig);
68
69 /* Initialize a signal set to the empty set.  */
70 extern int sigemptyset (sigset_t *set);
71
72 /* Add a signal to a signal set.  */
73 extern int sigaddset (sigset_t *set, int sig);
74
75 /* Remove a signal from a signal set.  */
76 extern int sigdelset (sigset_t *set, int sig);
77
78 /* Fill a signal set with all possible signals.  */
79 extern int sigfillset (sigset_t *set);
80
81 /* Return the set of those blocked signals that are pending.  */
82 extern int sigpending (sigset_t *set);
83
84 /* If OLD_SET is not NULL, put the current set of blocked signals in *OLD_SET.
85    Then, if SET is not NULL, affect the current set of blocked signals by
86    combining it with *SET as indicated in OPERATION.
87    In this implementation, you are not allowed to change a signal handler
88    while the signal is blocked.  */
89 # define SIG_BLOCK   0  /* blocked_set = blocked_set | *set; */
90 # define SIG_SETMASK 1  /* blocked_set = *set; */
91 # define SIG_UNBLOCK 2  /* blocked_set = blocked_set & ~*set; */
92 extern int sigprocmask (int operation, const sigset_t *set, sigset_t *old_set);
93
94 #endif
95
96
97 #ifdef __cplusplus
98 }
99 #endif
100
101 #endif /* _GL_SIGNAL_H */
102 #endif