5 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
8 System header file <signal.h>
9 Based on SUSv2 with help from C99.
12 #include <sys/cdefs.h>
14 typedef void __sighandler_t (int);
16 #define SIG_DFL ((__sighandler_t *)0) /* default signal handling */
17 #define SIG_IGN ((__sighandler_t *)1) /* ignore this signal */
18 #if !defined(_ANSI_SOURCE)
19 #define SIG_HOLD ((__sighandler_t *)2) /* hold this signal */
21 #define SIG_ERR ((__sighandler_t *)-1) /* return from signal() on error */
23 typedef AROS_SIG_ATOMIC_T
sig_atomic_t;
25 /* Definitions to make signal manipulation easier. From FreeBSD */
26 #define _SIG_IDX(sig) ((sig) - 1)
27 #define _SIG_WORD(sig) (_SIG_IDX(sig) >> 5)
28 #define _SIG_BIT(sig) (1 << (_SIG_IDX(sig) & 31))
29 #define _SIG_VALID(sig) ((sig) < _SIG_MAXSIG && (sig) > 0)
31 /* Almost all the remaining definitions are not part of ANSI C */
32 #if !defined(_ANSI_SOURCE)
34 #include <aros/types/sigset_t.h>
35 #include <aros/types/pid_t.h>
37 #endif /* !_ANSI_SOURCE */
40 #define SIGHUP 1 /* hangup */
41 #define SIGINT 2 /* interrupt */
42 #define SIGQUIT 3 /* quit */
43 #define SIGILL 4 /* illegal instr. */
44 #if !defined(_POSIX_SOURCE)
45 #define SIGTRAP 5 /* trace/breakpoint track */
47 #define SIGABRT 6 /* abort() */
48 #if !defined(_POSIX_SOURCE)
49 #define SIGEMT 7 /* EMT instruction (emulator trap) */
51 #define SIGFPE 8 /* floating point exception */
52 #define SIGKILL 9 /* kill (cannot be caught or ignored) */
53 #if !defined(_POSIX_SOURCE)
54 #define SIGBUS 10 /* bus error */
56 #define SIGSEGV 11 /* segmentation violation */
57 #if !defined(_POSIX_SOURCE)
58 #define SIGSYS 12 /* non-existent system call */
60 #define SIGPIPE 13 /* write on a pipe without a reader */
61 #define SIGALRM 14 /* alarm clock */
62 #define SIGTERM 15 /* software termination */
63 #if !defined(_POSIX_SOURCE)
64 #define SIGURG 16 /* urgent IO condition */
66 #define SIGSTOP 17 /* sendable stop signal */
67 #define SIGTSTP 18 /* terminal stop signal */
68 #define SIGCONT 19 /* continue a stopped process */
69 #define SIGCHLD 20 /* to parent on child stop or exit */
70 #define SIGTTIN 21 /* to reader to background tty read */
71 #define SIGTTOU 22 /* to writer on background tty write */
72 #if !defined(_POSIX_SOURCE)
73 #define SIGXCPU 23 /* exceeded CPU time limit */
74 #define SIGXFSZ 24 /* exceeded file size limit */
75 #define SIGVTALRM 25 /* virtual timer alarm */
76 #define SIGPROF 26 /* profiling time alarm */
77 #define SIGWINCH 27 /* window size changes */
79 #define SIGUSR1 28 /* user defined signal 1 */
80 #define SIGUSR2 29 /* user defined signal 2 */
82 #if !defined(_POSIX_SOURCE)
83 /* BSD defines SIGIO and SIGINFO, we should probably include these */
84 #define SIGIO 30 /* IO event */
85 #define SIGINFO 31 /* terminal info request */
88 #if defined(_P1003_1B_VISIBLE)
90 /* Real time signals as specified by POSIX 1003.1B */
129 sigevent() is an advanced call that allows a process to request the
130 system to perform more advanced signal delivery that calling signal
133 AROS allows for signals to be queued, delivered normally, or by
134 creating a new thread and calling a function.
136 See the sigevent() manual page for more information.
138 #include <aros/types/sigevent_s.h>
142 XXX Note that we do not support sigev_notify_attributes
144 #define sigev_notify_function \
145 __sigev_u.__sigev_notify_call.__sigenv_notify_function
147 #endif /* P1003_1B_VISIBLE */
149 #if !defined(_ANSI_SOURCE)
151 #include <aros/types/sigaction_s.h>
153 #if !defined(_POSIX_SOURCE)
155 #include <aros/types/size_t.h>
156 #include <aros/types/stack_t.h>
160 int ss_onstack
; /* non-zero when signal stack in use */
161 void *ss_sp
; /* signal stack pointer */
164 #define MINSIGSTKSZ 8192
165 #define SIGSTKSZ (MINSIGSTKSZ + 40960)
167 #include <aros/types/ucontext_t.h>
168 #include <aros/types/siginfo_t.h>
170 /* Tag for struct timespec */
173 #endif /* !_POSIX_SOURCE */
175 /* Flags for sigprocmask() */
177 #define SIG_UNBLOCK 2
178 #define SIG_SETMASK 34
180 #endif /* !_ANSI_SOURCE */
182 /* Function Prototypes */
186 __sighandler_t
*signal(int, __sighandler_t
*);
188 #if !defined(_ANSI_SOURCE)
189 int kill(pid_t
, int);
191 int sigaction(int, const struct sigaction
*, struct sigaction
*);
192 int sigaddset(sigset_t
*, int);
193 int sigdelset(sigset_t
*, int);
194 int sigemptyset(sigset_t
*);
195 int sigfillset(sigset_t
*);
196 /* NOTIMPL int sighold(int); */
197 /* NOTIMPL int sigignore(int); */
198 int sigismember(const sigset_t
*, int);
199 int sigpending(sigset_t
*);
200 int sigprocmask(int, const sigset_t
*, sigset_t
*);
201 /* NOTIMPL int sigrelse(int); */
202 /* NOTIMPL int sigset(__sighandler_t *, int); */
203 int sigsuspend(const sigset_t
*);
204 /* NOTIMPL int sigwait(const sigset_t *, int *); */
206 #if !defined(_POSIX_SOURCE)
207 /* NOTIMPL int killpg(pid_t, int); */
208 /* NOTIMPL int sigaltstack(const stack_t *, stack_t *); */
209 /* NOTIMPL int siginterrupt(int); */
210 /* NOTIMPL int sigpause(int); */
211 #endif /* !_POSIX_SOURCE */
213 #if defined(_P1003_1B_VISIBLE)
214 /* NOTIMPL int sigqueue(pid_t, int, const union sigval); */
215 /* NOTIMPL int sigtimedwait(const sigset_t *, siginfo_t *, const struct timespec *); */
216 /* NOTIMPL int sigwaitinfo(const sigset_t *, siginfo_t *); */
217 #endif /* _P1003_1B */
219 #endif /* !_ANSI_SOURCE */
223 #endif /* _SIGNAL_H_ */