1139743Simp/*-
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$
2943412Snewton */
3043412Snewton
3143412Snewton#ifndef	_SVR4_SIGNAL_H_
3243412Snewton#define	_SVR4_SIGNAL_H_
3343412Snewton
3443412Snewton#include <i386/svr4/svr4_machdep.h>
3565302Sobrien#include <compat/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
7156046Snewton#define SVR4_NSIG	32
7243412Snewton
7343412Snewton#define	SVR4_SIGNO_MASK		0x00FF
7443412Snewton#define	SVR4_SIGNAL_MASK	0x0000
7543412Snewton#define	SVR4_SIGDEFER_MASK	0x0100
7643412Snewton#define	SVR4_SIGHOLD_MASK	0x0200
7743412Snewton#define	SVR4_SIGRELSE_MASK	0x0400
7843412Snewton#define	SVR4_SIGIGNORE_MASK	0x0800
7943412Snewton#define	SVR4_SIGPAUSE_MASK	0x1000
8043412Snewton
8192761Salfredtypedef void (*svr4_sig_t)(int, svr4_siginfo_t *, void *);
8243412Snewton#define	SVR4_SIG_DFL	(svr4_sig_t)	 0
8343412Snewton#define	SVR4_SIG_ERR	(svr4_sig_t)	-1
8443412Snewton#define	SVR4_SIG_IGN	(svr4_sig_t)	 1
8543412Snewton#define	SVR4_SIG_HOLD	(svr4_sig_t)	 2
8643412Snewton
8743412Snewton#define SVR4_SIGNO(a)	((a) & SVR4_SIGNO_MASK)
8843412Snewton#define SVR4_SIGCALL(a) ((a) & ~SVR4_SIGNO_MASK)
8943412Snewton
9043412Snewton#define SVR4_SIG_BLOCK		1
9143412Snewton#define SVR4_SIG_UNBLOCK	2
9243412Snewton#define SVR4_SIG_SETMASK	3
9343412Snewton
94142500Ssamextern int bsd_to_svr4_sig[SVR4_NSIG];
95142500Ssamextern int svr4_to_bsd_sig[SVR4_NSIG];
9651793Smarcel
9751793Smarcel#define SVR4_BSD2SVR4_SIG(sig)	\
98142500Ssam	(((sig) < SVR4_NSIG) ? bsd_to_svr4_sig[sig] : sig)
9951793Smarcel#define SVR4_SVR42BSD_SIG(sig)	\
100142500Ssam	(((sig) < SVR4_NSIG) ? svr4_to_bsd_sig[sig] : sig)
10151793Smarcel
10243412Snewtontypedef struct {
10343412Snewton        u_long bits[4];
10443412Snewton} svr4_sigset_t;
10543412Snewton
10643412Snewtonstruct svr4_sigaction {
10748620Scracauer	int		ssa_flags;
10848620Scracauer	svr4_sig_t	ssa_handler;
10948620Scracauer	svr4_sigset_t	ssa_mask;
11048620Scracauer	int 		ssa_reserved[2];
11143412Snewton};
11243412Snewton
11343412Snewtonstruct svr4_sigaltstack {
11443412Snewton	char		*ss_sp;
11543412Snewton	int		ss_size;
11643412Snewton	int		ss_flags;
11743412Snewton};
11843412Snewton
11943412Snewton/* sa_flags */
12043412Snewton#define SVR4_SA_ONSTACK		0x00000001
12143412Snewton#define SVR4_SA_RESETHAND	0x00000002
12243412Snewton#define SVR4_SA_RESTART		0x00000004
12343412Snewton#define SVR4_SA_SIGINFO		0x00000008
12443412Snewton#define SVR4_SA_NODEFER		0x00000010
12543412Snewton#define SVR4_SA_NOCLDWAIT	0x00010000	/* No zombies 	*/
12643412Snewton#define SVR4_SA_NOCLDSTOP	0x00020000	/* No jcl	*/
12743412Snewton#define	SVR4_SA_ALLBITS		0x0003001f
12843412Snewton
12943412Snewton/* ss_flags */
13043412Snewton#define SVR4_SS_ONSTACK		0x00000001
13143412Snewton#define SVR4_SS_DISABLE		0x00000002
13243412Snewton#define	SVR4_SS_ALLBITS		0x00000003
13343412Snewton
13468520Smarcel#define	SVR4_MINSIGSTKSZ	8192
13568520Smarcel
136151316Sdavidxustruct ksiginfo;
137151316Sdavidxu
13892761Salfredvoid bsd_to_svr4_sigaltstack(const struct sigaltstack *, struct svr4_sigaltstack *);
13992761Salfredvoid bsd_to_svr4_sigset(const sigset_t *, svr4_sigset_t *);
14092761Salfredvoid svr4_to_bsd_sigaltstack(const struct svr4_sigaltstack *, struct sigaltstack *);
14192761Salfredvoid svr4_to_bsd_sigset(const svr4_sigset_t *, sigset_t *);
142151316Sdavidxuvoid svr4_sendsig(sig_t, struct ksiginfo *, sigset_t  *);
14343412Snewton
14443412Snewton#endif /* !_SVR4_SIGNAL_H_ */
145