10 #include <sys/features.h>
11 #include <sys/types.h>
13 /* #ifndef __STRICT_ANSI__*/
15 /* Cygwin defines it's own sigset_t in include/cygwin/signal.h */
17 typedef unsigned long sigset_t;
20 #if defined(__rtems__) || defined (__native_client__)
22 #if defined(_POSIX_REALTIME_SIGNALS)
24 /* sigev_notify values
25 NOTE: P1003.1c/D10, p. 34 adds SIGEV_THREAD. */
27 #define SIGEV_NONE 1 /* No asynchronous notification shall be delivered */
28 /* when the event of interest occurs. */
29 #define SIGEV_SIGNAL 2 /* A queued signal, with an application defined */
30 /* value, shall be delivered when the event of */
31 /* interest occurs. */
32 #define SIGEV_THREAD 3 /* A notification function shall be called to */
33 /* perform notification. */
35 /* Signal Generation and Delivery, P1003.1b-1993, p. 63
36 NOTE: P1003.1c/D10, p. 34 adds sigev_notify_function and
37 sigev_notify_attributes to the sigevent structure. */
40 int sival_int; /* Integer signal value */
41 void *sival_ptr; /* Pointer signal value */
45 int sigev_notify; /* Notification type */
46 int sigev_signo; /* Signal number */
47 union sigval sigev_value; /* Signal value */
49 #if defined(_POSIX_THREADS)
50 void (*sigev_notify_function)( union sigval );
51 /* Notification function */
52 pthread_attr_t *sigev_notify_attributes; /* Notification Attributes */
56 /* Signal Actions, P1003.1b-1993, p. 64 */
57 /* si_code values, p. 66 */
59 #define SI_USER 1 /* Sent by a user. kill(), abort(), etc */
60 #define SI_QUEUE 2 /* Sent by sigqueue() */
61 #define SI_TIMER 3 /* Sent by expiration of a timer_settime() timer */
62 #define SI_ASYNCIO 4 /* Indicates completion of asycnhronous IO */
63 #define SI_MESGQ 5 /* Indicates arrival of a message at an empty queue */
66 int si_signo; /* Signal number */
67 int si_code; /* Cause of the signal */
68 union sigval si_value; /* Signal value */
72 /* 3.3.8 Synchronously Accept a Signal, P1003.1b-1993, p. 76 */
74 #define SA_NOCLDSTOP 1 /* Do not generate SIGCHLD when children stop */
75 #define SA_SIGINFO 2 /* Invoke the signal catching function with */
76 /* three arguments instead of one. */
78 /* struct sigaction notes from POSIX:
80 * (1) Routines stored in sa_handler should take a single int as
81 * their argument although the POSIX standard does not require this.
82 * This is not longer true since at least POSIX.1-2008
83 * (2) The fields sa_handler and sa_sigaction may overlap, and a conforming
84 * application should not use both simultaneously.
87 typedef void (*_sig_func_ptr)(int);
90 int sa_flags; /* Special flags to affect behavior of signal */
91 sigset_t sa_mask; /* Additional set of signals to be blocked */
92 /* during execution of signal-catching */
95 _sig_func_ptr _handler; /* SIG_DFL, SIG_IGN, or pointer to a function */
96 #if defined(_POSIX_REALTIME_SIGNALS)
97 void (*_sigaction)( int, siginfo_t *, void * );
102 #define sa_handler _signal_handlers._handler
103 #if defined(_POSIX_REALTIME_SIGNALS)
104 #define sa_sigaction _signal_handlers._sigaction
107 #elif defined(__CYGWIN__)
108 #include <cygwin/signal.h>
110 #define SA_NOCLDSTOP 1 /* only value supported now for sa_flags */
112 typedef void (*_sig_func_ptr)(int);
116 _sig_func_ptr sa_handler;
120 #endif /* defined(__rtems__) || defined(__native_client__) */
122 #define SIG_SETMASK 0 /* set mask with sigprocmask() */
123 #define SIG_BLOCK 1 /* set of signals to block */
124 #define SIG_UNBLOCK 2 /* set of signals to, well, unblock */
126 /* These depend upon the type of sigset_t, which right now
127 is always a long.. They're in the POSIX namespace, but
129 #define sigaddset(what,sig) (*(what) |= (1<<(sig)), 0)
130 #define sigdelset(what,sig) (*(what) &= ~(1<<(sig)), 0)
131 #define sigemptyset(what) (*(what) = 0, 0)
132 #define sigfillset(what) (*(what) = ~(0), 0)
133 #define sigismember(what,sig) (((*(what)) & (1<<(sig))) != 0)
135 int _EXFUN(sigprocmask, (int how, const sigset_t *set, sigset_t *oset));
137 #if defined(_POSIX_THREADS)
138 int _EXFUN(pthread_sigmask, (int how, const sigset_t *set, sigset_t *oset));
141 /* protos for functions found in winsup sources for CYGWIN */
142 #if defined(__CYGWIN__) || defined(__rtems__) || defined(__native_client__)
149 #ifdef _COMPILING_NEWLIB
150 int _EXFUN(_kill, (pid_t, int));
152 int _EXFUN(kill, (pid_t, int));
153 int _EXFUN(killpg, (pid_t, int));
154 int _EXFUN(sigaction, (int, const struct sigaction *, struct sigaction *));
155 int _EXFUN(sigaddset, (sigset_t *, const int));
156 int _EXFUN(sigdelset, (sigset_t *, const int));
157 int _EXFUN(sigismember, (const sigset_t *, int));
158 int _EXFUN(sigfillset, (sigset_t *));
159 int _EXFUN(sigemptyset, (sigset_t *));
160 int _EXFUN(sigpending, (sigset_t *));
161 int _EXFUN(sigsuspend, (const sigset_t *));
162 int _EXFUN(sigpause, (int));
164 #if defined(_POSIX_THREADS) && !defined(__native_client__)
166 # ifndef _CYGWIN_TYPES_H
167 # error You need the winsup sources or a cygwin installation to compile the cygwin version of newlib.
170 int _EXFUN(pthread_kill, (pthread_t thread, int sig));
173 #if defined(_POSIX_REALTIME_SIGNALS)
175 /* 3.3.8 Synchronously Accept a Signal, P1003.1b-1993, p. 76
176 NOTE: P1003.1c/D10, p. 39 adds sigwait(). */
178 int _EXFUN(sigwaitinfo, (const sigset_t *set, siginfo_t *info));
179 int _EXFUN(sigtimedwait,
180 (const sigset_t *set, siginfo_t *info, const struct timespec *timeout)
182 int _EXFUN(sigwait, (const sigset_t *set, int *sig));
184 /* 3.3.9 Queue a Signal to a Process, P1003.1b-1993, p. 78 */
185 int _EXFUN(sigqueue, (pid_t pid, int signo, const union sigval value));
187 #endif /* defined(_POSIX_REALTIME_SIGNALS) */
189 #endif /* defined(__CYGWIN__) || defined(__rtems__) */
191 /* #endif __STRICT_ANSI__ */
193 #if defined(___AM29K__)
194 /* These all need to be defined for ANSI C, but I don't think they are
202 /* These need to be defined for POSIX, and some others do too. */
206 #elif defined(__GO32__)
227 #elif !defined(SIGTRAP)
228 #define SIGHUP 1 /* hangup */
229 #define SIGINT 2 /* interrupt */
230 #define SIGQUIT 3 /* quit */
231 #define SIGILL 4 /* illegal instruction (not reset when caught) */
232 #define SIGTRAP 5 /* trace trap (not reset when caught) */
233 #define SIGIOT 6 /* IOT instruction */
234 #define SIGABRT 6 /* used by abort, replace SIGIOT in the future */
235 #define SIGEMT 7 /* EMT instruction */
236 #define SIGFPE 8 /* floating point exception */
237 #define SIGKILL 9 /* kill (cannot be caught or ignored) */
238 #define SIGBUS 10 /* bus error */
239 #define SIGSEGV 11 /* segmentation violation */
240 #define SIGSYS 12 /* bad argument to system call */
241 #define SIGPIPE 13 /* write on a pipe with no one to read it */
242 #define SIGALRM 14 /* alarm clock */
243 #define SIGTERM 15 /* software termination signal from kill */
245 #if defined(__rtems__)
246 #define SIGURG 16 /* urgent condition on IO channel */
247 #define SIGSTOP 17 /* sendable stop signal not from tty */
248 #define SIGTSTP 18 /* stop signal from tty */
249 #define SIGCONT 19 /* continue a stopped process */
250 #define SIGCHLD 20 /* to parent on child stop or exit */
251 #define SIGCLD 20 /* System V name for SIGCHLD */
252 #define SIGTTIN 21 /* to readers pgrp upon background tty read */
253 #define SIGTTOU 22 /* like TTIN for output if (tp->t_local<OSTOP) */
254 #define SIGIO 23 /* input/output possible signal */
255 #define SIGPOLL SIGIO /* System V name for SIGIO */
256 #define SIGWINCH 24 /* window changed */
257 #define SIGUSR1 25 /* user defined signal 1 */
258 #define SIGUSR2 26 /* user defined signal 2 */
260 /* Real-Time Signals Range, P1003.1b-1993, p. 61
261 NOTE: By P1003.1b-1993, this should be at least RTSIG_MAX
262 (which is a minimum of 8) signals.
266 #define __SIGFIRSTNOTRT SIGHUP
267 #define __SIGLASTNOTRT SIGUSR2
269 #define NSIG 32 /* signal 0 implied */
271 #elif defined(__svr4__)
272 /* svr4 specifics. different signals above 15, and sigaction. */
278 #define SIGPOLL 22 /* 20 for x.out binaries!!!! */
279 #define SIGSTOP 23 /* sendable stop signal not from tty */
280 #define SIGTSTP 24 /* stop signal from tty */
281 #define SIGCONT 25 /* continue a stopped process */
282 #define SIGTTIN 26 /* to readers pgrp upon background tty read */
283 #define SIGTTOU 27 /* like TTIN for output if (tp->t_local<OSTOP) */
286 #define SIGURG 16 /* urgent condition on IO channel */
287 #define SIGSTOP 17 /* sendable stop signal not from tty */
288 #define SIGTSTP 18 /* stop signal from tty */
289 #define SIGCONT 19 /* continue a stopped process */
290 #define SIGCHLD 20 /* to parent on child stop or exit */
291 #define SIGCLD 20 /* System V name for SIGCHLD */
292 #define SIGTTIN 21 /* to readers pgrp upon background tty read */
293 #define SIGTTOU 22 /* like TTIN for output if (tp->t_local<OSTOP) */
294 #define SIGIO 23 /* input/output possible signal */
295 #define SIGPOLL SIGIO /* System V name for SIGIO */
296 #define SIGXCPU 24 /* exceeded CPU time limit */
297 #define SIGXFSZ 25 /* exceeded file size limit */
298 #define SIGVTALRM 26 /* virtual time alarm */
299 #define SIGPROF 27 /* profiling time alarm */
300 #define SIGWINCH 28 /* window changed */
301 #define SIGLOST 29 /* resource lost (eg, record-lock lost) */
302 #define SIGUSR1 30 /* user defined signal 1 */
303 #define SIGUSR2 31 /* user defined signal 2 */
304 #define NSIG 32 /* signal 0 implied */
313 /* Some applications take advantage of the fact that <sys/signal.h>
314 * and <signal.h> are equivalent in glibc. Allow for that here. */
317 #endif /* _SYS_SIGNAL_H */