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