regex: treat \| in BRE as alternation
[musl.git] / include / signal.h
blobc6323c613ddfcd75729d8664684e565cf5308161
1 #ifndef _SIGNAL_H
2 #define _SIGNAL_H
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
8 #include <features.h>
10 #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
11 || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
12 || defined(_BSD_SOURCE)
14 #ifdef _GNU_SOURCE
15 #define __ucontext ucontext
16 #endif
18 #define __NEED_size_t
19 #define __NEED_pid_t
20 #define __NEED_uid_t
21 #define __NEED_struct_timespec
22 #define __NEED_pthread_t
23 #define __NEED_pthread_attr_t
24 #define __NEED_time_t
25 #define __NEED_clock_t
26 #define __NEED_sigset_t
28 #include <bits/alltypes.h>
30 #define SIG_BLOCK 0
31 #define SIG_UNBLOCK 1
32 #define SIG_SETMASK 2
34 #define SI_ASYNCNL (-60)
35 #define SI_TKILL (-6)
36 #define SI_SIGIO (-5)
37 #define SI_ASYNCIO (-4)
38 #define SI_MESGQ (-3)
39 #define SI_TIMER (-2)
40 #define SI_QUEUE (-1)
41 #define SI_USER 0
42 #define SI_KERNEL 128
44 typedef struct sigaltstack stack_t;
46 #endif
48 #include <bits/signal.h>
50 #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
51 || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
52 || defined(_BSD_SOURCE)
54 #define SIG_HOLD ((void (*)(int)) 2)
56 #define FPE_INTDIV 1
57 #define FPE_INTOVF 2
58 #define FPE_FLTDIV 3
59 #define FPE_FLTOVF 4
60 #define FPE_FLTUND 5
61 #define FPE_FLTRES 6
62 #define FPE_FLTINV 7
63 #define FPE_FLTSUB 8
65 #define ILL_ILLOPC 1
66 #define ILL_ILLOPN 2
67 #define ILL_ILLADR 3
68 #define ILL_ILLTRP 4
69 #define ILL_PRVOPC 5
70 #define ILL_PRVREG 6
71 #define ILL_COPROC 7
72 #define ILL_BADSTK 8
74 #define SEGV_MAPERR 1
75 #define SEGV_ACCERR 2
76 #define SEGV_BNDERR 3
78 #define BUS_ADRALN 1
79 #define BUS_ADRERR 2
80 #define BUS_OBJERR 3
81 #define BUS_MCEERR_AR 4
82 #define BUS_MCEERR_AO 5
84 #define CLD_EXITED 1
85 #define CLD_KILLED 2
86 #define CLD_DUMPED 3
87 #define CLD_TRAPPED 4
88 #define CLD_STOPPED 5
89 #define CLD_CONTINUED 6
91 union sigval {
92 int sival_int;
93 void *sival_ptr;
96 typedef struct {
97 #ifdef __SI_SWAP_ERRNO_CODE
98 int si_signo, si_code, si_errno;
99 #else
100 int si_signo, si_errno, si_code;
101 #endif
102 union {
103 char __pad[128 - 2*sizeof(int) - sizeof(long)];
104 struct {
105 union {
106 struct {
107 pid_t si_pid;
108 uid_t si_uid;
109 } __piduid;
110 struct {
111 int si_timerid;
112 int si_overrun;
113 } __timer;
114 } __first;
115 union {
116 union sigval si_value;
117 struct {
118 int si_status;
119 clock_t si_utime, si_stime;
120 } __sigchld;
121 } __second;
122 } __si_common;
123 struct {
124 void *si_addr;
125 short si_addr_lsb;
126 struct {
127 void *si_lower;
128 void *si_upper;
129 } __addr_bnd;
130 } __sigfault;
131 struct {
132 long si_band;
133 int si_fd;
134 } __sigpoll;
135 struct {
136 void *si_call_addr;
137 int si_syscall;
138 unsigned si_arch;
139 } __sigsys;
140 } __si_fields;
141 } siginfo_t;
142 #define si_pid __si_fields.__si_common.__first.__piduid.si_pid
143 #define si_uid __si_fields.__si_common.__first.__piduid.si_uid
144 #define si_status __si_fields.__si_common.__second.__sigchld.si_status
145 #define si_utime __si_fields.__si_common.__second.__sigchld.si_utime
146 #define si_stime __si_fields.__si_common.__second.__sigchld.si_stime
147 #define si_value __si_fields.__si_common.__second.si_value
148 #define si_addr __si_fields.__sigfault.si_addr
149 #define si_addr_lsb __si_fields.__sigfault.si_addr_lsb
150 #define si_lower __si_fields.__sigfault.__addr_bnd.si_lower
151 #define si_upper __si_fields.__sigfault.__addr_bnd.si_upper
152 #define si_band __si_fields.__sigpoll.si_band
153 #define si_fd __si_fields.__sigpoll.si_fd
154 #define si_timerid __si_fields.__si_common.__first.__timer.si_timerid
155 #define si_overrun __si_fields.__si_common.__first.__timer.si_overrun
156 #define si_ptr si_value.sival_ptr
157 #define si_int si_value.sival_int
158 #define si_call_addr __si_fields.__sigsys.si_call_addr
159 #define si_syscall __si_fields.__sigsys.si_syscall
160 #define si_arch __si_fields.__sigsys.si_arch
162 struct sigaction {
163 union {
164 void (*sa_handler)(int);
165 void (*sa_sigaction)(int, siginfo_t *, void *);
166 } __sa_handler;
167 sigset_t sa_mask;
168 int sa_flags;
169 void (*sa_restorer)(void);
171 #define sa_handler __sa_handler.sa_handler
172 #define sa_sigaction __sa_handler.sa_sigaction
174 struct sigevent {
175 union sigval sigev_value;
176 int sigev_signo;
177 int sigev_notify;
178 void (*sigev_notify_function)(union sigval);
179 pthread_attr_t *sigev_notify_attributes;
180 char __pad[56-3*sizeof(long)];
183 #define SIGEV_SIGNAL 0
184 #define SIGEV_NONE 1
185 #define SIGEV_THREAD 2
187 int __libc_current_sigrtmin(void);
188 int __libc_current_sigrtmax(void);
190 #define SIGRTMIN (__libc_current_sigrtmin())
191 #define SIGRTMAX (__libc_current_sigrtmax())
193 int kill(pid_t, int);
195 int sigemptyset(sigset_t *);
196 int sigfillset(sigset_t *);
197 int sigaddset(sigset_t *, int);
198 int sigdelset(sigset_t *, int);
199 int sigismember(const sigset_t *, int);
201 int sigprocmask(int, const sigset_t *__restrict, sigset_t *__restrict);
202 int sigsuspend(const sigset_t *);
203 int sigaction(int, const struct sigaction *__restrict, struct sigaction *__restrict);
204 int sigpending(sigset_t *);
205 int sigwait(const sigset_t *__restrict, int *__restrict);
206 int sigwaitinfo(const sigset_t *__restrict, siginfo_t *__restrict);
207 int sigtimedwait(const sigset_t *__restrict, siginfo_t *__restrict, const struct timespec *__restrict);
208 int sigqueue(pid_t, int, const union sigval);
210 int pthread_sigmask(int, const sigset_t *__restrict, sigset_t *__restrict);
211 int pthread_kill(pthread_t, int);
213 void psiginfo(const siginfo_t *, const char *);
214 void psignal(int, const char *);
216 #endif
218 #if defined(_XOPEN_SOURCE) || defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
219 int killpg(pid_t, int);
220 int sigaltstack(const stack_t *__restrict, stack_t *__restrict);
221 int sighold(int);
222 int sigignore(int);
223 int siginterrupt(int, int);
224 int sigpause(int);
225 int sigrelse(int);
226 void (*sigset(int, void (*)(int)))(int);
227 #define TRAP_BRKPT 1
228 #define TRAP_TRACE 2
229 #define POLL_IN 1
230 #define POLL_OUT 2
231 #define POLL_MSG 3
232 #define POLL_ERR 4
233 #define POLL_PRI 5
234 #define POLL_HUP 6
235 #define SS_ONSTACK 1
236 #define SS_DISABLE 2
237 #endif
239 #if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
240 #define NSIG _NSIG
241 typedef void (*sig_t)(int);
242 #endif
244 #ifdef _GNU_SOURCE
245 typedef void (*sighandler_t)(int);
246 void (*bsd_signal(int, void (*)(int)))(int);
247 int sigisemptyset(const sigset_t *);
248 int sigorset (sigset_t *, const sigset_t *, const sigset_t *);
249 int sigandset(sigset_t *, const sigset_t *, const sigset_t *);
251 #define SA_NOMASK SA_NODEFER
252 #define SA_ONESHOT SA_RESETHAND
253 #endif
255 #define SIG_ERR ((void (*)(int))-1)
256 #define SIG_DFL ((void (*)(int)) 0)
257 #define SIG_IGN ((void (*)(int)) 1)
259 typedef int sig_atomic_t;
261 void (*signal(int, void (*)(int)))(int);
262 int raise(int);
264 #ifdef __cplusplus
266 #endif
268 #endif