signal.h revision 1.24
11.24Schristos/*	$NetBSD: signal.h,v 1.24 2003/09/27 03:14:31 christos Exp $	*/
21.3Scgd
31.1Sbrezak/*
41.1Sbrezak * Copyright (c) 1982, 1986, 1989, 1991 Regents of the University of California.
51.1Sbrezak * All rights reserved.
61.1Sbrezak *
71.1Sbrezak * Redistribution and use in source and binary forms, with or without
81.1Sbrezak * modification, are permitted provided that the following conditions
91.1Sbrezak * are met:
101.1Sbrezak * 1. Redistributions of source code must retain the above copyright
111.1Sbrezak *    notice, this list of conditions and the following disclaimer.
121.1Sbrezak * 2. Redistributions in binary form must reproduce the above copyright
131.1Sbrezak *    notice, this list of conditions and the following disclaimer in the
141.1Sbrezak *    documentation and/or other materials provided with the distribution.
151.17Sagc * 3. Neither the name of the University nor the names of its contributors
161.1Sbrezak *    may be used to endorse or promote products derived from this software
171.1Sbrezak *    without specific prior written permission.
181.1Sbrezak *
191.1Sbrezak * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
201.1Sbrezak * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
211.1Sbrezak * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
221.1Sbrezak * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
231.1Sbrezak * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
241.1Sbrezak * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
251.1Sbrezak * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
261.1Sbrezak * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
271.1Sbrezak * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
281.1Sbrezak * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
291.1Sbrezak * SUCH DAMAGE.
301.1Sbrezak *
311.3Scgd *	@(#)signal.h	7.16 (Berkeley) 3/17/91
321.1Sbrezak */
331.1Sbrezak
341.2Smycroft#ifndef _I386_SIGNAL_H_
351.2Smycroft#define _I386_SIGNAL_H_
361.1Sbrezak
371.16Sbjh21#include <sys/featuretest.h>
381.16Sbjh21
391.1Sbrezaktypedef int sig_atomic_t;
401.18Schristos
411.18Schristos#define __HAVE_SIGINFO
421.24Schristos#ifdef COMPAT_16
431.24Schristos#define SIGTRAMP_VALID(vers)	((unsigned)(vers) <= 2)
441.24Schristos#else
451.24Schristos#define SIGTRAMP_VALID(vers)	((vers) == 2)
461.24Schristos#endif
471.1Sbrezak
481.16Sbjh21#if defined(_NETBSD_SOURCE)
491.1Sbrezak/*
501.1Sbrezak * Get the "code" values
511.1Sbrezak */
521.1Sbrezak#include <machine/trap.h>
531.1Sbrezak
541.1Sbrezak/*
551.1Sbrezak * Information pushed on stack when a signal is delivered.
561.1Sbrezak * This is used by the kernel to restore state following
571.1Sbrezak * execution of the signal handler.  It is also made available
581.1Sbrezak * to the handler to allow it to restore state properly if
591.1Sbrezak * a non-standard exit is performed.
601.1Sbrezak */
611.12Sthorpej#if defined(__LIBC12_SOURCE__) || defined(_KERNEL)
621.10Smycroftstruct sigcontext13 {
631.5Smycroft	int	sc_gs;
641.5Smycroft	int	sc_fs;
651.2Smycroft	int	sc_es;
661.2Smycroft	int	sc_ds;
671.2Smycroft	int	sc_edi;
681.2Smycroft	int	sc_esi;
691.2Smycroft	int	sc_ebp;
701.2Smycroft	int	sc_ebx;
711.2Smycroft	int	sc_edx;
721.2Smycroft	int	sc_ecx;
731.2Smycroft	int	sc_eax;
741.6Smycroft	/* XXX */
751.2Smycroft	int	sc_eip;
761.2Smycroft	int	sc_cs;
771.2Smycroft	int	sc_eflags;
781.2Smycroft	int	sc_esp;
791.2Smycroft	int	sc_ss;
801.5Smycroft
811.5Smycroft	int	sc_onstack;		/* sigstack state to restore */
821.13Sthorpej	int	sc_mask;		/* signal mask to restore (old style) */
831.6Smycroft
841.6Smycroft	int	sc_trapno;		/* XXX should be above */
851.6Smycroft	int	sc_err;
861.10Smycroft};
871.10Smycroft#endif
881.9Smycroft
891.19Schristos/*
901.21Schristos * We expose this to userland for legacy interfaces, but only use
911.21Schristos * it in the kernel for compat code.
921.19Schristos */
931.10Smycroftstruct sigcontext {
941.10Smycroft	int	sc_gs;
951.10Smycroft	int	sc_fs;
961.10Smycroft	int	sc_es;
971.10Smycroft	int	sc_ds;
981.10Smycroft	int	sc_edi;
991.10Smycroft	int	sc_esi;
1001.10Smycroft	int	sc_ebp;
1011.10Smycroft	int	sc_ebx;
1021.10Smycroft	int	sc_edx;
1031.10Smycroft	int	sc_ecx;
1041.10Smycroft	int	sc_eax;
1051.10Smycroft	/* XXX */
1061.10Smycroft	int	sc_eip;
1071.10Smycroft	int	sc_cs;
1081.10Smycroft	int	sc_eflags;
1091.10Smycroft	int	sc_esp;
1101.10Smycroft	int	sc_ss;
1111.10Smycroft
1121.10Smycroft	int	sc_onstack;		/* sigstack state to restore */
1131.14Sthorpej	int	__sc_mask13;		/* signal mask to restore (old style) */
1141.10Smycroft
1151.10Smycroft	int	sc_trapno;		/* XXX should be above */
1161.10Smycroft	int	sc_err;
1171.10Smycroft
1181.10Smycroft	sigset_t sc_mask;		/* signal mask to restore (new style) */
1191.1Sbrezak};
1201.1Sbrezak
1211.1Sbrezak#define sc_sp sc_esp
1221.1Sbrezak#define sc_fp sc_ebp
1231.1Sbrezak#define sc_pc sc_eip
1241.2Smycroft#define sc_ps sc_eflags
1251.1Sbrezak
1261.16Sbjh21#endif	/* _NETBSD_SOURCE */
1271.4Sjtc#endif	/* !_I386_SIGNAL_H_ */
128