1/* 	$NetBSD: linux_siginfo.h,v 1.14 2008/11/23 23:48:48 njoly Exp $	*/
2
3/*-
4 * Copyright (c) 1998 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Eric Haszlakiewicz.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 *    notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 *    notice, this list of conditions and the following disclaimer in the
17 *    documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifndef _LINUX32_SIGINFO_H
33#define _LINUX32_SIGINFO_H
34
35#if defined(__amd64__)
36#include <compat/linux32/arch/amd64/linux32_siginfo.h>
37#endif
38
39/* si_code values for non signal */
40#define	LINUX32_SI_USER		0
41#define	LINUX32_SI_KERNEL		0x80
42#define	LINUX32_SI_QUEUE		-1
43#ifndef LINUX32_SI_TIMER /* all except mips */
44#define	LINUX32_SI_TIMER		-2
45#define	LINUX32_SI_MESGQ		-3
46#define	LINUX32_SI_ASYNCIO	-4
47#endif /* LINUX32_SI_TIMER */
48#define	LINUX32_SI_SIGIO		-5
49#define	LINUX32_SI_TKILL		-6
50#define	LINUX32_SI_DETHREAD	-7
51
52/* si_code values for SIGILL */
53#define	LINUX32_ILL_ILLOPC	1
54#define	LINUX32_ILL_ILLOPN	2
55#define	LINUX32_ILL_ILLADR	3
56#define	LINUX32_ILL_ILLTRP	4
57#define	LINUX32_ILL_PRVOPC	5
58#define	LINUX32_ILL_PRVREG	6
59#define	LINUX32_ILL_COPROC	7
60#define	LINUX32_ILL_BADSTK	8
61
62/* si_code values for SIGFPE */
63#define	LINUX32_FPE_INTDIV	1
64#define	LINUX32_FPE_INTOVF	2
65#define	LINUX32_FPE_FLTDIV	3
66#define	LINUX32_FPE_FLTOVF	4
67#define	LINUX32_FPE_FLTUND	5
68#define	LINUX32_FPE_FLTRES	6
69#define	LINUX32_FPE_FLTINV	7
70#define	LINUX32_FPE_FLTSUB	8
71
72/* si_code values for SIGSEGV */
73#define	LINUX32_SEGV_MAPERR	1
74#define	LINUX32_SEGV_ACCERR	2
75
76/* si_code values for SIGBUS */
77#define	LINUX32_BUS_ADRALN	1
78#define	LINUX32_BUS_ADRERR	2
79#define	LINUX32_BUS_OBJERR	3
80
81/* si_code values for SIGTRAP */
82#define	LINUX32_TRAP_BRKPT	1
83#define	LINUX32_TRAP_TRACE	2
84
85/* si_code values for SIGCHLD */
86#define	LINUX32_CLD_EXITED	1
87#define	LINUX32_CLD_KILLED	2
88#define	LINUX32_CLD_DUMPED	3
89#define	LINUX32_CLD_TRAPPED	4
90#define	LINUX32_CLD_STOPPED	5
91#define	LINUX32_CLD_CONTINUED	6
92
93/* si_code values for SIGPOLL */
94#define	LINUX32_POLL_IN		1
95#define	LINUX32_POLL_OUT		2
96#define	LINUX32_POLL_MSG		3
97#define	LINUX32_POLL_ERR		4
98#define	LINUX32_POLL_PRI		5
99#define	LINUX32_POLL_HUP		6
100
101#define	LINUX32_SI_FROMUSER(sp)	((sp)->si_code <= 0)
102#define	LINUX32_SI_FROMKERNEL(sp)	((sp)->si_code > 0)
103
104#define lsi_pid		_sidata._kill._pid
105#define lsi_uid		_sidata._kill._uid
106#define lsi_status      _sidata._sigchld._status
107#define lsi_utime       _sidata._sigchld._utime
108#define lsi_stime       _sidata._sigchld._stime
109#define lsi_value       _sidata._rt._sigval
110#define lsi_sival_int   _sidata._rt._sigval.sival_int
111#define lsi_sival_ptr   _sidata._rt._sigval.sival_ptr
112#define lsi_addr        _sidata._sigfault._addr
113#define lsi_band        _sidata._sigpoll._band
114#define lsi_fd          _sidata._sigpoll._fd
115
116void native_to_linux32_siginfo(linux32_siginfo_t *, const struct _ksiginfo *);
117
118#endif /* !_LINUX32_SIGINFO_H */
119