* Removed sys/_types.h include, all types are now defined in include files named...
[AROS.git] / compiler / clib / include / signal.h
blob5402f7e98decaf1dd6420e45771c457de67f6e43
1 #ifndef _SIGNAL_H_
2 #define _SIGNAL_H_
4 /*
5 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
6 $Id$
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 */
20 #endif
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 */
39 /* Signal values */
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 */
46 #endif
47 #define SIGABRT 6 /* abort() */
48 #if !defined(_POSIX_SOURCE)
49 #define SIGEMT 7 /* EMT instruction (emulator trap) */
50 #endif
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 */
55 #endif
56 #define SIGSEGV 11 /* segmentation violation */
57 #if !defined(_POSIX_SOURCE)
58 #define SIGSYS 12 /* non-existent system call */
59 #endif
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 */
65 #endif
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 */
78 #endif
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 */
86 #endif
88 #if defined(_P1003_1B_VISIBLE)
90 /* Real time signals as specified by POSIX 1003.1B */
91 #define SIGRTMIN 33
92 #define SIGRT1 33
93 #define SIGRT2 34
94 #define SIGRT3 35
95 #define SIGRT4 36
96 #define SIGRT5 37
97 #define SIGRT6 38
98 #define SIGRT7 39
99 #define SIGRT8 40
100 #define SIGRT9 41
101 #define SIGRT10 42
102 #define SIGRT11 43
103 #define SIGRT12 44
104 #define SIGRT13 45
105 #define SIGRT14 46
106 #define SIGRT15 47
107 #define SIGRT16 48
108 #define SIGRT17 49
109 #define SIGRT18 50
110 #define SIGRT19 51
111 #define SIGRT20 52
112 #define SIGRT21 53
113 #define SIGRT22 54
114 #define SIGRT23 55
115 #define SIGRT24 56
116 #define SIGRT25 57
117 #define SIGRT26 58
118 #define SIGRT27 59
119 #define SIGRT28 60
120 #define SIGRT29 61
121 #define SIGRT30 62
122 #define SIGRT31 63
123 #define SIGRT32 64
124 #define SIGRTMAX 64
126 #define RTSIG_MAX 32
129 sigevent() is an advanced call that allows a process to request the
130 system to perform more advanced signal delivery that calling signal
131 handlers.
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>
141 Call a function.
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>
158 struct sigstack
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 */
171 struct timespec;
173 #endif /* !_POSIX_SOURCE */
175 /* Flags for sigprocmask() */
176 #define SIG_BLOCK 1
177 #define SIG_UNBLOCK 2
178 #define SIG_SETMASK 34
180 #endif /* !_ANSI_SOURCE */
182 /* Function Prototypes */
183 __BEGIN_DECLS
185 int raise(int);
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 */
221 __END_DECLS
223 #endif /* _SIGNAL_H_ */