Annotation of prex/include/sys/signal.h, Revision 1.1.1.1
1.1 nbrk 1: /*
2: * Copyright (c) 1982, 1986, 1989, 1991, 1993
3: * The Regents of the University of California. All rights reserved.
4: * (c) UNIX System Laboratories, Inc.
5: * All or some portions of this file are derived from material licensed
6: * to the University of California by American Telephone and Telegraph
7: * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8: * the permission of UNIX System Laboratories, Inc.
9: *
10: * Redistribution and use in source and binary forms, with or without
11: * modification, are permitted provided that the following conditions
12: * are met:
13: * 1. Redistributions of source code must retain the above copyright
14: * notice, this list of conditions and the following disclaimer.
15: * 2. Redistributions in binary form must reproduce the above copyright
16: * notice, this list of conditions and the following disclaimer in the
17: * documentation and/or other materials provided with the distribution.
18: * 3. Neither the name of the University nor the names of its contributors
19: * may be used to endorse or promote products derived from this software
20: * without specific prior written permission.
21: *
22: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32: * SUCH DAMAGE.
33: *
34: * @(#)signal.h 8.4 (Berkeley) 5/4/95
35: */
36:
37: #ifndef _SYS_SIGNAL_H_
38: #define _SYS_SIGNAL_H_
39:
40: #define NSIG 32 /* counting 0; could be 33 (mask is 1-32) */
41:
42: #include <machine/signal.h> /* sigcontext */
43:
44: #define SIGHUP 1 /* hangup */
45: #define SIGINT 2 /* interrupt */
46: #define SIGQUIT 3 /* quit */
47: #define SIGILL 4 /* illegal instruction (not reset when caught) */
48: #define SIGTRAP 5 /* trace trap (not reset when caught) */
49: #define SIGABRT 6 /* abort() */
50: #define SIGIOT SIGABRT /* compatibility */
51: #define SIGEMT 7 /* EMT instruction */
52: #define SIGFPE 8 /* floating point exception */
53: #define SIGKILL 9 /* kill (cannot be caught or ignored) */
54: #define SIGBUS 10 /* bus error */
55: #define SIGSEGV 11 /* segmentation violation */
56: #define SIGSYS 12 /* bad argument to system call */
57: #define SIGPIPE 13 /* write on a pipe with no one to read it */
58: #define SIGALRM 14 /* alarm clock */
59: #define SIGTERM 15 /* software termination signal from kill */
60: #define SIGURG 16 /* urgent condition on IO channel */
61: #define SIGSTOP 17 /* sendable stop signal not from tty */
62: #define SIGTSTP 18 /* stop signal from tty */
63: #define SIGCONT 19 /* continue a stopped process */
64: #define SIGCHLD 20 /* to parent on child stop or exit */
65: #define SIGTTIN 21 /* to readers pgrp upon background tty read */
66: #define SIGTTOU 22 /* like TTIN for output if (tp->t_local<OSTOP) */
67: #define SIGIO 23 /* input/output possible signal */
68: #define SIGXCPU 24 /* exceeded CPU time limit */
69: #define SIGXFSZ 25 /* exceeded file size limit */
70: #define SIGVTALRM 26 /* virtual time alarm */
71: #define SIGPROF 27 /* profiling time alarm */
72: #define SIGWINCH 28 /* window size changes */
73: #define SIGINFO 29 /* information request */
74: #define SIGUSR1 30 /* user defined signal 1 */
75: #define SIGUSR2 31 /* user defined signal 2 */
76:
77: #ifndef KERNEL
78:
79: /*
80: * Language spec sez we must list exactly one parameter, even though we
81: * actually supply three. Ugh!
82: */
83: #define SIG_DFL (void (*)(int))0
84: #define SIG_IGN (void (*)(int))1
85: #define SIG_ERR (void (*)(int))-1
86:
87: typedef unsigned int sigset_t;
88:
89: union sigval {
90: int sival_int;
91: void *sival_ptr;
92: };
93:
94: struct siginfo {
95: int si_signo; /* redundant signal number */
96: int si_code; /* facility that raised this signal */
97: union sigval si_value; /* value that was queued with signal */
98: };
99:
100: typedef struct siginfo siginfo_t;
101:
102: /*
103: * Signal vector "template" used in sigaction call.
104: */
105: struct sigaction {
106: union {
107: void (*__sa_handler) (int);
108: void (*__sa_sigaction) (int, siginfo_t *, void *);
109: } __sigaction_u;
110: sigset_t sa_mask;
111: int sa_flags;
112: };
113:
114: #define sa_handler __sigaction_u.__sa_handler
115: #define sa_sigaction __sigaction_u.__sa_sigaction
116:
117: /* sa_flags bits */
118:
119: #define SA_ONSTACK 0x0001 /* take signal on signal stack */
120: #define SA_RESTART 0x0002 /* restart system on signal return */
121: #define SA_DISABLE 0x0004 /* disable taking signals on alternate stack */
122: #define SA_NOCLDSTOP 0x0008 /* do not generate SIGCHLD on child stop */
123: #define SA_SIGINFO 0x0040 /* take sa_sigaction handler */
124:
125: /*
126: * Flags for sigprocmask:
127: */
128: #define SIG_BLOCK 1 /* block specified signal set */
129: #define SIG_UNBLOCK 2 /* unblock specified signal set */
130: #define SIG_SETMASK 3 /* set specified signal set */
131:
132: #include <sys/cdefs.h>
133:
134: typedef void (*sig_t)(int); /* type of signal function */
135:
136: /*
137: * Structure used in sigaltstack call.
138: */
139: struct sigaltstack {
140: char *ss_base; /* signal stack base */
141: int ss_size; /* signal stack length */
142: int ss_flags; /* SA_DISABLE and/or SA_ONSTACK */
143: };
144: #define MINSIGSTKSZ 8192 /* minimum allowable stack */
145: #define SIGSTKSZ (MINSIGSTKSZ + 32768) /* recommended stack size */
146:
147: /*
148: * 4.3 compatibility:
149: * Signal vector "template" used in sigvec call.
150: */
151: struct sigvec {
152: void (*sv_handler)(int); /* signal handler */
153: int sv_mask; /* signal mask to apply */
154: int sv_flags; /* see signal options below */
155: };
156:
157: #define SV_ONSTACK SA_ONSTACK
158: #define SV_INTERRUPT SA_RESTART /* same bit, opposite sense */
159: #define sv_onstack sv_flags /* isn't compatibility wonderful! */
160:
161: /*
162: * Structure used in sigstack call.
163: */
164: struct sigstack {
165: char *ss_sp; /* signal stack pointer */
166: int ss_onstack; /* current status */
167: };
168:
169: /*
170: * Macro for converting signal number to a mask suitable for
171: * sigblock().
172: */
173: #define sigmask(m) (1 << ((m)-1))
174:
175: #define BADSIG SIG_ERR
176:
177: /*
178: * For historical reasons; programs expect signal's return value to be
179: * defined by <sys/signal.h>.
180: */
181: __BEGIN_DECLS
182: void (*signal(int, void (*)(int)))(int);
183: __END_DECLS
184:
185: #endif /* !KERNEL */
186: #endif /* !_SYS_SIGNAL_H_ */
CVSweb