xref: /illumos-gate/usr/src/ucbhead/sys/signal.h (revision 7c478bd9)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
28*7c478bd9Sstevel@tonic-gate /*	  All Rights Reserved  	*/
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate /*
31*7c478bd9Sstevel@tonic-gate  * University Copyright- Copyright (c) 1982, 1986, 1988
32*7c478bd9Sstevel@tonic-gate  * The Regents of the University of California
33*7c478bd9Sstevel@tonic-gate  * All Rights Reserved
34*7c478bd9Sstevel@tonic-gate  *
35*7c478bd9Sstevel@tonic-gate  * University Acknowledgment- Portions of this document are derived from
36*7c478bd9Sstevel@tonic-gate  * software developed by the University of California, Berkeley, and its
37*7c478bd9Sstevel@tonic-gate  * contributors.
38*7c478bd9Sstevel@tonic-gate  */
39*7c478bd9Sstevel@tonic-gate 
40*7c478bd9Sstevel@tonic-gate #ifndef _UCB_SYS_SIGNAL_H
41*7c478bd9Sstevel@tonic-gate #define	_UCB_SYS_SIGNAL_H
42*7c478bd9Sstevel@tonic-gate 
43*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
44*7c478bd9Sstevel@tonic-gate 
45*7c478bd9Sstevel@tonic-gate /*
46*7c478bd9Sstevel@tonic-gate  * 4.3BSD signal compatibility header
47*7c478bd9Sstevel@tonic-gate  *
48*7c478bd9Sstevel@tonic-gate  * this file includes all standard SVR4 header info, plus the 4.3BSD
49*7c478bd9Sstevel@tonic-gate  * structures  - 4.3BSD signal codes are translated to SVR4 generic
50*7c478bd9Sstevel@tonic-gate  * signal codes where applicable
51*7c478bd9Sstevel@tonic-gate  */
52*7c478bd9Sstevel@tonic-gate 
53*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
54*7c478bd9Sstevel@tonic-gate extern "C" {
55*7c478bd9Sstevel@tonic-gate #endif
56*7c478bd9Sstevel@tonic-gate 
57*7c478bd9Sstevel@tonic-gate /*
58*7c478bd9Sstevel@tonic-gate  * SysV <signal.h>
59*7c478bd9Sstevel@tonic-gate  */
60*7c478bd9Sstevel@tonic-gate 
61*7c478bd9Sstevel@tonic-gate /* ---- <signal.h> ---- */
62*7c478bd9Sstevel@tonic-gate 
63*7c478bd9Sstevel@tonic-gate /*	Copyright (c) 1988 AT&T	*/
64*7c478bd9Sstevel@tonic-gate /*	  All Rights Reserved  	*/
65*7c478bd9Sstevel@tonic-gate 
66*7c478bd9Sstevel@tonic-gate 
67*7c478bd9Sstevel@tonic-gate #ifndef _SIGNAL_H
68*7c478bd9Sstevel@tonic-gate #define	_SIGNAL_H
69*7c478bd9Sstevel@tonic-gate 
70*7c478bd9Sstevel@tonic-gate /* ---- <sys/signal.h> ---- */
71*7c478bd9Sstevel@tonic-gate 
72*7c478bd9Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
73*7c478bd9Sstevel@tonic-gate /*	  All Rights Reserved  	*/
74*7c478bd9Sstevel@tonic-gate 
75*7c478bd9Sstevel@tonic-gate 
76*7c478bd9Sstevel@tonic-gate #ifndef _SYS_SIGNAL_H
77*7c478bd9Sstevel@tonic-gate #define	_SYS_SIGNAL_H
78*7c478bd9Sstevel@tonic-gate 
79*7c478bd9Sstevel@tonic-gate #define	SIGHUP	1	/* hangup */
80*7c478bd9Sstevel@tonic-gate #define	SIGINT	2	/* interrupt (rubout) */
81*7c478bd9Sstevel@tonic-gate #define	SIGQUIT	3	/* quit (ASCII FS) */
82*7c478bd9Sstevel@tonic-gate #define	SIGILL	4	/* illegal instruction (not reset when caught) */
83*7c478bd9Sstevel@tonic-gate #define	SIGTRAP	5	/* trace trap (not reset when caught) */
84*7c478bd9Sstevel@tonic-gate #define	SIGIOT	6	/* IOT instruction */
85*7c478bd9Sstevel@tonic-gate #define	SIGABRT 6	/* used by abort, replace SIGIOT in the future */
86*7c478bd9Sstevel@tonic-gate #define	SIGEMT	7	/* EMT instruction */
87*7c478bd9Sstevel@tonic-gate #define	SIGFPE	8	/* floating point exception */
88*7c478bd9Sstevel@tonic-gate #define	SIGKILL	9	/* kill (cannot be caught or ignored) */
89*7c478bd9Sstevel@tonic-gate #define	SIGBUS	10	/* bus error */
90*7c478bd9Sstevel@tonic-gate #define	SIGSEGV	11	/* segmentation violation */
91*7c478bd9Sstevel@tonic-gate #define	SIGSYS	12	/* bad argument to system call */
92*7c478bd9Sstevel@tonic-gate #define	SIGPIPE	13	/* write on a pipe with no one to read it */
93*7c478bd9Sstevel@tonic-gate #define	SIGALRM	14	/* alarm clock */
94*7c478bd9Sstevel@tonic-gate #define	SIGTERM	15	/* software termination signal from kill */
95*7c478bd9Sstevel@tonic-gate #define	SIGUSR1	16	/* user defined signal 1 */
96*7c478bd9Sstevel@tonic-gate #define	SIGUSR2	17	/* user defined signal 2 */
97*7c478bd9Sstevel@tonic-gate #define	SIGCLD	18	/* child status change */
98*7c478bd9Sstevel@tonic-gate #define	SIGCHLD	18	/* child status change alias (POSIX) */
99*7c478bd9Sstevel@tonic-gate #define	SIGPWR	19	/* power-fail restart */
100*7c478bd9Sstevel@tonic-gate #define	SIGWINCH 20	/* window size change */
101*7c478bd9Sstevel@tonic-gate #define	SIGURG	21	/* urgent socket condition */
102*7c478bd9Sstevel@tonic-gate #define	SIGPOLL 22	/* pollable event occured */
103*7c478bd9Sstevel@tonic-gate #define	SIGIO	SIGPOLL	/* socket I/O possible (SIGPOLL alias) */
104*7c478bd9Sstevel@tonic-gate #define	SIGSTOP 23	/* stop (cannot be caught or ignored) */
105*7c478bd9Sstevel@tonic-gate #define	SIGTSTP 24	/* user stop requested from tty */
106*7c478bd9Sstevel@tonic-gate #define	SIGCONT 25	/* stopped process has been continued */
107*7c478bd9Sstevel@tonic-gate #define	SIGTTIN 26	/* background tty read attempted */
108*7c478bd9Sstevel@tonic-gate #define	SIGTTOU 27	/* background tty write attempted */
109*7c478bd9Sstevel@tonic-gate #define	SIGVTALRM 28	/* virtual timer expired */
110*7c478bd9Sstevel@tonic-gate #define	SIGPROF 29	/* profiling timer expired */
111*7c478bd9Sstevel@tonic-gate #define	SIGXCPU 30	/* exceeded cpu limit */
112*7c478bd9Sstevel@tonic-gate #define	SIGXFSZ 31	/* exceeded file size limit */
113*7c478bd9Sstevel@tonic-gate #define	SIGWAITING 32	/* process's lwps are blocked */
114*7c478bd9Sstevel@tonic-gate #define	SIGLWP	33	/* special signal used by thread library */
115*7c478bd9Sstevel@tonic-gate 
116*7c478bd9Sstevel@tonic-gate #if	defined(__cplusplus)
117*7c478bd9Sstevel@tonic-gate 
118*7c478bd9Sstevel@tonic-gate typedef	void SIG_FUNC_TYP(int);
119*7c478bd9Sstevel@tonic-gate typedef	SIG_FUNC_TYP *SIG_TYP;
120*7c478bd9Sstevel@tonic-gate #define	SIG_PF SIG_TYP
121*7c478bd9Sstevel@tonic-gate 
122*7c478bd9Sstevel@tonic-gate #define	SIG_DFL	(SIG_PF)0
123*7c478bd9Sstevel@tonic-gate #define	SIG_ERR (SIG_PF)-1
124*7c478bd9Sstevel@tonic-gate #define	SIG_IGN	(SIG_PF)1
125*7c478bd9Sstevel@tonic-gate #define	SIG_HOLD (SIG_PF)2
126*7c478bd9Sstevel@tonic-gate 
127*7c478bd9Sstevel@tonic-gate #elif	defined(lint)
128*7c478bd9Sstevel@tonic-gate 
129*7c478bd9Sstevel@tonic-gate #define	SIG_DFL	(void(*)(int))0
130*7c478bd9Sstevel@tonic-gate #define	SIG_ERR (void(*)(int))0
131*7c478bd9Sstevel@tonic-gate #define	SIG_IGN	(void (*)(int))0
132*7c478bd9Sstevel@tonic-gate #define	SIG_HOLD (void(*)(int))0
133*7c478bd9Sstevel@tonic-gate 
134*7c478bd9Sstevel@tonic-gate #else
135*7c478bd9Sstevel@tonic-gate 
136*7c478bd9Sstevel@tonic-gate #define	SIG_DFL	(void(*)())0
137*7c478bd9Sstevel@tonic-gate #define	SIG_ERR	(void(*)())-1
138*7c478bd9Sstevel@tonic-gate #define	SIG_IGN	(void (*)())1
139*7c478bd9Sstevel@tonic-gate #define	SIG_HOLD (void(*)())2
140*7c478bd9Sstevel@tonic-gate 
141*7c478bd9Sstevel@tonic-gate #endif
142*7c478bd9Sstevel@tonic-gate 
143*7c478bd9Sstevel@tonic-gate #define	SIG_BLOCK	1
144*7c478bd9Sstevel@tonic-gate #define	SIG_UNBLOCK	2
145*7c478bd9Sstevel@tonic-gate #define	SIG_SETMASK	3
146*7c478bd9Sstevel@tonic-gate 
147*7c478bd9Sstevel@tonic-gate #define	SIGNO_MASK	0xFF
148*7c478bd9Sstevel@tonic-gate #define	SIGDEFER	0x100
149*7c478bd9Sstevel@tonic-gate #define	SIGHOLD		0x200
150*7c478bd9Sstevel@tonic-gate #define	SIGRELSE	0x400
151*7c478bd9Sstevel@tonic-gate #define	SIGIGNORE	0x800
152*7c478bd9Sstevel@tonic-gate #define	SIGPAUSE	0x1000
153*7c478bd9Sstevel@tonic-gate 
154*7c478bd9Sstevel@tonic-gate #if !defined(_STRICT_STDC) || defined(_POSIX_SOURCE)
155*7c478bd9Sstevel@tonic-gate 
156*7c478bd9Sstevel@tonic-gate #ifndef	_SIGSET_T
157*7c478bd9Sstevel@tonic-gate #define	_SIGSET_T
158*7c478bd9Sstevel@tonic-gate typedef struct {		/* signal set type */
159*7c478bd9Sstevel@tonic-gate 	unsigned int	__sigbits[4];
160*7c478bd9Sstevel@tonic-gate } sigset_t;
161*7c478bd9Sstevel@tonic-gate #endif	/* _SIGSET_T */
162*7c478bd9Sstevel@tonic-gate 
163*7c478bd9Sstevel@tonic-gate typedef	struct {
164*7c478bd9Sstevel@tonic-gate 	unsigned int	__sigbits[2];
165*7c478bd9Sstevel@tonic-gate } k_sigset_t;
166*7c478bd9Sstevel@tonic-gate 
167*7c478bd9Sstevel@tonic-gate struct sigaction {
168*7c478bd9Sstevel@tonic-gate 	int sa_flags;
169*7c478bd9Sstevel@tonic-gate #if defined(__cplusplus)
170*7c478bd9Sstevel@tonic-gate 	void (*sa_handler)(int);
171*7c478bd9Sstevel@tonic-gate #else
172*7c478bd9Sstevel@tonic-gate 	void (*sa_handler)();
173*7c478bd9Sstevel@tonic-gate #endif
174*7c478bd9Sstevel@tonic-gate 	sigset_t sa_mask;
175*7c478bd9Sstevel@tonic-gate 	int sa_resv[2];
176*7c478bd9Sstevel@tonic-gate };
177*7c478bd9Sstevel@tonic-gate 
178*7c478bd9Sstevel@tonic-gate /* this is only valid for SIGCLD */
179*7c478bd9Sstevel@tonic-gate #define	SA_NOCLDSTOP	0x00020000	/* don't send job control SIGCLD's */
180*7c478bd9Sstevel@tonic-gate #endif
181*7c478bd9Sstevel@tonic-gate 
182*7c478bd9Sstevel@tonic-gate #if !defined(_STRICT_STDC) && !defined(_POSIX_SOURCE)
183*7c478bd9Sstevel@tonic-gate 			/* non-comformant ANSI compilation	*/
184*7c478bd9Sstevel@tonic-gate 
185*7c478bd9Sstevel@tonic-gate /* definitions for the sa_flags field */
186*7c478bd9Sstevel@tonic-gate #define	SA_ONSTACK	0x00000001
187*7c478bd9Sstevel@tonic-gate #define	SA_RESETHAND	0x00000002
188*7c478bd9Sstevel@tonic-gate #define	SA_RESTART	0x00000004
189*7c478bd9Sstevel@tonic-gate #define	SA_SIGINFO	0x00000008
190*7c478bd9Sstevel@tonic-gate #define	SA_NODEFER	0x00000010
191*7c478bd9Sstevel@tonic-gate 
192*7c478bd9Sstevel@tonic-gate /* this is only valid for SIGCLD */
193*7c478bd9Sstevel@tonic-gate #define	SA_NOCLDWAIT	0x00010000	/* don't save zombie children	 */
194*7c478bd9Sstevel@tonic-gate 
195*7c478bd9Sstevel@tonic-gate #define	NSIG	34	/* valid signals range from 1 to NSIG-1 */
196*7c478bd9Sstevel@tonic-gate #define	MAXSIG	33	/* size of u_signal[], NSIG-1 <= MAXSIG */
197*7c478bd9Sstevel@tonic-gate 
198*7c478bd9Sstevel@tonic-gate #define	MINSIGSTKSZ	2048
199*7c478bd9Sstevel@tonic-gate #define	SIGSTKSZ	8192
200*7c478bd9Sstevel@tonic-gate 
201*7c478bd9Sstevel@tonic-gate #define	SS_ONSTACK	0x00000001
202*7c478bd9Sstevel@tonic-gate #define	SS_DISABLE	0x00000002
203*7c478bd9Sstevel@tonic-gate 
204*7c478bd9Sstevel@tonic-gate struct sigaltstack {
205*7c478bd9Sstevel@tonic-gate 	char	*ss_sp;
206*7c478bd9Sstevel@tonic-gate 	int	ss_size;
207*7c478bd9Sstevel@tonic-gate 	int	ss_flags;
208*7c478bd9Sstevel@tonic-gate };
209*7c478bd9Sstevel@tonic-gate 
210*7c478bd9Sstevel@tonic-gate typedef struct sigaltstack stack_t;
211*7c478bd9Sstevel@tonic-gate 
212*7c478bd9Sstevel@tonic-gate #endif /* __STDC__ && !POSIX */
213*7c478bd9Sstevel@tonic-gate 
214*7c478bd9Sstevel@tonic-gate 
215*7c478bd9Sstevel@tonic-gate #endif /* _SYS_SIGNAL_H */
216*7c478bd9Sstevel@tonic-gate 
217*7c478bd9Sstevel@tonic-gate /* ---- end of SysV <sys/signal.h> ---- */
218*7c478bd9Sstevel@tonic-gate 
219*7c478bd9Sstevel@tonic-gate typedef int	sig_atomic_t;
220*7c478bd9Sstevel@tonic-gate 
221*7c478bd9Sstevel@tonic-gate #if defined(__STDC__)
222*7c478bd9Sstevel@tonic-gate 
223*7c478bd9Sstevel@tonic-gate extern const char *_sys_siglist[];
224*7c478bd9Sstevel@tonic-gate extern const int _sys_nsig;
225*7c478bd9Sstevel@tonic-gate 
226*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus
227*7c478bd9Sstevel@tonic-gate extern "C" SIG_PF signal(int, SIG_PF);
228*7c478bd9Sstevel@tonic-gate #else
229*7c478bd9Sstevel@tonic-gate extern void (*signal(int, void (*)(int)))(int);
230*7c478bd9Sstevel@tonic-gate #endif
231*7c478bd9Sstevel@tonic-gate extern int raise(int);
232*7c478bd9Sstevel@tonic-gate 
233*7c478bd9Sstevel@tonic-gate #if !defined(_STRICT_STDC) || defined(_POSIX_SOURCE) || \
234*7c478bd9Sstevel@tonic-gate 	defined(_XOPEN_SOURCE)
235*7c478bd9Sstevel@tonic-gate extern int kill(pid_t, int);
236*7c478bd9Sstevel@tonic-gate extern int sigaction(int, const struct sigaction *, struct sigaction *);
237*7c478bd9Sstevel@tonic-gate extern int sigaddset(sigset_t *, int);
238*7c478bd9Sstevel@tonic-gate extern int sigdelset(sigset_t *, int);
239*7c478bd9Sstevel@tonic-gate extern int sigemptyset(sigset_t *);
240*7c478bd9Sstevel@tonic-gate extern int sigfillset(sigset_t *);
241*7c478bd9Sstevel@tonic-gate extern int sigismember(const sigset_t *, int);
242*7c478bd9Sstevel@tonic-gate extern int sigpending(sigset_t *);
243*7c478bd9Sstevel@tonic-gate extern int sigprocmask(int, const sigset_t *, sigset_t *);
244*7c478bd9Sstevel@tonic-gate extern int sigsuspend(const sigset_t *);
245*7c478bd9Sstevel@tonic-gate #endif
246*7c478bd9Sstevel@tonic-gate 
247*7c478bd9Sstevel@tonic-gate #if !defined(_STRICT_STDC) && !defined(_POSIX_SOURCE)
248*7c478bd9Sstevel@tonic-gate extern int gsignal(int);
249*7c478bd9Sstevel@tonic-gate extern void (*sigset(int, void (*)(int)))(int);
250*7c478bd9Sstevel@tonic-gate extern int sighold(int);
251*7c478bd9Sstevel@tonic-gate extern int sigrelse(int);
252*7c478bd9Sstevel@tonic-gate extern int sigignore(int);
253*7c478bd9Sstevel@tonic-gate extern int sigpause(int);
254*7c478bd9Sstevel@tonic-gate extern int (*ssignal(int, int (*)(int)))(int);
255*7c478bd9Sstevel@tonic-gate extern int sigaltstack(const stack_t *, stack_t *);
256*7c478bd9Sstevel@tonic-gate /* extern int sigsend(idtype_t, id_t, int); */
257*7c478bd9Sstevel@tonic-gate /* extern int sigsendset(const procset_t *, int); */
258*7c478bd9Sstevel@tonic-gate #endif
259*7c478bd9Sstevel@tonic-gate 
260*7c478bd9Sstevel@tonic-gate #else
261*7c478bd9Sstevel@tonic-gate 
262*7c478bd9Sstevel@tonic-gate extern char *_sys_siglist[];
263*7c478bd9Sstevel@tonic-gate extern int _sys_nsig;
264*7c478bd9Sstevel@tonic-gate 
265*7c478bd9Sstevel@tonic-gate extern	void(*signal())();
266*7c478bd9Sstevel@tonic-gate extern  void(*sigset())();
267*7c478bd9Sstevel@tonic-gate 
268*7c478bd9Sstevel@tonic-gate #endif	/* __STDC__ */
269*7c478bd9Sstevel@tonic-gate 
270*7c478bd9Sstevel@tonic-gate #endif	/* _SIGNAL_H */
271*7c478bd9Sstevel@tonic-gate /* ---- end of SysV <signal.h> ---- */
272*7c478bd9Sstevel@tonic-gate 
273*7c478bd9Sstevel@tonic-gate #define	sigmask(m)	(m > 32 ? 0 : (1 << ((m)-1)))
274*7c478bd9Sstevel@tonic-gate 
275*7c478bd9Sstevel@tonic-gate /*
276*7c478bd9Sstevel@tonic-gate  * 4.3BSD structure used in sigstack call.
277*7c478bd9Sstevel@tonic-gate  */
278*7c478bd9Sstevel@tonic-gate 
279*7c478bd9Sstevel@tonic-gate struct  sigstack {
280*7c478bd9Sstevel@tonic-gate 	char	*ss_sp;			/* signal stack pointer */
281*7c478bd9Sstevel@tonic-gate 	int	ss_onstack;		/* current status */
282*7c478bd9Sstevel@tonic-gate };
283*7c478bd9Sstevel@tonic-gate 
284*7c478bd9Sstevel@tonic-gate #define	SV_ONSTACK	0x0001  /* take signal on signal stack */
285*7c478bd9Sstevel@tonic-gate #define	SV_INTERRUPT    0x0002  /* do not restart system on signal return */
286*7c478bd9Sstevel@tonic-gate #define	SV_RESETHAND    0x0004  /* reset handler to SIG_DFL when signal taken */
287*7c478bd9Sstevel@tonic-gate 
288*7c478bd9Sstevel@tonic-gate #define	sv_onstack sv_flags
289*7c478bd9Sstevel@tonic-gate 
290*7c478bd9Sstevel@tonic-gate struct  sigcontext {
291*7c478bd9Sstevel@tonic-gate 	int	sc_onstack;		/* sigstack state to restore */
292*7c478bd9Sstevel@tonic-gate 	int	sc_mask;		/* signal mask to restore */
293*7c478bd9Sstevel@tonic-gate #ifdef u3b2
294*7c478bd9Sstevel@tonic-gate 	int	sc_sp;			/* sp to restore */
295*7c478bd9Sstevel@tonic-gate 	int	sc_fp;			/* fp to restore */
296*7c478bd9Sstevel@tonic-gate 	int	sc_ap;			/* ap to restore */
297*7c478bd9Sstevel@tonic-gate 	int	sc_pc;			/* pc to restore */
298*7c478bd9Sstevel@tonic-gate 	int	sc_ps;			/* psw to restore */
299*7c478bd9Sstevel@tonic-gate #endif
300*7c478bd9Sstevel@tonic-gate #ifdef vax
301*7c478bd9Sstevel@tonic-gate 	int	sc_sp;			/* sp to restore */
302*7c478bd9Sstevel@tonic-gate 	int	sc_fp;			/* fp to restore */
303*7c478bd9Sstevel@tonic-gate 	int	sc_ap;			/* ap to restore */
304*7c478bd9Sstevel@tonic-gate 	int	sc_pc;			/* pc to restore */
305*7c478bd9Sstevel@tonic-gate 	int	sc_ps;			/* psl to restore */
306*7c478bd9Sstevel@tonic-gate #endif /* vax */
307*7c478bd9Sstevel@tonic-gate #ifdef mc68000
308*7c478bd9Sstevel@tonic-gate 	int	sc_sp;			/* sp to restore */
309*7c478bd9Sstevel@tonic-gate 	int	sc_pc;			/* pc to retore */
310*7c478bd9Sstevel@tonic-gate 	int	sc_ps;			/* psl to restore */
311*7c478bd9Sstevel@tonic-gate #endif /* mc68000 */
312*7c478bd9Sstevel@tonic-gate #ifdef __sparc
313*7c478bd9Sstevel@tonic-gate #define	MAXWINDOW	31		/* max usable windows in sparc */
314*7c478bd9Sstevel@tonic-gate 	long	sc_sp;			/* sp to restore */
315*7c478bd9Sstevel@tonic-gate 	long	sc_pc;			/* pc to retore */
316*7c478bd9Sstevel@tonic-gate 	long	sc_npc;			/* next pc to restore */
317*7c478bd9Sstevel@tonic-gate 	long	sc_psr;			/* psr to restore */
318*7c478bd9Sstevel@tonic-gate 					/* aliased to REG_CCR for sparcv9 */
319*7c478bd9Sstevel@tonic-gate 	long	sc_g1;			/* register that must be restored */
320*7c478bd9Sstevel@tonic-gate 	long	sc_o0;
321*7c478bd9Sstevel@tonic-gate 	int	sc_wbcnt;		/* number of outstanding windows */
322*7c478bd9Sstevel@tonic-gate 	char	*sc_spbuf[MAXWINDOW];	/* sp's for each wbuf */
323*7c478bd9Sstevel@tonic-gate 	long	sc_wbuf[MAXWINDOW][16];	/* outstanding window save buffer */
324*7c478bd9Sstevel@tonic-gate #endif /* __sparc */
325*7c478bd9Sstevel@tonic-gate #if defined(__amd64)
326*7c478bd9Sstevel@tonic-gate 	long	sc_sp;			/* sp to restore */
327*7c478bd9Sstevel@tonic-gate 	long	sc_pc;			/* pc to retore */
328*7c478bd9Sstevel@tonic-gate 	long	sc_ps;			/* psl to restore */
329*7c478bd9Sstevel@tonic-gate 	long	sc_rax;			/* rax to restore */
330*7c478bd9Sstevel@tonic-gate 	long	sc_rdx;			/* rdx to restore */
331*7c478bd9Sstevel@tonic-gate #define	sc_r0	sc_rax
332*7c478bd9Sstevel@tonic-gate #define	sc_r1	sc_rdx
333*7c478bd9Sstevel@tonic-gate #elif defined(__i386)
334*7c478bd9Sstevel@tonic-gate 	int	sc_sp;			/* sp to restore */
335*7c478bd9Sstevel@tonic-gate 	int	sc_pc;			/* pc to retore */
336*7c478bd9Sstevel@tonic-gate 	int	sc_ps;			/* psl to restore */
337*7c478bd9Sstevel@tonic-gate 	int	sc_eax;			/* eax to restore */
338*7c478bd9Sstevel@tonic-gate 	int	sc_edx;			/* edx to restore */
339*7c478bd9Sstevel@tonic-gate #define	sc_r0	sc_eax
340*7c478bd9Sstevel@tonic-gate #define	sc_r1	sc_edx
341*7c478bd9Sstevel@tonic-gate #endif
342*7c478bd9Sstevel@tonic-gate };
343*7c478bd9Sstevel@tonic-gate 
344*7c478bd9Sstevel@tonic-gate /*
345*7c478bd9Sstevel@tonic-gate  * 4.3BSD signal vector structure used in sigvec call.
346*7c478bd9Sstevel@tonic-gate  */
347*7c478bd9Sstevel@tonic-gate struct  sigvec {
348*7c478bd9Sstevel@tonic-gate #if defined(__cplusplus)
349*7c478bd9Sstevel@tonic-gate 	void	(*sv_handler)(int, int, struct sigcontext *, char *);
350*7c478bd9Sstevel@tonic-gate #else
351*7c478bd9Sstevel@tonic-gate 	void	(*sv_handler)();	/* signal handler */
352*7c478bd9Sstevel@tonic-gate #endif
353*7c478bd9Sstevel@tonic-gate 	int	sv_mask;		/* signal mask to apply */
354*7c478bd9Sstevel@tonic-gate 	int	sv_flags;		/* see signal options below */
355*7c478bd9Sstevel@tonic-gate };
356*7c478bd9Sstevel@tonic-gate 
357*7c478bd9Sstevel@tonic-gate #if defined(__STDC__)
358*7c478bd9Sstevel@tonic-gate extern int sigvec(int, struct sigvec *, struct sigvec *);
359*7c478bd9Sstevel@tonic-gate extern int sigblock(int);
360*7c478bd9Sstevel@tonic-gate extern int sigsetmask(int);
361*7c478bd9Sstevel@tonic-gate #endif
362*7c478bd9Sstevel@tonic-gate 
363*7c478bd9Sstevel@tonic-gate /*
364*7c478bd9Sstevel@tonic-gate  * Signal codes taken verbatim from SunOS4.1
365*7c478bd9Sstevel@tonic-gate  */
366*7c478bd9Sstevel@tonic-gate #ifdef	vax
367*7c478bd9Sstevel@tonic-gate #define	    ILL_RESAD_FAULT	0x0	/* reserved addressing fault */
368*7c478bd9Sstevel@tonic-gate #define	    ILL_PRIVIN_FAULT	0x1	/* privileged instruction fault */
369*7c478bd9Sstevel@tonic-gate #define	    ILL_RESOP_FAULT	0x2	/* reserved operand fault */
370*7c478bd9Sstevel@tonic-gate #endif	/* vax */
371*7c478bd9Sstevel@tonic-gate #ifdef	mc68000
372*7c478bd9Sstevel@tonic-gate #define	    ILL_ILLINSTR_FAULT	0x10	/* illegal instruction fault */
373*7c478bd9Sstevel@tonic-gate #define	    ILL_PRIVVIO_FAULT	0x20	/* privilege violation fault */
374*7c478bd9Sstevel@tonic-gate #define	    ILL_COPROCERR_FAULT	0x34	/* [coprocessor protocol error fault] */
375*7c478bd9Sstevel@tonic-gate #define	    ILL_TRAP1_FAULT	0x84	/* trap #1 fault */
376*7c478bd9Sstevel@tonic-gate #define	    ILL_TRAP2_FAULT	0x88	/* trap #2 fault */
377*7c478bd9Sstevel@tonic-gate #define	    ILL_TRAP3_FAULT	0x8c	/* trap #3 fault */
378*7c478bd9Sstevel@tonic-gate #define	    ILL_TRAP4_FAULT	0x90	/* trap #4 fault */
379*7c478bd9Sstevel@tonic-gate #define	    ILL_TRAP5_FAULT	0x94	/* trap #5 fault */
380*7c478bd9Sstevel@tonic-gate #define	    ILL_TRAP6_FAULT	0x98	/* trap #6 fault */
381*7c478bd9Sstevel@tonic-gate #define	    ILL_TRAP7_FAULT	0x9c	/* trap #7 fault */
382*7c478bd9Sstevel@tonic-gate #define	    ILL_TRAP8_FAULT	0xa0	/* trap #8 fault */
383*7c478bd9Sstevel@tonic-gate #define	    ILL_TRAP9_FAULT	0xa4	/* trap #9 fault */
384*7c478bd9Sstevel@tonic-gate #define	    ILL_TRAP10_FAULT	0xa8	/* trap #10 fault */
385*7c478bd9Sstevel@tonic-gate #define	    ILL_TRAP11_FAULT	0xac	/* trap #11 fault */
386*7c478bd9Sstevel@tonic-gate #define	    ILL_TRAP12_FAULT	0xb0	/* trap #12 fault */
387*7c478bd9Sstevel@tonic-gate #define	    ILL_TRAP13_FAULT	0xb4	/* trap #13 fault */
388*7c478bd9Sstevel@tonic-gate #define	    ILL_TRAP14_FAULT	0xb8	/* trap #14 fault */
389*7c478bd9Sstevel@tonic-gate #endif	/* mc68000 */
390*7c478bd9Sstevel@tonic-gate #ifdef	sparc
391*7c478bd9Sstevel@tonic-gate #define	    ILL_STACK		0x00	/* bad stack */
392*7c478bd9Sstevel@tonic-gate #define	    ILL_ILLINSTR_FAULT	0x02	/* illegal instruction fault */
393*7c478bd9Sstevel@tonic-gate #define	    ILL_PRIVINSTR_FAULT	0x03	/* privileged instruction fault */
394*7c478bd9Sstevel@tonic-gate /* codes from 0x80 to 0xff are software traps */
395*7c478bd9Sstevel@tonic-gate #define	    ILL_TRAP_FAULT(n)	((n)+0x80) /* trap n fault */
396*7c478bd9Sstevel@tonic-gate #endif	/* sparc */
397*7c478bd9Sstevel@tonic-gate #if defined(__i386) || defined(__amd64)
398*7c478bd9Sstevel@tonic-gate #define	    ILL_ILLINSTR_FAULT	0x02	/* illegal instruction fault */
399*7c478bd9Sstevel@tonic-gate #endif
400*7c478bd9Sstevel@tonic-gate 
401*7c478bd9Sstevel@tonic-gate #ifdef	mc68000
402*7c478bd9Sstevel@tonic-gate #define	    EMT_EMU1010		0x28	/* line 1010 emulator trap */
403*7c478bd9Sstevel@tonic-gate #define	    EMT_EMU1111		0x2c	/* line 1111 emulator trap */
404*7c478bd9Sstevel@tonic-gate #endif	/* mc68000 */
405*7c478bd9Sstevel@tonic-gate #ifdef	sparc
406*7c478bd9Sstevel@tonic-gate #define	    EMT_TAG		0x0a	/* tag overflow */
407*7c478bd9Sstevel@tonic-gate #endif	/* sparc */
408*7c478bd9Sstevel@tonic-gate 
409*7c478bd9Sstevel@tonic-gate #ifdef	vax
410*7c478bd9Sstevel@tonic-gate #define	    FPE_INTOVF_TRAP	0x1	/* integer overflow */
411*7c478bd9Sstevel@tonic-gate #define	    FPE_INTDIV_TRAP	0x2	/* integer divide by zero */
412*7c478bd9Sstevel@tonic-gate #define	    FPE_FLTOVF_TRAP	0x3	/* floating overflow */
413*7c478bd9Sstevel@tonic-gate #define	    FPE_FLTDIV_TRAP	0x4	/* floating/decimal divide by zero */
414*7c478bd9Sstevel@tonic-gate #define	    FPE_FLTUND_TRAP	0x5	/* floating underflow */
415*7c478bd9Sstevel@tonic-gate #define	    FPE_DECOVF_TRAP	0x6	/* decimal overflow */
416*7c478bd9Sstevel@tonic-gate #define	    FPE_SUBRNG_TRAP	0x7	/* subscript out of range */
417*7c478bd9Sstevel@tonic-gate #define	    FPE_FLTOVF_FAULT	0x8	/* floating overflow fault */
418*7c478bd9Sstevel@tonic-gate #define	    FPE_FLTDIV_FAULT	0x9	/* divide by zero floating fault */
419*7c478bd9Sstevel@tonic-gate #define	    FPE_FLTUND_FAULT	0xa	/* floating underflow fault */
420*7c478bd9Sstevel@tonic-gate #endif	/* vax */
421*7c478bd9Sstevel@tonic-gate #ifdef	mc68000
422*7c478bd9Sstevel@tonic-gate #define	    FPE_INTDIV_TRAP	0x14	/* integer divide by zero */
423*7c478bd9Sstevel@tonic-gate #define	    FPE_CHKINST_TRAP	0x18	/* CHK [CHK2] instruction */
424*7c478bd9Sstevel@tonic-gate #define	    FPE_TRAPV_TRAP	0x1c	/* TRAPV [cpTRAPcc TRAPcc] instr */
425*7c478bd9Sstevel@tonic-gate #define	    FPE_FLTBSUN_TRAP	0xc0	/* [branch or set on unordered cond] */
426*7c478bd9Sstevel@tonic-gate #define	    FPE_FLTINEX_TRAP	0xc4	/* [floating inexact result] */
427*7c478bd9Sstevel@tonic-gate #define	    FPE_FLTDIV_TRAP	0xc8	/* [floating divide by zero] */
428*7c478bd9Sstevel@tonic-gate #define	    FPE_FLTUND_TRAP	0xcc	/* [floating underflow] */
429*7c478bd9Sstevel@tonic-gate #define	    FPE_FLTOPERR_TRAP	0xd0	/* [floating operand error] */
430*7c478bd9Sstevel@tonic-gate #define	    FPE_FLTOVF_TRAP	0xd4	/* [floating overflow] */
431*7c478bd9Sstevel@tonic-gate #define	    FPE_FLTNAN_TRAP	0xd8	/* [floating Not-A-Number] */
432*7c478bd9Sstevel@tonic-gate #ifdef	sun
433*7c478bd9Sstevel@tonic-gate #define	    FPE_FPA_ENABLE	0x400	/* [FPA not enabled] */
434*7c478bd9Sstevel@tonic-gate #define	    FPE_FPA_ERROR	0x404	/* [FPA arithmetic exception] */
435*7c478bd9Sstevel@tonic-gate #endif	/* sun */
436*7c478bd9Sstevel@tonic-gate #endif	/* mc68000 */
437*7c478bd9Sstevel@tonic-gate #ifdef	sparc
438*7c478bd9Sstevel@tonic-gate #define	    FPE_INTOVF_TRAP	0x1	/* integer overflow */
439*7c478bd9Sstevel@tonic-gate #define	    FPE_STARTSIG_TRAP	0x2	/* process using fp */
440*7c478bd9Sstevel@tonic-gate #define	    FPE_INTDIV_TRAP	0x14	/* integer divide by zero */
441*7c478bd9Sstevel@tonic-gate #define	    FPE_FLTINEX_TRAP	0xc4	/* [floating inexact result] */
442*7c478bd9Sstevel@tonic-gate #define	    FPE_FLTDIV_TRAP	0xc8	/* [floating divide by zero] */
443*7c478bd9Sstevel@tonic-gate #define	    FPE_FLTUND_TRAP	0xcc	/* [floating underflow] */
444*7c478bd9Sstevel@tonic-gate #define	    FPE_FLTOPERR_TRAP	0xd0	/* [floating operand error] */
445*7c478bd9Sstevel@tonic-gate #define	    FPE_FLTOVF_TRAP	0xd4	/* [floating overflow] */
446*7c478bd9Sstevel@tonic-gate #endif	/* sparc */
447*7c478bd9Sstevel@tonic-gate 
448*7c478bd9Sstevel@tonic-gate /*
449*7c478bd9Sstevel@tonic-gate  * The codes for SIGBUS and SIGSEGV are described in <vm/faultcode.h>
450*7c478bd9Sstevel@tonic-gate  * These are the same between SunOS4.1 and SunOS5.0
451*7c478bd9Sstevel@tonic-gate  */
452*7c478bd9Sstevel@tonic-gate 
453*7c478bd9Sstevel@tonic-gate #include <vm/faultcode.h>
454*7c478bd9Sstevel@tonic-gate 
455*7c478bd9Sstevel@tonic-gate #define	    BUS_HWERR	FC_HWERR	/* misc hardware error (e.g. timeout) */
456*7c478bd9Sstevel@tonic-gate #define	    BUS_ALIGN	FC_ALIGN	/* hardware alignment error */
457*7c478bd9Sstevel@tonic-gate #ifdef	BUS_OBJERR	/* namespace conflict with SysV */
458*7c478bd9Sstevel@tonic-gate #undef	BUS_OBJERR
459*7c478bd9Sstevel@tonic-gate #endif
460*7c478bd9Sstevel@tonic-gate #define	    BUS_OBJERR	FC_OBJERR	/* object returned errno value */
461*7c478bd9Sstevel@tonic-gate /*
462*7c478bd9Sstevel@tonic-gate  * The BUS_CODE(code) will be one of the above.  In the BUS_OBJERR case,
463*7c478bd9Sstevel@tonic-gate  * doing a BUS_ERRNO(code) gives an errno value reported by the underlying
464*7c478bd9Sstevel@tonic-gate  * file object mapped at the fault address.  Note that this appears to be
465*7c478bd9Sstevel@tonic-gate  * duplicated with the segmentation fault case below -- unfortunate, since
466*7c478bd9Sstevel@tonic-gate  * the specification has always claimed that such errors produce SIGBUS.
467*7c478bd9Sstevel@tonic-gate  * The segmentation cases are left defined as a transition aid.
468*7c478bd9Sstevel@tonic-gate  */
469*7c478bd9Sstevel@tonic-gate #define	    BUS_CODE(C)		FC_CODE(C)
470*7c478bd9Sstevel@tonic-gate #define	    BUS_ERRNO(C)	FC_ERRNO(C)
471*7c478bd9Sstevel@tonic-gate 
472*7c478bd9Sstevel@tonic-gate #define	    SEGV_NOMAP	FC_NOMAP	/* no mapping at the fault address */
473*7c478bd9Sstevel@tonic-gate #define	    SEGV_PROT	FC_PROT		/* access exceeded protections */
474*7c478bd9Sstevel@tonic-gate #define	    SEGV_OBJERR	FC_OBJERR	/* object returned errno value */
475*7c478bd9Sstevel@tonic-gate /*
476*7c478bd9Sstevel@tonic-gate  * The SEGV_CODE(code) will be SEGV_NOMAP, SEGV_PROT, or SEGV_OBJERR.
477*7c478bd9Sstevel@tonic-gate  * In the SEGV_OBJERR case, doing a SEGV_ERRNO(code) gives an errno value
478*7c478bd9Sstevel@tonic-gate  * reported by the underlying file object mapped at the fault address.
479*7c478bd9Sstevel@tonic-gate  */
480*7c478bd9Sstevel@tonic-gate #define	    SEGV_CODE(C)	FC_CODE(C)
481*7c478bd9Sstevel@tonic-gate #define	    SEGV_ERRNO(C)	FC_ERRNO(C)
482*7c478bd9Sstevel@tonic-gate #define	    SEGV_MAKE_ERR(e)	FC_MAKE_ERR(e)
483*7c478bd9Sstevel@tonic-gate 
484*7c478bd9Sstevel@tonic-gate #define	SIG_NOADDR	((char *)~0)
485*7c478bd9Sstevel@tonic-gate 
486*7c478bd9Sstevel@tonic-gate #if defined(lint)
487*7c478bd9Sstevel@tonic-gate #define	BADSIG (void(*)())0
488*7c478bd9Sstevel@tonic-gate #else
489*7c478bd9Sstevel@tonic-gate #define	BADSIG (void(*)())-1
490*7c478bd9Sstevel@tonic-gate #endif
491*7c478bd9Sstevel@tonic-gate 
492*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
493*7c478bd9Sstevel@tonic-gate }
494*7c478bd9Sstevel@tonic-gate #endif
495*7c478bd9Sstevel@tonic-gate 
496*7c478bd9Sstevel@tonic-gate #endif /* _UCB_SYS_SIGNAL_H */
497