]>
Commit | Line | Data |
---|---|---|
1c79356b | 1 | /* |
5d5c5d0d A |
2 | * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved. |
3 | * | |
8f6c56a5 | 4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ |
1c79356b | 5 | * |
8f6c56a5 A |
6 | * This file contains Original Code and/or Modifications of Original Code |
7 | * as defined in and that are subject to the Apple Public Source License | |
8 | * Version 2.0 (the 'License'). You may not use this file except in | |
9 | * compliance with the License. The rights granted to you under the License | |
10 | * may not be used to create, or enable the creation or redistribution of, | |
11 | * unlawful or unlicensed copies of an Apple operating system, or to | |
12 | * circumvent, violate, or enable the circumvention or violation of, any | |
13 | * terms of an Apple operating system software license agreement. | |
14 | * | |
15 | * Please obtain a copy of the License at | |
16 | * http://www.opensource.apple.com/apsl/ and read it before using this file. | |
17 | * | |
18 | * The Original Code and all software distributed under the License are | |
19 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
22 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. | |
23 | * Please see the License for the specific language governing rights and | |
8ad349bb | 24 | * limitations under the License. |
8f6c56a5 A |
25 | * |
26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ | |
1c79356b A |
27 | */ |
28 | /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */ | |
29 | /* | |
30 | * Copyright (c) 1982, 1986, 1989, 1991, 1993 | |
31 | * The Regents of the University of California. All rights reserved. | |
32 | * (c) UNIX System Laboratories, Inc. | |
33 | * All or some portions of this file are derived from material licensed | |
34 | * to the University of California by American Telephone and Telegraph | |
35 | * Co. or Unix System Laboratories, Inc. and are reproduced herein with | |
36 | * the permission of UNIX System Laboratories, Inc. | |
37 | * | |
38 | * Redistribution and use in source and binary forms, with or without | |
39 | * modification, are permitted provided that the following conditions | |
40 | * are met: | |
41 | * 1. Redistributions of source code must retain the above copyright | |
42 | * notice, this list of conditions and the following disclaimer. | |
43 | * 2. Redistributions in binary form must reproduce the above copyright | |
44 | * notice, this list of conditions and the following disclaimer in the | |
45 | * documentation and/or other materials provided with the distribution. | |
46 | * 3. All advertising materials mentioning features or use of this software | |
47 | * must display the following acknowledgement: | |
48 | * This product includes software developed by the University of | |
49 | * California, Berkeley and its contributors. | |
50 | * 4. Neither the name of the University nor the names of its contributors | |
51 | * may be used to endorse or promote products derived from this software | |
52 | * without specific prior written permission. | |
53 | * | |
54 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
55 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
56 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
57 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
58 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
59 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
60 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
61 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
62 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
63 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
64 | * SUCH DAMAGE. | |
65 | * | |
66 | * @(#)signal.h 8.2 (Berkeley) 1/21/94 | |
67 | */ | |
68 | ||
69 | #ifndef _SYS_SIGNAL_H_ | |
70 | #define _SYS_SIGNAL_H_ | |
71 | ||
91447636 | 72 | #include <sys/cdefs.h> |
9bccf70c A |
73 | #include <sys/appleapiopts.h> |
74 | ||
91447636 | 75 | #if !defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE) |
1c79356b A |
76 | #define NSIG 32 /* counting 0; could be 33 (mask is 1-32) */ |
77 | #endif | |
78 | ||
79 | #include <machine/signal.h> /* sigcontext; codes for SIGILL, SIGFPE */ | |
80 | ||
81 | #define SIGHUP 1 /* hangup */ | |
82 | #define SIGINT 2 /* interrupt */ | |
83 | #define SIGQUIT 3 /* quit */ | |
84 | #define SIGILL 4 /* illegal instruction (not reset when caught) */ | |
1c79356b | 85 | #define SIGTRAP 5 /* trace trap (not reset when caught) */ |
1c79356b | 86 | #define SIGABRT 6 /* abort() */ |
91447636 A |
87 | #if defined(_POSIX_C_SOURCE) |
88 | #define SIGPOLL 7 /* pollable event ([XSR] generated, not supported) */ | |
89 | #else /* !_POSIX_C_SOURCE */ | |
1c79356b A |
90 | #define SIGIOT SIGABRT /* compatibility */ |
91 | #define SIGEMT 7 /* EMT instruction */ | |
91447636 | 92 | #endif /* !_POSIX_C_SOURCE */ |
1c79356b A |
93 | #define SIGFPE 8 /* floating point exception */ |
94 | #define SIGKILL 9 /* kill (cannot be caught or ignored) */ | |
1c79356b | 95 | #define SIGBUS 10 /* bus error */ |
1c79356b | 96 | #define SIGSEGV 11 /* segmentation violation */ |
1c79356b | 97 | #define SIGSYS 12 /* bad argument to system call */ |
1c79356b A |
98 | #define SIGPIPE 13 /* write on a pipe with no one to read it */ |
99 | #define SIGALRM 14 /* alarm clock */ | |
100 | #define SIGTERM 15 /* software termination signal from kill */ | |
1c79356b | 101 | #define SIGURG 16 /* urgent condition on IO channel */ |
1c79356b A |
102 | #define SIGSTOP 17 /* sendable stop signal not from tty */ |
103 | #define SIGTSTP 18 /* stop signal from tty */ | |
104 | #define SIGCONT 19 /* continue a stopped process */ | |
105 | #define SIGCHLD 20 /* to parent on child stop or exit */ | |
106 | #define SIGTTIN 21 /* to readers pgrp upon background tty read */ | |
107 | #define SIGTTOU 22 /* like TTIN for output if (tp->t_local<OSTOP) */ | |
91447636 | 108 | #if !defined(_POSIX_C_SOURCE) |
1c79356b | 109 | #define SIGIO 23 /* input/output possible signal */ |
91447636 | 110 | #endif |
1c79356b A |
111 | #define SIGXCPU 24 /* exceeded CPU time limit */ |
112 | #define SIGXFSZ 25 /* exceeded file size limit */ | |
113 | #define SIGVTALRM 26 /* virtual time alarm */ | |
114 | #define SIGPROF 27 /* profiling time alarm */ | |
91447636 | 115 | #if !defined(_POSIX_C_SOURCE) |
1c79356b A |
116 | #define SIGWINCH 28 /* window size changes */ |
117 | #define SIGINFO 29 /* information request */ | |
118 | #endif | |
119 | #define SIGUSR1 30 /* user defined signal 1 */ | |
120 | #define SIGUSR2 31 /* user defined signal 2 */ | |
121 | ||
91447636 | 122 | #if defined(_ANSI_SOURCE) || defined(_POSIX_C_SOURCE) || defined(__cplusplus) |
1c79356b A |
123 | /* |
124 | * Language spec sez we must list exactly one parameter, even though we | |
125 | * actually supply three. Ugh! | |
91447636 | 126 | * SIG_HOLD is chosen to avoid KERN_SIG_* values in <sys/signalvar.h> |
1c79356b A |
127 | */ |
128 | #define SIG_DFL (void (*)(int))0 | |
129 | #define SIG_IGN (void (*)(int))1 | |
91447636 A |
130 | #define SIG_HOLD (void (*)(int))5 |
131 | #define SIG_ERR ((void (*)(int))-1) | |
1c79356b | 132 | #else |
91447636 A |
133 | /* DO NOT REMOVE THE COMMENTED OUT int: fixincludes needs to see them */ |
134 | #define SIG_DFL (void (*)(/*int*/))0 | |
135 | #define SIG_IGN (void (*)(/*int*/))1 | |
136 | #define SIG_HOLD (void (*)(/*int*/))5 | |
137 | #define SIG_ERR ((void (*)(/*int*/))-1) | |
1c79356b A |
138 | #endif |
139 | ||
140 | #ifndef _ANSI_SOURCE | |
91447636 A |
141 | #include <sys/_types.h> |
142 | ||
143 | #ifndef _MCONTEXT_T | |
144 | #define _MCONTEXT_T | |
145 | typedef __darwin_mcontext_t mcontext_t; | |
146 | #endif | |
147 | ||
148 | #ifndef _POSIX_C_SOURCE | |
149 | #ifndef _MCONTEXT64_T | |
150 | #define _MCONTEXT64_T | |
151 | typedef __darwin_mcontext64_t mcontext64_t; | |
152 | #endif | |
153 | #endif /* _POSIX_C_SOURCE */ | |
154 | ||
155 | #ifndef _PID_T | |
156 | #define _PID_T | |
157 | typedef __darwin_pid_t pid_t; | |
158 | #endif | |
159 | ||
160 | #ifndef _PTHREAD_ATTR_T | |
161 | #define _PTHREAD_ATTR_T | |
162 | typedef __darwin_pthread_attr_t pthread_attr_t; | |
163 | #endif | |
164 | ||
165 | #ifndef _SIGSET_T | |
166 | #define _SIGSET_T | |
167 | typedef __darwin_sigset_t sigset_t; | |
168 | #endif | |
169 | ||
170 | #ifndef _SIZE_T | |
171 | #define _SIZE_T | |
172 | typedef __darwin_size_t size_t; | |
173 | #endif | |
174 | ||
175 | #ifndef _UCONTEXT_T | |
176 | #define _UCONTEXT_T | |
177 | typedef __darwin_ucontext_t ucontext_t; | |
178 | #endif | |
55e303ae | 179 | |
91447636 A |
180 | #ifndef _POSIX_C_SOURCE |
181 | #ifndef _UCONTEXT64_T | |
182 | #define _UCONTEXT64_T | |
183 | typedef __darwin_ucontext64_t ucontext64_t; | |
184 | #endif | |
185 | #endif /* _POSIX_C_SOURCE */ | |
186 | ||
187 | #ifndef _UID_T | |
188 | #define _UID_T | |
189 | typedef __darwin_uid_t uid_t; | |
190 | #endif | |
1c79356b | 191 | |
9bccf70c A |
192 | union sigval { |
193 | /* Members as suggested by Annex C of POSIX 1003.1b. */ | |
91447636 A |
194 | int sival_int; |
195 | void *sival_ptr; | |
9bccf70c A |
196 | }; |
197 | ||
91447636 | 198 | #define SIGEV_NONE 0 /* No async notification */ |
55e303ae | 199 | #define SIGEV_SIGNAL 1 /* aio - completion notification */ |
55e303ae | 200 | #define SIGEV_THREAD 3 /* A notification function will be called to perform notification */ |
9bccf70c | 201 | |
55e303ae A |
202 | struct sigevent { |
203 | int sigev_notify; /* Notification type */ | |
204 | int sigev_signo; /* Signal number */ | |
205 | union sigval sigev_value; /* Signal value */ | |
206 | void (*sigev_notify_function)(union sigval); /* Notification function */ | |
207 | pthread_attr_t *sigev_notify_attributes; /* Notification attributes */ | |
208 | }; | |
209 | ||
91447636 A |
210 | // LP64todo - should this move? |
211 | #ifdef BSD_KERNEL_PRIVATE | |
212 | ||
91447636 A |
213 | union user_sigval { |
214 | struct { | |
215 | int pad; /* assumes Motorolla byte order */ | |
216 | int sival_int; | |
217 | } size_equivalent; | |
218 | user_addr_t sival_ptr; | |
219 | }; | |
220 | ||
221 | struct user_sigevent { | |
222 | int sigev_notify; /* Notification type */ | |
223 | int sigev_signo; /* Signal number */ | |
224 | union user_sigval sigev_value; /* Signal value */ | |
225 | user_addr_t sigev_notify_function; /* Notify function */ | |
226 | user_addr_t sigev_notify_attributes; /* Notify attributes */ | |
227 | }; | |
228 | ||
91447636 A |
229 | #endif /* BSD_KERNEL_PRIVATE */ |
230 | ||
9bccf70c A |
231 | typedef struct __siginfo { |
232 | int si_signo; /* signal number */ | |
233 | int si_errno; /* errno association */ | |
234 | int si_code; /* signal code */ | |
91447636 A |
235 | pid_t si_pid; /* sending process */ |
236 | uid_t si_uid; /* sender's ruid */ | |
9bccf70c A |
237 | int si_status; /* exit value */ |
238 | void *si_addr; /* faulting instruction */ | |
239 | union sigval si_value; /* signal value */ | |
240 | long si_band; /* band event for SIGPOLL */ | |
91447636 | 241 | unsigned long pad[7]; /* Reserved for Future Use */ |
9bccf70c A |
242 | } siginfo_t; |
243 | ||
91447636 A |
244 | #ifdef BSD_KERNEL_PRIVATE |
245 | ||
91447636 A |
246 | typedef struct __user_siginfo { |
247 | int si_signo; /* signal number */ | |
248 | int si_errno; /* errno association */ | |
249 | int si_code; /* signal code */ | |
250 | pid_t si_pid; /* sending process */ | |
251 | uid_t si_uid; /* sender's ruid */ | |
252 | int si_status; /* exit value */ | |
253 | user_addr_t si_addr; /* faulting instruction */ | |
254 | union user_sigval si_value; /* signal value */ | |
255 | user_long_t si_band; /* band event for SIGPOLL */ | |
256 | user_ulong_t pad[7]; /* Reserved for Future Use */ | |
257 | } user_siginfo_t; | |
258 | ||
91447636 A |
259 | #endif /* BSD_KERNEL_PRIVATE */ |
260 | ||
9bccf70c A |
261 | /* |
262 | * Incase of SIGILL and SIGFPE, si_addr contains the address of | |
263 | * faulting instruction. | |
264 | * Incase of SIGSEGV and SIGBUS, si_addr contains address of | |
265 | * faulting memory reference. | |
266 | * Incase of SIGCHLD, si_pid willhave child process ID, | |
267 | * si_status will contain exit value or signal. | |
268 | * si_uid contains real user ID of the process that sent the signal | |
269 | */ | |
270 | ||
271 | /* Values for si_code */ | |
272 | ||
273 | /* Codes for SIGILL */ | |
91447636 | 274 | #ifndef _POSIX_C_SOURCE |
9bccf70c | 275 | #define ILL_NOOP 0 /* if only I knew... */ |
91447636 A |
276 | #endif |
277 | #define ILL_ILLOPC 1 /* [XSI] illegal opcode */ | |
278 | #define ILL_ILLTRP 2 /* [XSI] illegal trap */ | |
279 | #define ILL_PRVOPC 3 /* [XSI] privileged opcode */ | |
280 | #define ILL_ILLOPN 4 /* [XSI] illegal operand -NOTIMP */ | |
281 | #define ILL_ILLADR 5 /* [XSI] illegal addressing mode -NOTIMP */ | |
282 | #define ILL_PRVREG 6 /* [XSI] privileged register -NOTIMP */ | |
283 | #define ILL_COPROC 7 /* [XSI] coprocessor error -NOTIMP */ | |
284 | #define ILL_BADSTK 8 /* [XSI] internal stack error -NOTIMP */ | |
9bccf70c A |
285 | |
286 | /* Codes for SIGFPE */ | |
91447636 | 287 | #ifndef _POSIX_C_SOURCE |
9bccf70c | 288 | #define FPE_NOOP 0 /* if only I knew... */ |
91447636 A |
289 | #endif |
290 | #define FPE_FLTDIV 1 /* [XSI] floating point divide by zero */ | |
291 | #define FPE_FLTOVF 2 /* [XSI] floating point overflow */ | |
292 | #define FPE_FLTUND 3 /* [XSI] floating point underflow */ | |
293 | #define FPE_FLTRES 4 /* [XSI] floating point inexact result */ | |
294 | #define FPE_FLTINV 5 /* [XSI] invalid floating point operation */ | |
295 | #define FPE_FLTSUB 6 /* [XSI] subscript out of range -NOTIMP */ | |
296 | #define FPE_INTDIV 7 /* [XSI] integer divide by zero -NOTIMP */ | |
297 | #define FPE_INTOVF 8 /* [XSI] integer overflow -NOTIMP */ | |
9bccf70c A |
298 | |
299 | /* Codes for SIGSEGV */ | |
91447636 | 300 | #ifndef _POSIX_C_SOURCE |
9bccf70c | 301 | #define SEGV_NOOP 0 /* if only I knew... */ |
91447636 A |
302 | #endif |
303 | #define SEGV_MAPERR 1 /* [XSI] address not mapped to object */ | |
304 | #define SEGV_ACCERR 2 /* [XSI] invalid permission for mapped object */ | |
9bccf70c A |
305 | |
306 | /* Codes for SIGBUS */ | |
91447636 | 307 | #ifndef _POSIX_C_SOURCE |
9bccf70c | 308 | #define BUS_NOOP 0 /* if only I knew... */ |
91447636 A |
309 | #endif |
310 | #define BUS_ADRALN 1 /* [XSI] Invalid address alignment */ | |
311 | #define BUS_ADRERR 2 /* [XSI] Nonexistent physical address -NOTIMP */ | |
312 | #define BUS_OBJERR 3 /* [XSI] Object-specific HW error - NOTIMP */ | |
313 | ||
314 | /* Codes for SIGTRAP */ | |
315 | #define TRAP_BRKPT 1 /* [XSI] Process breakpoint -NOTIMP */ | |
316 | #define TRAP_TRACE 2 /* [XSI] Process trace trap -NOTIMP */ | |
9bccf70c A |
317 | |
318 | /* Codes for SIGCHLD */ | |
91447636 | 319 | #ifndef _POSIX_C_SOURCE |
9bccf70c | 320 | #define CLD_NOOP 0 /* if only I knew... */ |
91447636 A |
321 | #endif |
322 | #define CLD_EXITED 1 /* [XSI] child has exited */ | |
323 | #define CLD_KILLED 2 /* [XSI] terminated abnormally, no core file */ | |
324 | #define CLD_DUMPED 3 /* [XSI] terminated abnormally, core file */ | |
325 | #define CLD_TRAPPED 4 /* [XSI] traced child has trapped */ | |
326 | #define CLD_STOPPED 5 /* [XSI] child has stopped */ | |
327 | #define CLD_CONTINUED 6 /* [XSI] stopped child has continued */ | |
328 | ||
329 | /* Codes for SIGPOLL */ | |
330 | #define POLL_IN 1 /* [XSR] Data input available */ | |
331 | #define POLL_OUT 2 /* [XSR] Output buffers available */ | |
332 | #define POLL_MSG 3 /* [XSR] Input message available */ | |
333 | #define POLL_ERR 4 /* [XSR] I/O error */ | |
334 | #define POLL_PRI 5 /* [XSR] High priority input available */ | |
335 | #define POLL_HUP 6 /* [XSR] Device disconnected */ | |
9bccf70c A |
336 | |
337 | /* union for signal handlers */ | |
338 | union __sigaction_u { | |
339 | void (*__sa_handler)(int); | |
340 | void (*__sa_sigaction)(int, struct __siginfo *, | |
341 | void *); | |
342 | }; | |
343 | ||
344 | /* Signal vector template for Kernel user boundary */ | |
345 | struct __sigaction { | |
346 | union __sigaction_u __sigaction_u; /* signal handler */ | |
347 | void (*sa_tramp)(void *, int, int, siginfo_t *, void *); | |
348 | sigset_t sa_mask; /* signal mask to apply */ | |
349 | int sa_flags; /* see signal options below */ | |
350 | }; | |
351 | ||
1c79356b A |
352 | /* |
353 | * Signal vector "template" used in sigaction call. | |
354 | */ | |
355 | struct sigaction { | |
9bccf70c | 356 | union __sigaction_u __sigaction_u; /* signal handler */ |
1c79356b A |
357 | sigset_t sa_mask; /* signal mask to apply */ |
358 | int sa_flags; /* see signal options below */ | |
359 | }; | |
91447636 A |
360 | |
361 | #ifdef BSD_KERNEL_PRIVATE | |
362 | #include <machine/types.h> | |
363 | ||
91447636 A |
364 | union __user_sigaction_u { |
365 | user_addr_t __sa_handler; | |
366 | user_addr_t __sa_sigaction; | |
367 | }; | |
368 | ||
369 | struct user_sigaction { | |
370 | union __user_sigaction_u __sigaction_u; /* signal handler */ | |
371 | sigset_t sa_mask; /* signal mask to apply */ | |
372 | int sa_flags; /* see signal options below */ | |
373 | }; | |
374 | ||
375 | struct __user_sigaction { | |
376 | union __user_sigaction_u __sigaction_u; /* signal handler */ | |
377 | user_addr_t sa_tramp; /* signal mask to apply */ | |
378 | sigset_t sa_mask; /* signal mask to apply */ | |
379 | int sa_flags; /* see signal options below */ | |
380 | }; | |
381 | ||
91447636 A |
382 | #undef SIG_DFL |
383 | #undef SIG_IGN | |
384 | #undef SIG_ERR | |
385 | #define SIG_DFL ((user_addr_t)0LL) | |
386 | #define SIG_IGN ((user_addr_t)1LL) | |
387 | #define SIG_ERR ((user_addr_t)-1LL) | |
388 | ||
389 | #endif /* BSD_KERNEL_PRIVATE */ | |
390 | ||
391 | ||
9bccf70c A |
392 | /* if SA_SIGINFO is set, sa_sigaction is to be used instead of sa_handler. */ |
393 | #define sa_handler __sigaction_u.__sa_handler | |
394 | #define sa_sigaction __sigaction_u.__sa_sigaction | |
395 | ||
1c79356b A |
396 | #define SA_ONSTACK 0x0001 /* take signal on signal stack */ |
397 | #define SA_RESTART 0x0002 /* restart system on signal return */ | |
398 | #define SA_DISABLE 0x0004 /* disable taking signals on alternate stack */ | |
9bccf70c | 399 | #define SA_RESETHAND 0x0004 /* reset to SIG_DFL when taking signal */ |
91447636 | 400 | #define SA_NOCLDSTOP 0x0008 /* do not generate SIGCHLD on child stop */ |
9bccf70c A |
401 | #define SA_NODEFER 0x0010 /* don't mask the signal we're delivering */ |
402 | #define SA_NOCLDWAIT 0x0020 /* don't keep zombies around */ | |
403 | #define SA_SIGINFO 0x0040 /* signal handler with SA_SIGINFO args */ | |
91447636 | 404 | #ifndef _POSIX_C_SOURCE |
1c79356b | 405 | #define SA_USERTRAMP 0x0100 /* do not bounce off kernel's sigtramp */ |
55e303ae A |
406 | /* This will provide 64bit register set in a 32bit user address space */ |
407 | #define SA_64REGSET 0x0200 /* signal handler with SA_SIGINFO args with 64bit regs information */ | |
91447636 | 408 | #endif /* !_POSIX_C_SOURCE */ |
1c79356b A |
409 | |
410 | /* | |
411 | * Flags for sigprocmask: | |
412 | */ | |
413 | #define SIG_BLOCK 1 /* block specified signal set */ | |
414 | #define SIG_UNBLOCK 2 /* unblock specified signal set */ | |
415 | #define SIG_SETMASK 3 /* set specified signal set */ | |
416 | ||
9bccf70c | 417 | /* POSIX 1003.1b required values. */ |
91447636 A |
418 | #define SI_USER 0x10001 /* [CX] signal from kill() */ |
419 | #define SI_QUEUE 0x10002 /* [CX] signal from sigqueue() */ | |
420 | #define SI_TIMER 0x10003 /* [CX] timer expiration */ | |
421 | #define SI_ASYNCIO 0x10004 /* [CX] aio request completion */ | |
422 | #define SI_MESGQ 0x10005 /* [CX] from message arrival on empty queue */ | |
423 | ||
424 | #ifndef _POSIX_C_SOURCE | |
425 | typedef void (*sig_t)(int); /* type of signal function */ | |
426 | #endif | |
1c79356b A |
427 | |
428 | /* | |
429 | * Structure used in sigaltstack call. | |
430 | */ | |
91447636 A |
431 | #ifdef BSD_KERNEL_PRIVATE |
432 | ||
91447636 A |
433 | struct user_sigaltstack { |
434 | user_addr_t ss_sp; /* signal stack base */ | |
435 | user_size_t ss_size; /* signal stack length */ | |
4452a7af | 436 | int ss_flags __attribute((aligned(8))); /* SA_DISABLE and/or SA_ONSTACK */ |
1c79356b | 437 | }; |
9bccf70c | 438 | |
91447636 A |
439 | #endif /* BSD_KERNEL_PRIVATE */ |
440 | ||
441 | #ifndef _STACK_T | |
442 | #define _STACK_T | |
443 | typedef __darwin_stack_t stack_t; | |
444 | #endif | |
9bccf70c A |
445 | |
446 | #define SS_ONSTACK 0x0001 /* take signal on signal stack */ | |
447 | #define SS_DISABLE 0x0004 /* disable taking signals on alternate stack */ | |
55e303ae A |
448 | #define MINSIGSTKSZ 32768 /* (32K)minimum allowable stack */ |
449 | #define SIGSTKSZ 131072 /* (128K)recommended stack size */ | |
1c79356b | 450 | |
91447636 | 451 | #ifndef _POSIX_C_SOURCE |
1c79356b A |
452 | /* |
453 | * 4.3 compatibility: | |
454 | * Signal vector "template" used in sigvec call. | |
455 | */ | |
456 | struct sigvec { | |
9bccf70c | 457 | void (*sv_handler)(int); /* signal handler */ |
1c79356b A |
458 | int sv_mask; /* signal mask to apply */ |
459 | int sv_flags; /* see signal options below */ | |
460 | }; | |
461 | ||
462 | #define SV_ONSTACK SA_ONSTACK | |
463 | #define SV_INTERRUPT SA_RESTART /* same bit, opposite sense */ | |
9bccf70c A |
464 | #define SV_RESETHAND SA_RESETHAND |
465 | #define SV_NODEFER SA_NODEFER | |
466 | #define SV_NOCLDSTOP SA_NOCLDSTOP | |
467 | #define SV_SIGINFO SA_SIGINFO | |
468 | ||
1c79356b | 469 | #define sv_onstack sv_flags /* isn't compatibility wonderful! */ |
91447636 | 470 | #endif /* !_POSIX_C_SOURCE */ |
1c79356b A |
471 | |
472 | /* | |
473 | * Structure used in sigstack call. | |
474 | */ | |
475 | struct sigstack { | |
476 | char *ss_sp; /* signal stack pointer */ | |
477 | int ss_onstack; /* current status */ | |
478 | }; | |
479 | ||
91447636 | 480 | #ifndef _POSIX_C_SOURCE |
1c79356b A |
481 | /* |
482 | * Macro for converting signal number to a mask suitable for | |
483 | * sigblock(). | |
484 | */ | |
485 | #define sigmask(m) (1 << ((m)-1)) | |
486 | ||
91447636 | 487 | #ifdef BSD_KERNEL_PRIVATE |
9bccf70c A |
488 | /* |
489 | * signals delivered on a per-thread basis. | |
490 | */ | |
491 | #define threadmask (sigmask(SIGILL)|sigmask(SIGTRAP)|\ | |
492 | sigmask(SIGIOT)|sigmask(SIGEMT)|\ | |
493 | sigmask(SIGFPE)|sigmask(SIGBUS)|\ | |
494 | sigmask(SIGSEGV)|sigmask(SIGSYS)|\ | |
495 | sigmask(SIGPIPE)) | |
91447636 | 496 | #endif /* BSD_KERNEL_PRIVATE */ |
1c79356b A |
497 | |
498 | #define BADSIG SIG_ERR | |
499 | ||
91447636 | 500 | #endif /* !_POSIX_C_SOURCE */ |
1c79356b A |
501 | #endif /* !_ANSI_SOURCE */ |
502 | ||
503 | /* | |
504 | * For historical reasons; programs expect signal's return value to be | |
505 | * defined by <sys/signal.h>. | |
506 | */ | |
507 | __BEGIN_DECLS | |
91447636 | 508 | void (*signal(int, void (*)(int)))(int); |
1c79356b A |
509 | __END_DECLS |
510 | #endif /* !_SYS_SIGNAL_H_ */ |