FreeBSD/Linux Kernel Cross Reference
sys/sys/signal.h
1 /* $NetBSD: signal.h,v 1.57.2.1 2004/05/11 13:02:08 tron Exp $ */
2
3 /*
4 * Copyright (c) 1982, 1986, 1989, 1991, 1993
5 * The Regents of the University of California. All rights reserved.
6 * (c) UNIX System Laboratories, Inc.
7 * All or some portions of this file are derived from material licensed
8 * to the University of California by American Telephone and Telegraph
9 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
10 * the permission of UNIX System Laboratories, Inc.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
20 * 3. Neither the name of the University nor the names of its contributors
21 * may be used to endorse or promote products derived from this software
22 * without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 *
36 * @(#)signal.h 8.4 (Berkeley) 5/4/95
37 */
38
39 #ifndef _SYS_SIGNAL_H_
40 #define _SYS_SIGNAL_H_
41
42 #include <sys/featuretest.h>
43 #include <sys/sigtypes.h>
44
45 #define _NSIG 64
46
47 #if defined(_NETBSD_SOURCE)
48 #define NSIG _NSIG
49
50 #if defined(__LIBC12_SOURCE__) || defined(_KERNEL)
51 /* Number of signals supported by old style signal mask. */
52 #define NSIG13 32
53 #endif
54
55 #endif /* _NETBSD_SOURCE */
56
57 #define SIGHUP 1 /* hangup */
58 #define SIGINT 2 /* interrupt */
59 #define SIGQUIT 3 /* quit */
60 #define SIGILL 4 /* illegal instruction (not reset when caught) */
61 #define SIGTRAP 5 /* trace trap (not reset when caught) */
62 #define SIGABRT 6 /* abort() */
63 #define SIGIOT SIGABRT /* compatibility */
64 #define SIGEMT 7 /* EMT instruction */
65 #define SIGFPE 8 /* floating point exception */
66 #define SIGKILL 9 /* kill (cannot be caught or ignored) */
67 #define SIGBUS 10 /* bus error */
68 #define SIGSEGV 11 /* segmentation violation */
69 #define SIGSYS 12 /* bad argument to system call */
70 #define SIGPIPE 13 /* write on a pipe with no one to read it */
71 #define SIGALRM 14 /* alarm clock */
72 #define SIGTERM 15 /* software termination signal from kill */
73 #define SIGURG 16 /* urgent condition on IO channel */
74 #define SIGSTOP 17 /* sendable stop signal not from tty */
75 #define SIGTSTP 18 /* stop signal from tty */
76 #define SIGCONT 19 /* continue a stopped process */
77 #define SIGCHLD 20 /* to parent on child stop or exit */
78 #define SIGTTIN 21 /* to readers pgrp upon background tty read */
79 #define SIGTTOU 22 /* like TTIN for output if (tp->t_local<OSTOP) */
80 #define SIGIO 23 /* input/output possible signal */
81 #define SIGXCPU 24 /* exceeded CPU time limit */
82 #define SIGXFSZ 25 /* exceeded file size limit */
83 #define SIGVTALRM 26 /* virtual time alarm */
84 #define SIGPROF 27 /* profiling time alarm */
85 #define SIGWINCH 28 /* window size changes */
86 #define SIGINFO 29 /* information request */
87 #define SIGUSR1 30 /* user defined signal 1 */
88 #define SIGUSR2 31 /* user defined signal 2 */
89 #define SIGPWR 32 /* power fail/restart (not reset when caught) */
90 #ifdef _KERNEL
91 #define SIGRTMIN 33 /* Kernel only; not exposed to userland yet */
92 #define SIGRTMAX 63 /* Kernel only; not exposed to userland yet */
93 #endif
94
95 #ifndef _KERNEL
96 #include <sys/cdefs.h>
97 #endif
98
99 #define SIG_DFL ((void (*) __P((int))) 0)
100 #define SIG_IGN ((void (*) __P((int))) 1)
101 #define SIG_ERR ((void (*) __P((int))) -1)
102 #define SIG_HOLD ((void (*) __P((int))) 3)
103
104 #if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
105 defined(_NETBSD_SOURCE)
106 #if defined(__LIBC12_SOURCE__) || defined(_KERNEL)
107 /*
108 * Signal vector "template" used in sigaction call.
109 */
110 struct sigaction13 {
111 void (*osa_handler) /* signal handler */
112 __P((int));
113 sigset13_t osa_mask; /* signal mask to apply */
114 int osa_flags; /* see signal options below */
115 };
116 #endif /* __LIBC12_SOURCE__ || _KERNEL */
117
118 #ifdef _KERNEL
119 #define sigaddset(s, n) __sigaddset(s, n)
120 #define sigdelset(s, n) __sigdelset(s, n)
121 #define sigismember(s, n) __sigismember(s, n)
122 #define sigemptyset(s) __sigemptyset(s)
123 #define sigfillset(s) __sigfillset(s)
124 #define sigplusset(s, t) __sigplusset(s, t)
125 #define sigminusset(s, t) __sigminusset(s, t)
126 #endif /* _KERNEL */
127
128 #if (_POSIX_C_SOURCE - 0) >= 199309L || (_XOPEN_SOURCE - 0) >= 500 || \
129 defined(_NETBSD_SOURCE)
130 #include <sys/siginfo.h>
131 #endif
132
133 #if (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \
134 (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)
135 #include <sys/ucontext.h>
136 #endif /* _XOPEN_SOURCE_EXTENDED || _XOPEN_SOURCE >= 500 || _NETBSD_SOURCE */
137
138 /*
139 * Signal vector "template" used in sigaction call.
140 */
141 struct sigaction {
142 union {
143 void (*_sa_handler) __P((int));
144 #if (_POSIX_C_SOURCE - 0) >= 199309L || (_XOPEN_SOURCE - 0) >= 500 || \
145 defined(_NETBSD_SOURCE)
146 void (*_sa_sigaction) __P((int, siginfo_t *, void *));
147 #endif
148 } _sa_u; /* signal handler */
149 sigset_t sa_mask; /* signal mask to apply */
150 int sa_flags; /* see signal options below */
151 };
152
153 #define sa_handler _sa_u._sa_handler
154 #if (_POSIX_C_SOURCE - 0) >= 199309L || (_XOPEN_SOURCE - 0) >= 500 || \
155 defined(_NETBSD_SOURCE)
156 #define sa_sigaction _sa_u._sa_sigaction
157 #endif
158
159 #include <machine/signal.h> /* sigcontext; codes for SIGILL, SIGFPE */
160
161 #if (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \
162 (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)
163 #define SA_ONSTACK 0x0001 /* take signal on signal stack */
164 #define SA_RESTART 0x0002 /* restart system on signal return */
165 #define SA_RESETHAND 0x0004 /* reset to SIG_DFL when taking signal */
166 #define SA_NODEFER 0x0010 /* don't mask the signal we're delivering */
167 #endif /* _XOPEN_SOURCE_EXTENDED || XOPEN_SOURCE >= 500 || _NETBSD_SOURCE */
168 /* Only valid for SIGCHLD. */
169 #define SA_NOCLDSTOP 0x0008 /* do not generate SIGCHLD on child stop */
170 #define SA_NOCLDWAIT 0x0020 /* do not generate zombies on unwaited child */
171 #if (_POSIX_C_SOURCE - 0) >= 199309L || (_XOPEN_SOURCE - 0) >= 500 || \
172 defined(_NETBSD_SOURCE)
173 #define SA_SIGINFO 0x0040 /* take sa_sigaction handler */
174 #endif /* (_POSIX_C_SOURCE - 0) >= 199309L || ... */
175 #ifdef _KERNEL
176 #define SA_ALLBITS 0x007f
177 #endif
178
179 /*
180 * Flags for sigprocmask():
181 */
182 #define SIG_BLOCK 1 /* block specified signal set */
183 #define SIG_UNBLOCK 2 /* unblock specified signal set */
184 #define SIG_SETMASK 3 /* set specified signal set */
185
186 #if defined(_NETBSD_SOURCE)
187 typedef void (*sig_t) __P((int)); /* type of signal function */
188 #endif
189
190 #if (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \
191 (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)
192 /*
193 * Flags used with stack_t/struct sigaltstack.
194 */
195 #define SS_ONSTACK 0x0001 /* take signals on alternate stack */
196 #define SS_DISABLE 0x0004 /* disable taking signals on alternate stack */
197 #ifdef _KERNEL
198 #define SS_ALLBITS 0x0005
199 #endif
200 #define MINSIGSTKSZ 8192 /* minimum allowable stack */
201 #define SIGSTKSZ (MINSIGSTKSZ + 32768) /* recommended stack size */
202 #endif /* _XOPEN_SOURCE_EXTENDED || _XOPEN_SOURCE >= 500 || _NETBSD_SOURCE */
203
204 #if defined(_NETBSD_SOURCE)
205 /*
206 * 4.3 compatibility:
207 * Signal vector "template" used in sigvec call.
208 */
209 struct sigvec {
210 void (*sv_handler) /* signal handler */
211 __P((int));
212 int sv_mask; /* signal mask to apply */
213 int sv_flags; /* see signal options below */
214 };
215 #define SV_ONSTACK SA_ONSTACK
216 #define SV_INTERRUPT SA_RESTART /* same bit, opposite sense */
217 #define SV_RESETHAND SA_RESETHAND
218 #define sv_onstack sv_flags /* isn't compatibility wonderful! */
219 #endif /* _NETBSD_SOURCE */
220
221 #if (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \
222 (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)
223 /*
224 * Structure used in sigstack call.
225 */
226 struct sigstack {
227 void *ss_sp; /* signal stack pointer */
228 int ss_onstack; /* current status */
229 };
230 #endif /* _XOPEN_SOURCE_EXTENDED || _XOPEN_SOURCE >= 500 || _NETBSD_SOURCE */
231
232 #if defined(_NETBSD_SOURCE) && !defined(_KERNEL)
233 /*
234 * Macro for converting signal number to a mask suitable for
235 * sigblock().
236 */
237 #define sigmask(n) __sigmask(n)
238
239 #define BADSIG SIG_ERR
240 #endif /* _NETBSD_SOURCE */
241
242 #if (_POSIX_C_SOURCE - 0) >= 199309L || (_XOPEN_SOURCE - 0) >= 500 || \
243 defined(_NETBSD_SOURCE)
244 struct sigevent {
245 int sigev_notify;
246 int sigev_signo;
247 union sigval sigev_value;
248 void (*sigev_notify_function)(union sigval *);
249 void /* pthread_attr_t */ *sigev_notify_attributes;
250 };
251
252 #define SIGEV_NONE 0
253 #define SIGEV_SIGNAL 1
254 #define SIGEV_THREAD 2
255 #define SIGEV_SA 3
256 #endif /* (_POSIX_C_SOURCE - 0) >= 199309L || ... */
257
258 #endif /* _POSIX_C_SOURCE || _XOPEN_SOURCE || _NETBSD_SOURCE */
259
260 /*
261 * For historical reasons; programs expect signal's return value to be
262 * defined by <sys/signal.h>.
263 */
264 __BEGIN_DECLS
265 void (*signal __P((int, void (*) __P((int))))) __P((int));
266 __END_DECLS
267 #endif /* !_SYS_SIGNAL_H_ */
Cache object: c5bcf2e1dc4af963f75c7e09af812e5e
|