xref: /illumos-gate/usr/src/ucbhead/sys/signal.h (revision bdf0047c)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*bdf0047cSRoger A. Faulkner  * Common Development and Distribution License (the "License").
6*bdf0047cSRoger A. Faulkner  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
21*bdf0047cSRoger A. Faulkner 
227c478bd9Sstevel@tonic-gate /*
23*bdf0047cSRoger A. Faulkner  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
287c478bd9Sstevel@tonic-gate /*	  All Rights Reserved  	*/
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate /*
317c478bd9Sstevel@tonic-gate  * University Copyright- Copyright (c) 1982, 1986, 1988
327c478bd9Sstevel@tonic-gate  * The Regents of the University of California
337c478bd9Sstevel@tonic-gate  * All Rights Reserved
347c478bd9Sstevel@tonic-gate  *
357c478bd9Sstevel@tonic-gate  * University Acknowledgment- Portions of this document are derived from
367c478bd9Sstevel@tonic-gate  * software developed by the University of California, Berkeley, and its
377c478bd9Sstevel@tonic-gate  * contributors.
387c478bd9Sstevel@tonic-gate  */
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate #ifndef _UCB_SYS_SIGNAL_H
417c478bd9Sstevel@tonic-gate #define	_UCB_SYS_SIGNAL_H
427c478bd9Sstevel@tonic-gate 
437c478bd9Sstevel@tonic-gate /*
447c478bd9Sstevel@tonic-gate  * 4.3BSD signal compatibility header
457c478bd9Sstevel@tonic-gate  *
467c478bd9Sstevel@tonic-gate  * this file includes all standard SVR4 header info, plus the 4.3BSD
477c478bd9Sstevel@tonic-gate  * structures  - 4.3BSD signal codes are translated to SVR4 generic
487c478bd9Sstevel@tonic-gate  * signal codes where applicable
497c478bd9Sstevel@tonic-gate  */
507c478bd9Sstevel@tonic-gate 
517c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
527c478bd9Sstevel@tonic-gate extern "C" {
537c478bd9Sstevel@tonic-gate #endif
547c478bd9Sstevel@tonic-gate 
557c478bd9Sstevel@tonic-gate /*
567c478bd9Sstevel@tonic-gate  * SysV <signal.h>
577c478bd9Sstevel@tonic-gate  */
587c478bd9Sstevel@tonic-gate 
597c478bd9Sstevel@tonic-gate /* ---- <signal.h> ---- */
607c478bd9Sstevel@tonic-gate 
617c478bd9Sstevel@tonic-gate /*	Copyright (c) 1988 AT&T	*/
627c478bd9Sstevel@tonic-gate /*	  All Rights Reserved  	*/
637c478bd9Sstevel@tonic-gate 
647c478bd9Sstevel@tonic-gate 
657c478bd9Sstevel@tonic-gate #ifndef _SIGNAL_H
667c478bd9Sstevel@tonic-gate #define	_SIGNAL_H
677c478bd9Sstevel@tonic-gate 
687c478bd9Sstevel@tonic-gate /* ---- <sys/signal.h> ---- */
697c478bd9Sstevel@tonic-gate 
707c478bd9Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
717c478bd9Sstevel@tonic-gate /*	  All Rights Reserved  	*/
727c478bd9Sstevel@tonic-gate 
737c478bd9Sstevel@tonic-gate 
747c478bd9Sstevel@tonic-gate #ifndef _SYS_SIGNAL_H
757c478bd9Sstevel@tonic-gate #define	_SYS_SIGNAL_H
767c478bd9Sstevel@tonic-gate 
777c478bd9Sstevel@tonic-gate #define	SIGHUP	1	/* hangup */
787c478bd9Sstevel@tonic-gate #define	SIGINT	2	/* interrupt (rubout) */
797c478bd9Sstevel@tonic-gate #define	SIGQUIT	3	/* quit (ASCII FS) */
807c478bd9Sstevel@tonic-gate #define	SIGILL	4	/* illegal instruction (not reset when caught) */
817c478bd9Sstevel@tonic-gate #define	SIGTRAP	5	/* trace trap (not reset when caught) */
827c478bd9Sstevel@tonic-gate #define	SIGIOT	6	/* IOT instruction */
837c478bd9Sstevel@tonic-gate #define	SIGABRT 6	/* used by abort, replace SIGIOT in the future */
847c478bd9Sstevel@tonic-gate #define	SIGEMT	7	/* EMT instruction */
857c478bd9Sstevel@tonic-gate #define	SIGFPE	8	/* floating point exception */
867c478bd9Sstevel@tonic-gate #define	SIGKILL	9	/* kill (cannot be caught or ignored) */
877c478bd9Sstevel@tonic-gate #define	SIGBUS	10	/* bus error */
887c478bd9Sstevel@tonic-gate #define	SIGSEGV	11	/* segmentation violation */
897c478bd9Sstevel@tonic-gate #define	SIGSYS	12	/* bad argument to system call */
907c478bd9Sstevel@tonic-gate #define	SIGPIPE	13	/* write on a pipe with no one to read it */
917c478bd9Sstevel@tonic-gate #define	SIGALRM	14	/* alarm clock */
927c478bd9Sstevel@tonic-gate #define	SIGTERM	15	/* software termination signal from kill */
937c478bd9Sstevel@tonic-gate #define	SIGUSR1	16	/* user defined signal 1 */
947c478bd9Sstevel@tonic-gate #define	SIGUSR2	17	/* user defined signal 2 */
957c478bd9Sstevel@tonic-gate #define	SIGCLD	18	/* child status change */
967c478bd9Sstevel@tonic-gate #define	SIGCHLD	18	/* child status change alias (POSIX) */
977c478bd9Sstevel@tonic-gate #define	SIGPWR	19	/* power-fail restart */
987c478bd9Sstevel@tonic-gate #define	SIGWINCH 20	/* window size change */
997c478bd9Sstevel@tonic-gate #define	SIGURG	21	/* urgent socket condition */
1007c478bd9Sstevel@tonic-gate #define	SIGPOLL 22	/* pollable event occured */
1017c478bd9Sstevel@tonic-gate #define	SIGIO	SIGPOLL	/* socket I/O possible (SIGPOLL alias) */
1027c478bd9Sstevel@tonic-gate #define	SIGSTOP 23	/* stop (cannot be caught or ignored) */
1037c478bd9Sstevel@tonic-gate #define	SIGTSTP 24	/* user stop requested from tty */
1047c478bd9Sstevel@tonic-gate #define	SIGCONT 25	/* stopped process has been continued */
1057c478bd9Sstevel@tonic-gate #define	SIGTTIN 26	/* background tty read attempted */
1067c478bd9Sstevel@tonic-gate #define	SIGTTOU 27	/* background tty write attempted */
1077c478bd9Sstevel@tonic-gate #define	SIGVTALRM 28	/* virtual timer expired */
1087c478bd9Sstevel@tonic-gate #define	SIGPROF 29	/* profiling timer expired */
1097c478bd9Sstevel@tonic-gate #define	SIGXCPU 30	/* exceeded cpu limit */
1107c478bd9Sstevel@tonic-gate #define	SIGXFSZ 31	/* exceeded file size limit */
1117c478bd9Sstevel@tonic-gate #define	SIGWAITING 32	/* process's lwps are blocked */
1127c478bd9Sstevel@tonic-gate #define	SIGLWP	33	/* special signal used by thread library */
1137c478bd9Sstevel@tonic-gate 
1147c478bd9Sstevel@tonic-gate #if	defined(__cplusplus)
1157c478bd9Sstevel@tonic-gate 
1167c478bd9Sstevel@tonic-gate typedef	void SIG_FUNC_TYP(int);
1177c478bd9Sstevel@tonic-gate typedef	SIG_FUNC_TYP *SIG_TYP;
1187c478bd9Sstevel@tonic-gate #define	SIG_PF SIG_TYP
1197c478bd9Sstevel@tonic-gate 
1207c478bd9Sstevel@tonic-gate #define	SIG_DFL	(SIG_PF)0
1217c478bd9Sstevel@tonic-gate #define	SIG_ERR (SIG_PF)-1
1227c478bd9Sstevel@tonic-gate #define	SIG_IGN	(SIG_PF)1
1237c478bd9Sstevel@tonic-gate #define	SIG_HOLD (SIG_PF)2
1247c478bd9Sstevel@tonic-gate 
1257c478bd9Sstevel@tonic-gate #elif	defined(lint)
1267c478bd9Sstevel@tonic-gate 
1277c478bd9Sstevel@tonic-gate #define	SIG_DFL	(void(*)(int))0
1287c478bd9Sstevel@tonic-gate #define	SIG_ERR (void(*)(int))0
1297c478bd9Sstevel@tonic-gate #define	SIG_IGN	(void (*)(int))0
1307c478bd9Sstevel@tonic-gate #define	SIG_HOLD (void(*)(int))0
1317c478bd9Sstevel@tonic-gate 
1327c478bd9Sstevel@tonic-gate #else
1337c478bd9Sstevel@tonic-gate 
1347c478bd9Sstevel@tonic-gate #define	SIG_DFL	(void(*)())0
1357c478bd9Sstevel@tonic-gate #define	SIG_ERR	(void(*)())-1
1367c478bd9Sstevel@tonic-gate #define	SIG_IGN	(void (*)())1
1377c478bd9Sstevel@tonic-gate #define	SIG_HOLD (void(*)())2
1387c478bd9Sstevel@tonic-gate 
1397c478bd9Sstevel@tonic-gate #endif
1407c478bd9Sstevel@tonic-gate 
1417c478bd9Sstevel@tonic-gate #define	SIG_BLOCK	1
1427c478bd9Sstevel@tonic-gate #define	SIG_UNBLOCK	2
1437c478bd9Sstevel@tonic-gate #define	SIG_SETMASK	3
1447c478bd9Sstevel@tonic-gate 
1457c478bd9Sstevel@tonic-gate #define	SIGNO_MASK	0xFF
1467c478bd9Sstevel@tonic-gate #define	SIGDEFER	0x100
1477c478bd9Sstevel@tonic-gate #define	SIGHOLD		0x200
1487c478bd9Sstevel@tonic-gate #define	SIGRELSE	0x400
1497c478bd9Sstevel@tonic-gate #define	SIGIGNORE	0x800
1507c478bd9Sstevel@tonic-gate #define	SIGPAUSE	0x1000
1517c478bd9Sstevel@tonic-gate 
1527c478bd9Sstevel@tonic-gate #if !defined(_STRICT_STDC) || defined(_POSIX_SOURCE)
1537c478bd9Sstevel@tonic-gate 
1547c478bd9Sstevel@tonic-gate #ifndef	_SIGSET_T
1557c478bd9Sstevel@tonic-gate #define	_SIGSET_T
1567c478bd9Sstevel@tonic-gate typedef struct {		/* signal set type */
1577c478bd9Sstevel@tonic-gate 	unsigned int	__sigbits[4];
1587c478bd9Sstevel@tonic-gate } sigset_t;
1597c478bd9Sstevel@tonic-gate #endif	/* _SIGSET_T */
1607c478bd9Sstevel@tonic-gate 
1617c478bd9Sstevel@tonic-gate struct sigaction {
1627c478bd9Sstevel@tonic-gate 	int sa_flags;
1637c478bd9Sstevel@tonic-gate #if defined(__cplusplus)
1647c478bd9Sstevel@tonic-gate 	void (*sa_handler)(int);
1657c478bd9Sstevel@tonic-gate #else
1667c478bd9Sstevel@tonic-gate 	void (*sa_handler)();
1677c478bd9Sstevel@tonic-gate #endif
1687c478bd9Sstevel@tonic-gate 	sigset_t sa_mask;
1697c478bd9Sstevel@tonic-gate 	int sa_resv[2];
1707c478bd9Sstevel@tonic-gate };
1717c478bd9Sstevel@tonic-gate 
1727c478bd9Sstevel@tonic-gate /* this is only valid for SIGCLD */
1737c478bd9Sstevel@tonic-gate #define	SA_NOCLDSTOP	0x00020000	/* don't send job control SIGCLD's */
1747c478bd9Sstevel@tonic-gate #endif
1757c478bd9Sstevel@tonic-gate 
1767c478bd9Sstevel@tonic-gate #if !defined(_STRICT_STDC) && !defined(_POSIX_SOURCE)
1777c478bd9Sstevel@tonic-gate 			/* non-comformant ANSI compilation	*/
1787c478bd9Sstevel@tonic-gate 
1797c478bd9Sstevel@tonic-gate /* definitions for the sa_flags field */
1807c478bd9Sstevel@tonic-gate #define	SA_ONSTACK	0x00000001
1817c478bd9Sstevel@tonic-gate #define	SA_RESETHAND	0x00000002
1827c478bd9Sstevel@tonic-gate #define	SA_RESTART	0x00000004
1837c478bd9Sstevel@tonic-gate #define	SA_SIGINFO	0x00000008
1847c478bd9Sstevel@tonic-gate #define	SA_NODEFER	0x00000010
1857c478bd9Sstevel@tonic-gate 
1867c478bd9Sstevel@tonic-gate /* this is only valid for SIGCLD */
1877c478bd9Sstevel@tonic-gate #define	SA_NOCLDWAIT	0x00010000	/* don't save zombie children	 */
1887c478bd9Sstevel@tonic-gate 
1897c478bd9Sstevel@tonic-gate #define	NSIG	34	/* valid signals range from 1 to NSIG-1 */
1907c478bd9Sstevel@tonic-gate #define	MAXSIG	33	/* size of u_signal[], NSIG-1 <= MAXSIG */
1917c478bd9Sstevel@tonic-gate 
1927c478bd9Sstevel@tonic-gate #define	MINSIGSTKSZ	2048
1937c478bd9Sstevel@tonic-gate #define	SIGSTKSZ	8192
1947c478bd9Sstevel@tonic-gate 
1957c478bd9Sstevel@tonic-gate #define	SS_ONSTACK	0x00000001
1967c478bd9Sstevel@tonic-gate #define	SS_DISABLE	0x00000002
1977c478bd9Sstevel@tonic-gate 
1987c478bd9Sstevel@tonic-gate struct sigaltstack {
1997c478bd9Sstevel@tonic-gate 	char	*ss_sp;
2007c478bd9Sstevel@tonic-gate 	int	ss_size;
2017c478bd9Sstevel@tonic-gate 	int	ss_flags;
2027c478bd9Sstevel@tonic-gate };
2037c478bd9Sstevel@tonic-gate 
2047c478bd9Sstevel@tonic-gate typedef struct sigaltstack stack_t;
2057c478bd9Sstevel@tonic-gate 
2067c478bd9Sstevel@tonic-gate #endif /* __STDC__ && !POSIX */
2077c478bd9Sstevel@tonic-gate 
2087c478bd9Sstevel@tonic-gate 
2097c478bd9Sstevel@tonic-gate #endif /* _SYS_SIGNAL_H */
2107c478bd9Sstevel@tonic-gate 
2117c478bd9Sstevel@tonic-gate /* ---- end of SysV <sys/signal.h> ---- */
2127c478bd9Sstevel@tonic-gate 
2137c478bd9Sstevel@tonic-gate typedef int	sig_atomic_t;
2147c478bd9Sstevel@tonic-gate 
2157c478bd9Sstevel@tonic-gate #if defined(__STDC__)
2167c478bd9Sstevel@tonic-gate 
2177c478bd9Sstevel@tonic-gate extern const char *_sys_siglist[];
2187c478bd9Sstevel@tonic-gate extern const int _sys_nsig;
2197c478bd9Sstevel@tonic-gate 
2207c478bd9Sstevel@tonic-gate #ifdef __cplusplus
2217c478bd9Sstevel@tonic-gate extern "C" SIG_PF signal(int, SIG_PF);
2227c478bd9Sstevel@tonic-gate #else
2237c478bd9Sstevel@tonic-gate extern void (*signal(int, void (*)(int)))(int);
2247c478bd9Sstevel@tonic-gate #endif
2257c478bd9Sstevel@tonic-gate extern int raise(int);
2267c478bd9Sstevel@tonic-gate 
2277c478bd9Sstevel@tonic-gate #if !defined(_STRICT_STDC) || defined(_POSIX_SOURCE) || \
2287c478bd9Sstevel@tonic-gate 	defined(_XOPEN_SOURCE)
2297c478bd9Sstevel@tonic-gate extern int kill(pid_t, int);
2307c478bd9Sstevel@tonic-gate extern int sigaction(int, const struct sigaction *, struct sigaction *);
2317c478bd9Sstevel@tonic-gate extern int sigaddset(sigset_t *, int);
2327c478bd9Sstevel@tonic-gate extern int sigdelset(sigset_t *, int);
2337c478bd9Sstevel@tonic-gate extern int sigemptyset(sigset_t *);
2347c478bd9Sstevel@tonic-gate extern int sigfillset(sigset_t *);
2357c478bd9Sstevel@tonic-gate extern int sigismember(const sigset_t *, int);
2367c478bd9Sstevel@tonic-gate extern int sigpending(sigset_t *);
2377c478bd9Sstevel@tonic-gate extern int sigprocmask(int, const sigset_t *, sigset_t *);
2387c478bd9Sstevel@tonic-gate extern int sigsuspend(const sigset_t *);
2397c478bd9Sstevel@tonic-gate #endif
2407c478bd9Sstevel@tonic-gate 
2417c478bd9Sstevel@tonic-gate #if !defined(_STRICT_STDC) && !defined(_POSIX_SOURCE)
2427c478bd9Sstevel@tonic-gate extern int gsignal(int);
2437c478bd9Sstevel@tonic-gate extern void (*sigset(int, void (*)(int)))(int);
2447c478bd9Sstevel@tonic-gate extern int sighold(int);
2457c478bd9Sstevel@tonic-gate extern int sigrelse(int);
2467c478bd9Sstevel@tonic-gate extern int sigignore(int);
2477c478bd9Sstevel@tonic-gate extern int sigpause(int);
2487c478bd9Sstevel@tonic-gate extern int (*ssignal(int, int (*)(int)))(int);
2497c478bd9Sstevel@tonic-gate extern int sigaltstack(const stack_t *, stack_t *);
2507c478bd9Sstevel@tonic-gate /* extern int sigsend(idtype_t, id_t, int); */
2517c478bd9Sstevel@tonic-gate /* extern int sigsendset(const procset_t *, int); */
2527c478bd9Sstevel@tonic-gate #endif
2537c478bd9Sstevel@tonic-gate 
2547c478bd9Sstevel@tonic-gate #else
2557c478bd9Sstevel@tonic-gate 
2567c478bd9Sstevel@tonic-gate extern char *_sys_siglist[];
2577c478bd9Sstevel@tonic-gate extern int _sys_nsig;
2587c478bd9Sstevel@tonic-gate 
2597c478bd9Sstevel@tonic-gate extern	void(*signal())();
2607c478bd9Sstevel@tonic-gate extern  void(*sigset())();
2617c478bd9Sstevel@tonic-gate 
2627c478bd9Sstevel@tonic-gate #endif	/* __STDC__ */
2637c478bd9Sstevel@tonic-gate 
2647c478bd9Sstevel@tonic-gate #endif	/* _SIGNAL_H */
2657c478bd9Sstevel@tonic-gate /* ---- end of SysV <signal.h> ---- */
2667c478bd9Sstevel@tonic-gate 
2677c478bd9Sstevel@tonic-gate #define	sigmask(m)	(m > 32 ? 0 : (1 << ((m)-1)))
2687c478bd9Sstevel@tonic-gate 
2697c478bd9Sstevel@tonic-gate /*
2707c478bd9Sstevel@tonic-gate  * 4.3BSD structure used in sigstack call.
2717c478bd9Sstevel@tonic-gate  */
2727c478bd9Sstevel@tonic-gate 
2737c478bd9Sstevel@tonic-gate struct  sigstack {
2747c478bd9Sstevel@tonic-gate 	char	*ss_sp;			/* signal stack pointer */
2757c478bd9Sstevel@tonic-gate 	int	ss_onstack;		/* current status */
2767c478bd9Sstevel@tonic-gate };
2777c478bd9Sstevel@tonic-gate 
2787c478bd9Sstevel@tonic-gate #define	SV_ONSTACK	0x0001  /* take signal on signal stack */
2797c478bd9Sstevel@tonic-gate #define	SV_INTERRUPT    0x0002  /* do not restart system on signal return */
2807c478bd9Sstevel@tonic-gate #define	SV_RESETHAND    0x0004  /* reset handler to SIG_DFL when signal taken */
2817c478bd9Sstevel@tonic-gate 
2827c478bd9Sstevel@tonic-gate #define	sv_onstack sv_flags
2837c478bd9Sstevel@tonic-gate 
2847c478bd9Sstevel@tonic-gate struct  sigcontext {
2857c478bd9Sstevel@tonic-gate 	int	sc_onstack;		/* sigstack state to restore */
2867c478bd9Sstevel@tonic-gate 	int	sc_mask;		/* signal mask to restore */
2877c478bd9Sstevel@tonic-gate #ifdef u3b2
2887c478bd9Sstevel@tonic-gate 	int	sc_sp;			/* sp to restore */
2897c478bd9Sstevel@tonic-gate 	int	sc_fp;			/* fp to restore */
2907c478bd9Sstevel@tonic-gate 	int	sc_ap;			/* ap to restore */
2917c478bd9Sstevel@tonic-gate 	int	sc_pc;			/* pc to restore */
2927c478bd9Sstevel@tonic-gate 	int	sc_ps;			/* psw to restore */
2937c478bd9Sstevel@tonic-gate #endif
2947c478bd9Sstevel@tonic-gate #ifdef vax
2957c478bd9Sstevel@tonic-gate 	int	sc_sp;			/* sp to restore */
2967c478bd9Sstevel@tonic-gate 	int	sc_fp;			/* fp to restore */
2977c478bd9Sstevel@tonic-gate 	int	sc_ap;			/* ap to restore */
2987c478bd9Sstevel@tonic-gate 	int	sc_pc;			/* pc to restore */
2997c478bd9Sstevel@tonic-gate 	int	sc_ps;			/* psl to restore */
3007c478bd9Sstevel@tonic-gate #endif /* vax */
3017c478bd9Sstevel@tonic-gate #ifdef mc68000
3027c478bd9Sstevel@tonic-gate 	int	sc_sp;			/* sp to restore */
3037c478bd9Sstevel@tonic-gate 	int	sc_pc;			/* pc to retore */
3047c478bd9Sstevel@tonic-gate 	int	sc_ps;			/* psl to restore */
3057c478bd9Sstevel@tonic-gate #endif /* mc68000 */
3067c478bd9Sstevel@tonic-gate #ifdef __sparc
3077c478bd9Sstevel@tonic-gate #define	MAXWINDOW	31		/* max usable windows in sparc */
3087c478bd9Sstevel@tonic-gate 	long	sc_sp;			/* sp to restore */
3097c478bd9Sstevel@tonic-gate 	long	sc_pc;			/* pc to retore */
3107c478bd9Sstevel@tonic-gate 	long	sc_npc;			/* next pc to restore */
3117c478bd9Sstevel@tonic-gate 	long	sc_psr;			/* psr to restore */
3127c478bd9Sstevel@tonic-gate 					/* aliased to REG_CCR for sparcv9 */
3137c478bd9Sstevel@tonic-gate 	long	sc_g1;			/* register that must be restored */
3147c478bd9Sstevel@tonic-gate 	long	sc_o0;
3157c478bd9Sstevel@tonic-gate 	int	sc_wbcnt;		/* number of outstanding windows */
3167c478bd9Sstevel@tonic-gate 	char	*sc_spbuf[MAXWINDOW];	/* sp's for each wbuf */
3177c478bd9Sstevel@tonic-gate 	long	sc_wbuf[MAXWINDOW][16];	/* outstanding window save buffer */
3187c478bd9Sstevel@tonic-gate #endif /* __sparc */
3197c478bd9Sstevel@tonic-gate #if defined(__amd64)
3207c478bd9Sstevel@tonic-gate 	long	sc_sp;			/* sp to restore */
3217c478bd9Sstevel@tonic-gate 	long	sc_pc;			/* pc to retore */
3227c478bd9Sstevel@tonic-gate 	long	sc_ps;			/* psl to restore */
3237c478bd9Sstevel@tonic-gate 	long	sc_rax;			/* rax to restore */
3247c478bd9Sstevel@tonic-gate 	long	sc_rdx;			/* rdx to restore */
3257c478bd9Sstevel@tonic-gate #define	sc_r0	sc_rax
3267c478bd9Sstevel@tonic-gate #define	sc_r1	sc_rdx
3277c478bd9Sstevel@tonic-gate #elif defined(__i386)
3287c478bd9Sstevel@tonic-gate 	int	sc_sp;			/* sp to restore */
3297c478bd9Sstevel@tonic-gate 	int	sc_pc;			/* pc to retore */
3307c478bd9Sstevel@tonic-gate 	int	sc_ps;			/* psl to restore */
3317c478bd9Sstevel@tonic-gate 	int	sc_eax;			/* eax to restore */
3327c478bd9Sstevel@tonic-gate 	int	sc_edx;			/* edx to restore */
3337c478bd9Sstevel@tonic-gate #define	sc_r0	sc_eax
3347c478bd9Sstevel@tonic-gate #define	sc_r1	sc_edx
3357c478bd9Sstevel@tonic-gate #endif
3367c478bd9Sstevel@tonic-gate };
3377c478bd9Sstevel@tonic-gate 
3387c478bd9Sstevel@tonic-gate /*
3397c478bd9Sstevel@tonic-gate  * 4.3BSD signal vector structure used in sigvec call.
3407c478bd9Sstevel@tonic-gate  */
3417c478bd9Sstevel@tonic-gate struct  sigvec {
3427c478bd9Sstevel@tonic-gate #if defined(__cplusplus)
3437c478bd9Sstevel@tonic-gate 	void	(*sv_handler)(int, int, struct sigcontext *, char *);
3447c478bd9Sstevel@tonic-gate #else
3457c478bd9Sstevel@tonic-gate 	void	(*sv_handler)();	/* signal handler */
3467c478bd9Sstevel@tonic-gate #endif
3477c478bd9Sstevel@tonic-gate 	int	sv_mask;		/* signal mask to apply */
3487c478bd9Sstevel@tonic-gate 	int	sv_flags;		/* see signal options below */
3497c478bd9Sstevel@tonic-gate };
3507c478bd9Sstevel@tonic-gate 
3517c478bd9Sstevel@tonic-gate #if defined(__STDC__)
3527c478bd9Sstevel@tonic-gate extern int sigvec(int, struct sigvec *, struct sigvec *);
3537c478bd9Sstevel@tonic-gate extern int sigblock(int);
3547c478bd9Sstevel@tonic-gate extern int sigsetmask(int);
3557c478bd9Sstevel@tonic-gate #endif
3567c478bd9Sstevel@tonic-gate 
3577c478bd9Sstevel@tonic-gate /*
3587c478bd9Sstevel@tonic-gate  * Signal codes taken verbatim from SunOS4.1
3597c478bd9Sstevel@tonic-gate  */
3607c478bd9Sstevel@tonic-gate #ifdef	vax
3617c478bd9Sstevel@tonic-gate #define	    ILL_RESAD_FAULT	0x0	/* reserved addressing fault */
3627c478bd9Sstevel@tonic-gate #define	    ILL_PRIVIN_FAULT	0x1	/* privileged instruction fault */
3637c478bd9Sstevel@tonic-gate #define	    ILL_RESOP_FAULT	0x2	/* reserved operand fault */
3647c478bd9Sstevel@tonic-gate #endif	/* vax */
3657c478bd9Sstevel@tonic-gate #ifdef	mc68000
3667c478bd9Sstevel@tonic-gate #define	    ILL_ILLINSTR_FAULT	0x10	/* illegal instruction fault */
3677c478bd9Sstevel@tonic-gate #define	    ILL_PRIVVIO_FAULT	0x20	/* privilege violation fault */
3687c478bd9Sstevel@tonic-gate #define	    ILL_COPROCERR_FAULT	0x34	/* [coprocessor protocol error fault] */
3697c478bd9Sstevel@tonic-gate #define	    ILL_TRAP1_FAULT	0x84	/* trap #1 fault */
3707c478bd9Sstevel@tonic-gate #define	    ILL_TRAP2_FAULT	0x88	/* trap #2 fault */
3717c478bd9Sstevel@tonic-gate #define	    ILL_TRAP3_FAULT	0x8c	/* trap #3 fault */
3727c478bd9Sstevel@tonic-gate #define	    ILL_TRAP4_FAULT	0x90	/* trap #4 fault */
3737c478bd9Sstevel@tonic-gate #define	    ILL_TRAP5_FAULT	0x94	/* trap #5 fault */
3747c478bd9Sstevel@tonic-gate #define	    ILL_TRAP6_FAULT	0x98	/* trap #6 fault */
3757c478bd9Sstevel@tonic-gate #define	    ILL_TRAP7_FAULT	0x9c	/* trap #7 fault */
3767c478bd9Sstevel@tonic-gate #define	    ILL_TRAP8_FAULT	0xa0	/* trap #8 fault */
3777c478bd9Sstevel@tonic-gate #define	    ILL_TRAP9_FAULT	0xa4	/* trap #9 fault */
3787c478bd9Sstevel@tonic-gate #define	    ILL_TRAP10_FAULT	0xa8	/* trap #10 fault */
3797c478bd9Sstevel@tonic-gate #define	    ILL_TRAP11_FAULT	0xac	/* trap #11 fault */
3807c478bd9Sstevel@tonic-gate #define	    ILL_TRAP12_FAULT	0xb0	/* trap #12 fault */
3817c478bd9Sstevel@tonic-gate #define	    ILL_TRAP13_FAULT	0xb4	/* trap #13 fault */
3827c478bd9Sstevel@tonic-gate #define	    ILL_TRAP14_FAULT	0xb8	/* trap #14 fault */
3837c478bd9Sstevel@tonic-gate #endif	/* mc68000 */
3847c478bd9Sstevel@tonic-gate #ifdef	sparc
3857c478bd9Sstevel@tonic-gate #define	    ILL_STACK		0x00	/* bad stack */
3867c478bd9Sstevel@tonic-gate #define	    ILL_ILLINSTR_FAULT	0x02	/* illegal instruction fault */
3877c478bd9Sstevel@tonic-gate #define	    ILL_PRIVINSTR_FAULT	0x03	/* privileged instruction fault */
3887c478bd9Sstevel@tonic-gate /* codes from 0x80 to 0xff are software traps */
3897c478bd9Sstevel@tonic-gate #define	    ILL_TRAP_FAULT(n)	((n)+0x80) /* trap n fault */
3907c478bd9Sstevel@tonic-gate #endif	/* sparc */
3917c478bd9Sstevel@tonic-gate #if defined(__i386) || defined(__amd64)
3927c478bd9Sstevel@tonic-gate #define	    ILL_ILLINSTR_FAULT	0x02	/* illegal instruction fault */
3937c478bd9Sstevel@tonic-gate #endif
3947c478bd9Sstevel@tonic-gate 
3957c478bd9Sstevel@tonic-gate #ifdef	mc68000
3967c478bd9Sstevel@tonic-gate #define	    EMT_EMU1010		0x28	/* line 1010 emulator trap */
3977c478bd9Sstevel@tonic-gate #define	    EMT_EMU1111		0x2c	/* line 1111 emulator trap */
3987c478bd9Sstevel@tonic-gate #endif	/* mc68000 */
3997c478bd9Sstevel@tonic-gate #ifdef	sparc
4007c478bd9Sstevel@tonic-gate #define	    EMT_TAG		0x0a	/* tag overflow */
4017c478bd9Sstevel@tonic-gate #endif	/* sparc */
4027c478bd9Sstevel@tonic-gate 
4037c478bd9Sstevel@tonic-gate #ifdef	vax
4047c478bd9Sstevel@tonic-gate #define	    FPE_INTOVF_TRAP	0x1	/* integer overflow */
4057c478bd9Sstevel@tonic-gate #define	    FPE_INTDIV_TRAP	0x2	/* integer divide by zero */
4067c478bd9Sstevel@tonic-gate #define	    FPE_FLTOVF_TRAP	0x3	/* floating overflow */
4077c478bd9Sstevel@tonic-gate #define	    FPE_FLTDIV_TRAP	0x4	/* floating/decimal divide by zero */
4087c478bd9Sstevel@tonic-gate #define	    FPE_FLTUND_TRAP	0x5	/* floating underflow */
4097c478bd9Sstevel@tonic-gate #define	    FPE_DECOVF_TRAP	0x6	/* decimal overflow */
4107c478bd9Sstevel@tonic-gate #define	    FPE_SUBRNG_TRAP	0x7	/* subscript out of range */
4117c478bd9Sstevel@tonic-gate #define	    FPE_FLTOVF_FAULT	0x8	/* floating overflow fault */
4127c478bd9Sstevel@tonic-gate #define	    FPE_FLTDIV_FAULT	0x9	/* divide by zero floating fault */
4137c478bd9Sstevel@tonic-gate #define	    FPE_FLTUND_FAULT	0xa	/* floating underflow fault */
4147c478bd9Sstevel@tonic-gate #endif	/* vax */
4157c478bd9Sstevel@tonic-gate #ifdef	mc68000
4167c478bd9Sstevel@tonic-gate #define	    FPE_INTDIV_TRAP	0x14	/* integer divide by zero */
4177c478bd9Sstevel@tonic-gate #define	    FPE_CHKINST_TRAP	0x18	/* CHK [CHK2] instruction */
4187c478bd9Sstevel@tonic-gate #define	    FPE_TRAPV_TRAP	0x1c	/* TRAPV [cpTRAPcc TRAPcc] instr */
4197c478bd9Sstevel@tonic-gate #define	    FPE_FLTBSUN_TRAP	0xc0	/* [branch or set on unordered cond] */
4207c478bd9Sstevel@tonic-gate #define	    FPE_FLTINEX_TRAP	0xc4	/* [floating inexact result] */
4217c478bd9Sstevel@tonic-gate #define	    FPE_FLTDIV_TRAP	0xc8	/* [floating divide by zero] */
4227c478bd9Sstevel@tonic-gate #define	    FPE_FLTUND_TRAP	0xcc	/* [floating underflow] */
4237c478bd9Sstevel@tonic-gate #define	    FPE_FLTOPERR_TRAP	0xd0	/* [floating operand error] */
4247c478bd9Sstevel@tonic-gate #define	    FPE_FLTOVF_TRAP	0xd4	/* [floating overflow] */
4257c478bd9Sstevel@tonic-gate #define	    FPE_FLTNAN_TRAP	0xd8	/* [floating Not-A-Number] */
4267c478bd9Sstevel@tonic-gate #ifdef	sun
4277c478bd9Sstevel@tonic-gate #define	    FPE_FPA_ENABLE	0x400	/* [FPA not enabled] */
4287c478bd9Sstevel@tonic-gate #define	    FPE_FPA_ERROR	0x404	/* [FPA arithmetic exception] */
4297c478bd9Sstevel@tonic-gate #endif	/* sun */
4307c478bd9Sstevel@tonic-gate #endif	/* mc68000 */
4317c478bd9Sstevel@tonic-gate #ifdef	sparc
4327c478bd9Sstevel@tonic-gate #define	    FPE_INTOVF_TRAP	0x1	/* integer overflow */
4337c478bd9Sstevel@tonic-gate #define	    FPE_STARTSIG_TRAP	0x2	/* process using fp */
4347c478bd9Sstevel@tonic-gate #define	    FPE_INTDIV_TRAP	0x14	/* integer divide by zero */
4357c478bd9Sstevel@tonic-gate #define	    FPE_FLTINEX_TRAP	0xc4	/* [floating inexact result] */
4367c478bd9Sstevel@tonic-gate #define	    FPE_FLTDIV_TRAP	0xc8	/* [floating divide by zero] */
4377c478bd9Sstevel@tonic-gate #define	    FPE_FLTUND_TRAP	0xcc	/* [floating underflow] */
4387c478bd9Sstevel@tonic-gate #define	    FPE_FLTOPERR_TRAP	0xd0	/* [floating operand error] */
4397c478bd9Sstevel@tonic-gate #define	    FPE_FLTOVF_TRAP	0xd4	/* [floating overflow] */
4407c478bd9Sstevel@tonic-gate #endif	/* sparc */
4417c478bd9Sstevel@tonic-gate 
4427c478bd9Sstevel@tonic-gate /*
4437c478bd9Sstevel@tonic-gate  * The codes for SIGBUS and SIGSEGV are described in <vm/faultcode.h>
4447c478bd9Sstevel@tonic-gate  * These are the same between SunOS4.1 and SunOS5.0
4457c478bd9Sstevel@tonic-gate  */
4467c478bd9Sstevel@tonic-gate 
4477c478bd9Sstevel@tonic-gate #include <vm/faultcode.h>
4487c478bd9Sstevel@tonic-gate 
4497c478bd9Sstevel@tonic-gate #define	    BUS_HWERR	FC_HWERR	/* misc hardware error (e.g. timeout) */
4507c478bd9Sstevel@tonic-gate #define	    BUS_ALIGN	FC_ALIGN	/* hardware alignment error */
4517c478bd9Sstevel@tonic-gate #ifdef	BUS_OBJERR	/* namespace conflict with SysV */
4527c478bd9Sstevel@tonic-gate #undef	BUS_OBJERR
4537c478bd9Sstevel@tonic-gate #endif
4547c478bd9Sstevel@tonic-gate #define	    BUS_OBJERR	FC_OBJERR	/* object returned errno value */
4557c478bd9Sstevel@tonic-gate /*
4567c478bd9Sstevel@tonic-gate  * The BUS_CODE(code) will be one of the above.  In the BUS_OBJERR case,
4577c478bd9Sstevel@tonic-gate  * doing a BUS_ERRNO(code) gives an errno value reported by the underlying
4587c478bd9Sstevel@tonic-gate  * file object mapped at the fault address.  Note that this appears to be
4597c478bd9Sstevel@tonic-gate  * duplicated with the segmentation fault case below -- unfortunate, since
4607c478bd9Sstevel@tonic-gate  * the specification has always claimed that such errors produce SIGBUS.
4617c478bd9Sstevel@tonic-gate  * The segmentation cases are left defined as a transition aid.
4627c478bd9Sstevel@tonic-gate  */
4637c478bd9Sstevel@tonic-gate #define	    BUS_CODE(C)		FC_CODE(C)
4647c478bd9Sstevel@tonic-gate #define	    BUS_ERRNO(C)	FC_ERRNO(C)
4657c478bd9Sstevel@tonic-gate 
4667c478bd9Sstevel@tonic-gate #define	    SEGV_NOMAP	FC_NOMAP	/* no mapping at the fault address */
4677c478bd9Sstevel@tonic-gate #define	    SEGV_PROT	FC_PROT		/* access exceeded protections */
4687c478bd9Sstevel@tonic-gate #define	    SEGV_OBJERR	FC_OBJERR	/* object returned errno value */
4697c478bd9Sstevel@tonic-gate /*
4707c478bd9Sstevel@tonic-gate  * The SEGV_CODE(code) will be SEGV_NOMAP, SEGV_PROT, or SEGV_OBJERR.
4717c478bd9Sstevel@tonic-gate  * In the SEGV_OBJERR case, doing a SEGV_ERRNO(code) gives an errno value
4727c478bd9Sstevel@tonic-gate  * reported by the underlying file object mapped at the fault address.
4737c478bd9Sstevel@tonic-gate  */
4747c478bd9Sstevel@tonic-gate #define	    SEGV_CODE(C)	FC_CODE(C)
4757c478bd9Sstevel@tonic-gate #define	    SEGV_ERRNO(C)	FC_ERRNO(C)
4767c478bd9Sstevel@tonic-gate #define	    SEGV_MAKE_ERR(e)	FC_MAKE_ERR(e)
4777c478bd9Sstevel@tonic-gate 
4787c478bd9Sstevel@tonic-gate #define	SIG_NOADDR	((char *)~0)
4797c478bd9Sstevel@tonic-gate 
4807c478bd9Sstevel@tonic-gate #if defined(lint)
4817c478bd9Sstevel@tonic-gate #define	BADSIG (void(*)())0
4827c478bd9Sstevel@tonic-gate #else
4837c478bd9Sstevel@tonic-gate #define	BADSIG (void(*)())-1
4847c478bd9Sstevel@tonic-gate #endif
4857c478bd9Sstevel@tonic-gate 
4867c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
4877c478bd9Sstevel@tonic-gate }
4887c478bd9Sstevel@tonic-gate #endif
4897c478bd9Sstevel@tonic-gate 
4907c478bd9Sstevel@tonic-gate #endif /* _UCB_SYS_SIGNAL_H */
491