svr4_signal.h revision 51793
143412Snewton/*
243412Snewton * Copyright (c) 1998 Mark Newton
343412Snewton * Copyright (c) 1994 Christos Zoulas
443412Snewton * All rights reserved.
543412Snewton *
643412Snewton * Redistribution and use in source and binary forms, with or without
743412Snewton * modification, are permitted provided that the following conditions
843412Snewton * are met:
943412Snewton * 1. Redistributions of source code must retain the above copyright
1043412Snewton *    notice, this list of conditions and the following disclaimer.
1143412Snewton * 2. Redistributions in binary form must reproduce the above copyright
1243412Snewton *    notice, this list of conditions and the following disclaimer in the
1343412Snewton *    documentation and/or other materials provided with the distribution.
1443412Snewton * 3. The name of the author may not be used to endorse or promote products
1543412Snewton *    derived from this software without specific prior written permission
1643412Snewton *
1743412Snewton * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1843412Snewton * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1943412Snewton * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
2043412Snewton * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
2143412Snewton * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2243412Snewton * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2343412Snewton * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2443412Snewton * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2543412Snewton * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2643412Snewton * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2749267Snewton *
2850477Speter * $FreeBSD: head/sys/compat/svr4/svr4_signal.h 51793 1999-09-29 15:12:18Z marcel $
2943412Snewton */
3043412Snewton
3143412Snewton#ifndef	_SVR4_SIGNAL_H_
3243412Snewton#define	_SVR4_SIGNAL_H_
3343412Snewton
3443412Snewton#include <i386/svr4/svr4_machdep.h>
3543412Snewton#include <svr4/svr4_siginfo.h>
3643412Snewton
3743412Snewton#define	SVR4_SIGHUP	 1
3843412Snewton#define	SVR4_SIGINT	 2
3943412Snewton#define	SVR4_SIGQUIT	 3
4043412Snewton#define	SVR4_SIGILL	 4
4143412Snewton#define	SVR4_SIGTRAP	 5
4243412Snewton#define	SVR4_SIGIOT	 6
4343412Snewton#define	SVR4_SIGABRT	 6
4443412Snewton#define	SVR4_SIGEMT	 7
4543412Snewton#define	SVR4_SIGFPE	 8
4643412Snewton#define	SVR4_SIGKILL	 9
4743412Snewton#define	SVR4_SIGBUS	10
4843412Snewton#define	SVR4_SIGSEGV	11
4943412Snewton#define	SVR4_SIGSYS	12
5043412Snewton#define	SVR4_SIGPIPE	13
5143412Snewton#define	SVR4_SIGALRM	14
5243412Snewton#define	SVR4_SIGTERM	15
5343412Snewton#define	SVR4_SIGUSR1	16
5443412Snewton#define	SVR4_SIGUSR2	17
5543412Snewton#define	SVR4_SIGCLD	18
5643412Snewton#define	SVR4_SIGCHLD	18
5743412Snewton#define	SVR4_SIGPWR	19
5843412Snewton#define	SVR4_SIGWINCH	20
5943412Snewton#define	SVR4_SIGURG	21
6043412Snewton#define	SVR4_SIGPOLL	22
6143412Snewton#define	SVR4_SIGIO	22
6243412Snewton#define	SVR4_SIGSTOP	23
6343412Snewton#define	SVR4_SIGTSTP	24
6443412Snewton#define	SVR4_SIGCONT	25
6543412Snewton#define	SVR4_SIGTTIN	26
6643412Snewton#define	SVR4_SIGTTOU	27
6743412Snewton#define	SVR4_SIGVTALRM	28
6843412Snewton#define	SVR4_SIGPROF	29
6943412Snewton#define	SVR4_SIGXCPU	30
7043412Snewton#define	SVR4_SIGXFSZ	31
7151793Smarcel#define SVR4_NSIG	128
7251793Smarcel#define SVR4_SIGTBLSZ	31
7343412Snewton
7443412Snewton#define	SVR4_SIGNO_MASK		0x00FF
7543412Snewton#define	SVR4_SIGNAL_MASK	0x0000
7643412Snewton#define	SVR4_SIGDEFER_MASK	0x0100
7743412Snewton#define	SVR4_SIGHOLD_MASK	0x0200
7843412Snewton#define	SVR4_SIGRELSE_MASK	0x0400
7943412Snewton#define	SVR4_SIGIGNORE_MASK	0x0800
8043412Snewton#define	SVR4_SIGPAUSE_MASK	0x1000
8143412Snewton
8243412Snewtontypedef void (*svr4_sig_t) __P((int, svr4_siginfo_t *, void *));
8343412Snewton#define	SVR4_SIG_DFL	(svr4_sig_t)	 0
8443412Snewton#define	SVR4_SIG_ERR	(svr4_sig_t)	-1
8543412Snewton#define	SVR4_SIG_IGN	(svr4_sig_t)	 1
8643412Snewton#define	SVR4_SIG_HOLD	(svr4_sig_t)	 2
8743412Snewton
8843412Snewton#define SVR4_SIGNO(a)	((a) & SVR4_SIGNO_MASK)
8943412Snewton#define SVR4_SIGCALL(a) ((a) & ~SVR4_SIGNO_MASK)
9043412Snewton
9143412Snewton#define SVR4_SIG_BLOCK		1
9243412Snewton#define SVR4_SIG_UNBLOCK	2
9343412Snewton#define SVR4_SIG_SETMASK	3
9443412Snewton
9551793Smarcelextern int bsd_to_svr4_sig[];
9651793Smarcelextern int svr4_to_bsd_sig[];
9751793Smarcel
9851793Smarcel#define SVR4_BSD2SVR4_SIG(sig)	\
9951793Smarcel	(((sig) <= SVR4_SIGTBLSZ) ? bsd_to_svr4_sig[_SIG_IDX(sig)] : sig)
10051793Smarcel#define SVR4_SVR42BSD_SIG(sig)	\
10151793Smarcel	(((sig) <= SVR4_SIGTBLSZ) ? svr4_to_bsd_sig[_SIG_IDX(sig)] : sig)
10251793Smarcel
10343412Snewtontypedef struct {
10443412Snewton        u_long bits[4];
10543412Snewton} svr4_sigset_t;
10643412Snewton
10743412Snewtonstruct svr4_sigaction {
10848620Scracauer	int		ssa_flags;
10948620Scracauer	svr4_sig_t	ssa_handler;
11048620Scracauer	svr4_sigset_t	ssa_mask;
11148620Scracauer	int 		ssa_reserved[2];
11243412Snewton};
11343412Snewton
11443412Snewtonstruct svr4_sigaltstack {
11543412Snewton	char		*ss_sp;
11643412Snewton	int		ss_size;
11743412Snewton	int		ss_flags;
11843412Snewton};
11943412Snewton
12043412Snewton/* sa_flags */
12143412Snewton#define SVR4_SA_ONSTACK		0x00000001
12243412Snewton#define SVR4_SA_RESETHAND	0x00000002
12343412Snewton#define SVR4_SA_RESTART		0x00000004
12443412Snewton#define SVR4_SA_SIGINFO		0x00000008
12543412Snewton#define SVR4_SA_NODEFER		0x00000010
12643412Snewton#define SVR4_SA_NOCLDWAIT	0x00010000	/* No zombies 	*/
12743412Snewton#define SVR4_SA_NOCLDSTOP	0x00020000	/* No jcl	*/
12843412Snewton#define	SVR4_SA_ALLBITS		0x0003001f
12943412Snewton
13043412Snewton/* ss_flags */
13143412Snewton#define SVR4_SS_ONSTACK		0x00000001
13243412Snewton#define SVR4_SS_DISABLE		0x00000002
13343412Snewton#define	SVR4_SS_ALLBITS		0x00000003
13443412Snewton
13543412Snewtonvoid bsd_to_svr4_sigaltstack __P((const struct sigaltstack *, struct svr4_sigaltstack *));
13643412Snewtonvoid bsd_to_svr4_sigset __P((const sigset_t *, svr4_sigset_t *));
13743412Snewtonvoid svr4_to_bsd_sigaltstack __P((const struct svr4_sigaltstack *, struct sigaltstack *));
13843412Snewtonvoid svr4_to_bsd_sigset __P((const svr4_sigset_t *, sigset_t *));
13951793Smarcelvoid svr4_sendsig(sig_t, int, sigset_t  *, u_long);
14043412Snewton
14143412Snewton#endif /* !_SVR4_SIGNAL_H_ */
142