Chameleon

Chameleon Svn Source Tree

Root/branches/xZenu/src/include/sys/signal.h

Source at commit 1270 created 12 years 8 months ago.
By meklort, Add arm headers. update makefiles
1/*
2 * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
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
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
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.h8.2 (Berkeley) 1/21/94
67 */
68
69#ifndef_SYS_SIGNAL_H_
70#define_SYS_SIGNAL_H_
71
72#include <sys/cdefs.h>
73#include <sys/appleapiopts.h>
74
75#define __DARWIN_NSIG32/* counting 0; could be 33 (mask is 1-32) */
76
77#if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))
78#define NSIG__DARWIN_NSIG
79#endif
80
81#include <machine/signal.h>/* sigcontext; codes for SIGILL, SIGFPE */
82
83#defineSIGHUP1/* hangup */
84#defineSIGINT2/* interrupt */
85#defineSIGQUIT3/* quit */
86#defineSIGILL4/* illegal instruction (not reset when caught) */
87#defineSIGTRAP5/* trace trap (not reset when caught) */
88#defineSIGABRT6/* abort() */
89#if (defined(_POSIX_C_SOURCE) && !defined(_DARWIN_C_SOURCE))
90#defineSIGPOLL7/* pollable event ([XSR] generated, not supported) */
91#else/* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
92#defineSIGIOTSIGABRT/* compatibility */
93#defineSIGEMT7/* EMT instruction */
94#endif/* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
95#defineSIGFPE8/* floating point exception */
96#defineSIGKILL9/* kill (cannot be caught or ignored) */
97#defineSIGBUS10/* bus error */
98#defineSIGSEGV11/* segmentation violation */
99#defineSIGSYS12/* bad argument to system call */
100#defineSIGPIPE13/* write on a pipe with no one to read it */
101#defineSIGALRM14/* alarm clock */
102#defineSIGTERM15/* software termination signal from kill */
103#defineSIGURG16/* urgent condition on IO channel */
104#defineSIGSTOP17/* sendable stop signal not from tty */
105#defineSIGTSTP18/* stop signal from tty */
106#defineSIGCONT19/* continue a stopped process */
107#defineSIGCHLD20/* to parent on child stop or exit */
108#defineSIGTTIN21/* to readers pgrp upon background tty read */
109#defineSIGTTOU22/* like TTIN for output if (tp->t_local&LTOSTOP) */
110#if (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))
111#defineSIGIO23/* input/output possible signal */
112#endif
113#defineSIGXCPU24/* exceeded CPU time limit */
114#defineSIGXFSZ25/* exceeded file size limit */
115#defineSIGVTALRM 26/* virtual time alarm */
116#defineSIGPROF27/* profiling time alarm */
117#if (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))
118#define SIGWINCH 28/* window size changes */
119#define SIGINFO29/* information request */
120#endif
121#define SIGUSR1 30/* user defined signal 1 */
122#define SIGUSR2 31/* user defined signal 2 */
123
124#if defined(_ANSI_SOURCE) || __DARWIN_UNIX03 || defined(__cplusplus)
125/*
126 * Language spec sez we must list exactly one parameter, even though we
127 * actually supply three. Ugh!
128 * SIG_HOLD is chosen to avoid KERN_SIG_* values in <sys/signalvar.h>
129 */
130#defineSIG_DFL(void (*)(int))0
131#defineSIG_IGN(void (*)(int))1
132#defineSIG_HOLD(void (*)(int))5
133#defineSIG_ERR((void (*)(int))-1)
134#else
135/* DO NOT REMOVE THE COMMENTED OUT int: fixincludes needs to see them */
136#defineSIG_DFL(void (*)(/*int*/))0
137#defineSIG_IGN(void (*)(/*int*/))1
138#defineSIG_HOLD(void (*)(/*int*/))5
139#defineSIG_ERR((void (*)(/*int*/))-1)
140#endif
141
142#ifndef _ANSI_SOURCE
143#include <sys/_types.h>
144
145#define __need_mcontext_t
146#define __need_stack_t
147#define __need_ucontext_t
148#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
149#if defined(__ppc__) || defined(__ppc64__)
150#define __need_mcontext64_t
151#define __need_ucontext64_t
152#endif /* __ppc__ || __ppc64__ */
153#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
154#include <sys/_structs.h>
155
156#ifndef _PID_T
157#define _PID_T
158typedef __darwin_pid_tpid_t;
159#endif
160
161#ifndef _SIGSET_T
162#define _SIGSET_T
163typedef __darwin_sigset_tsigset_t;
164#endif
165
166#ifndef_SIZE_T
167#define_SIZE_T
168typedef__darwin_size_tsize_t;
169#endif
170
171#ifndef _UID_T
172#define _UID_T
173typedef __darwin_uid_tuid_t;
174#endif
175
176union sigval {
177/* Members as suggested by Annex C of POSIX 1003.1b. */
178intsival_int;
179void*sival_ptr;
180};
181
182#defineSIGEV_NONE0/* No async notification */
183#defineSIGEV_SIGNAL1/* aio - completion notification */
184#defineSIGEV_THREAD3/* [NOTIMP] [RTS] call notification function */
185
186
187typedef struct __siginfo {
188intsi_signo;/* signal number */
189intsi_errno;/* errno association */
190intsi_code;/* signal code */
191pid_tsi_pid;/* sending process */
192uid_tsi_uid;/* sender's ruid */
193intsi_status;/* exit value */
194void*si_addr;/* faulting instruction */
195union sigval si_value;/* signal value */
196longsi_band;/* band event for SIGPOLL */
197unsigned long__pad[7];/* Reserved for Future Use */
198} siginfo_t;
199
200
201/*
202 * When the signal is SIGILL or SIGFPE, si_addr contains the address of
203 * the faulting instruction.
204 * When the signal is SIGSEGV or SIGBUS, si_addr contains the address of
205 * the faulting memory reference. Although for x86 there are cases of SIGSEGV
206 * for which si_addr cannot be determined and is NULL.
207 * If the signal is SIGCHLD, the si_pid field will contain the child process ID,
208 * si_status contains the exit value or signal and
209 * si_uid contains the real user ID of the process that sent the signal.
210 */
211
212/* Values for si_code */
213
214/* Codes for SIGILL */
215#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
216#defineILL_NOOP0/* if only I knew... */
217#endif
218#defineILL_ILLOPC1/* [XSI] illegal opcode */
219#defineILL_ILLTRP2/* [XSI] illegal trap */
220#defineILL_PRVOPC3/* [XSI] privileged opcode */
221#defineILL_ILLOPN4/* [XSI] illegal operand -NOTIMP */
222#defineILL_ILLADR5/* [XSI] illegal addressing mode -NOTIMP */
223#defineILL_PRVREG6/* [XSI] privileged register -NOTIMP */
224#defineILL_COPROC7/* [XSI] coprocessor error -NOTIMP */
225#defineILL_BADSTK8/* [XSI] internal stack error -NOTIMP */
226
227/* Codes for SIGFPE */
228#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
229#defineFPE_NOOP0/* if only I knew... */
230#endif
231#define FPE_FLTDIV1/* [XSI] floating point divide by zero */
232#define FPE_FLTOVF2/* [XSI] floating point overflow */
233#define FPE_FLTUND3/* [XSI] floating point underflow */
234#define FPE_FLTRES4/* [XSI] floating point inexact result */
235#define FPE_FLTINV5/* [XSI] invalid floating point operation */
236#defineFPE_FLTSUB6/* [XSI] subscript out of range -NOTIMP */
237#defineFPE_INTDIV7/* [XSI] integer divide by zero */
238#defineFPE_INTOVF8/* [XSI] integer overflow */
239
240/* Codes for SIGSEGV */
241#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
242#defineSEGV_NOOP0/* if only I knew... */
243#endif
244#defineSEGV_MAPERR1/* [XSI] address not mapped to object */
245#defineSEGV_ACCERR2/* [XSI] invalid permission for mapped object */
246
247/* Codes for SIGBUS */
248#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
249#defineBUS_NOOP0/* if only I knew... */
250#endif
251#defineBUS_ADRALN1/* [XSI] Invalid address alignment */
252#defineBUS_ADRERR2/* [XSI] Nonexistent physical address -NOTIMP */
253#defineBUS_OBJERR3/* [XSI] Object-specific HW error - NOTIMP */
254
255/* Codes for SIGTRAP */
256#defineTRAP_BRKPT1/* [XSI] Process breakpoint -NOTIMP */
257#defineTRAP_TRACE2/* [XSI] Process trace trap -NOTIMP */
258
259/* Codes for SIGCHLD */
260#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
261#defineCLD_NOOP0/* if only I knew... */
262#endif
263#defineCLD_EXITED1/* [XSI] child has exited */
264#defineCLD_KILLED2/* [XSI] terminated abnormally, no core file */
265#defineCLD_DUMPED3/* [XSI] terminated abnormally, core file */
266#defineCLD_TRAPPED4/* [XSI] traced child has trapped */
267#defineCLD_STOPPED5/* [XSI] child has stopped */
268#defineCLD_CONTINUED6/* [XSI] stopped child has continued */
269
270/* Codes for SIGPOLL */
271#definePOLL_IN1/* [XSR] Data input available */
272#definePOLL_OUT2/* [XSR] Output buffers available */
273#definePOLL_MSG3/* [XSR] Input message available */
274#definePOLL_ERR4/* [XSR] I/O error */
275#definePOLL_PRI5/* [XSR] High priority input available */
276#definePOLL_HUP6/* [XSR] Device disconnected */
277
278/* union for signal handlers */
279union __sigaction_u {
280void (*__sa_handler)(int);
281void (*__sa_sigaction)(int, struct __siginfo *,
282 void *);
283};
284
285/* Signal vector template for Kernel user boundary */
286struct__sigaction {
287union __sigaction_u __sigaction_u; /* signal handler */
288void (*sa_tramp)(void *, int, int, siginfo_t *, void *);
289sigset_t sa_mask;/* signal mask to apply */
290intsa_flags;/* see signal options below */
291};
292
293/*
294 * Signal vector "template" used in sigaction call.
295 */
296structsigaction {
297union __sigaction_u __sigaction_u; /* signal handler */
298sigset_t sa_mask;/* signal mask to apply */
299intsa_flags;/* see signal options below */
300};
301
302
303
304/* if SA_SIGINFO is set, sa_sigaction is to be used instead of sa_handler. */
305#definesa_handler__sigaction_u.__sa_handler
306#definesa_sigaction__sigaction_u.__sa_sigaction
307
308#define SA_ONSTACK0x0001/* take signal on signal stack */
309#define SA_RESTART0x0002/* restart system on signal return */
310#defineSA_RESETHAND0x0004/* reset to SIG_DFL when taking signal */
311#define SA_NOCLDSTOP0x0008/* do not generate SIGCHLD on child stop */
312#defineSA_NODEFER0x0010/* don't mask the signal we're delivering */
313#defineSA_NOCLDWAIT0x0020/* don't keep zombies around */
314#defineSA_SIGINFO0x0040/* signal handler with SA_SIGINFO args */
315#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
316#defineSA_USERTRAMP0x0100/* do not bounce off kernel's sigtramp */
317/* This will provide 64bit register set in a 32bit user address space */
318#defineSA_64REGSET0x0200/* signal handler with SA_SIGINFO args with 64bit regs information */
319#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
320
321/* the following are the only bits we support from user space, the
322 * rest are for kernel use only.
323 */
324#define SA_USERSPACE_MASK (SA_ONSTACK | SA_RESTART | SA_RESETHAND | SA_NOCLDSTOP | SA_NODEFER | SA_NOCLDWAIT | SA_SIGINFO)
325
326/*
327 * Flags for sigprocmask:
328 */
329#defineSIG_BLOCK1/* block specified signal set */
330#defineSIG_UNBLOCK2/* unblock specified signal set */
331#defineSIG_SETMASK3/* set specified signal set */
332
333/* POSIX 1003.1b required values. */
334#define SI_USER0x10001/* [CX] signal from kill() */
335#define SI_QUEUE0x10002/* [CX] signal from sigqueue() */
336#define SI_TIMER0x10003/* [CX] timer expiration */
337#define SI_ASYNCIO0x10004/* [CX] aio request completion */
338#define SI_MESGQ0x10005/* [CX]from message arrival on empty queue */
339
340#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
341typedefvoid (*sig_t)(int);/* type of signal function */
342#endif
343
344/*
345 * Structure used in sigaltstack call.
346 */
347
348#define SS_ONSTACK0x0001/* take signal on signal stack */
349#defineSS_DISABLE0x0004/* disable taking signals on alternate stack */
350#defineMINSIGSTKSZ32768/* (32K)minimum allowable stack */
351#defineSIGSTKSZ131072/* (128K)recommended stack size */
352
353#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
354/*
355 * 4.3 compatibility:
356 * Signal vector "template" used in sigvec call.
357 */
358structsigvec {
359void(*sv_handler)(int);/* signal handler */
360intsv_mask;/* signal mask to apply */
361intsv_flags;/* see signal options below */
362};
363
364#define SV_ONSTACKSA_ONSTACK
365#define SV_INTERRUPTSA_RESTART/* same bit, opposite sense */
366#define SV_RESETHANDSA_RESETHAND
367#define SV_NODEFERSA_NODEFER
368#define SV_NOCLDSTOPSA_NOCLDSTOP
369#define SV_SIGINFOSA_SIGINFO
370
371#define sv_onstack sv_flags/* isn't compatibility wonderful! */
372#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
373
374/*
375 * Structure used in sigstack call.
376 */
377structsigstack {
378char*ss_sp;/* signal stack pointer */
379intss_onstack;/* current status */
380};
381
382#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
383/*
384 * Macro for converting signal number to a mask suitable for
385 * sigblock().
386 */
387#define sigmask(m)(1 << ((m)-1))
388
389
390#defineBADSIGSIG_ERR
391
392#endif/* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
393#endif/* !_ANSI_SOURCE */
394
395/*
396 * For historical reasons; programs expect signal's return value to be
397 * defined by <sys/signal.h>.
398 */
399__BEGIN_DECLS
400void(*signal(int, void (*)(int)))(int);
401__END_DECLS
402#endif/* !_SYS_SIGNAL_H_ */
403

Archive Download this file

Revision: 1270