xref: /netbsd/sys/compat/sys/siginfo.h (revision e5b617c5)
1 /*	$NetBSD: siginfo.h,v 1.9 2019/11/18 12:06:26 rin Exp $	 */
2 
3 /*-
4  * Copyright (c) 2002 The NetBSD Foundation, Inc.
5  * All rights reserved.
6  *
7  * This code is derived from software contributed to The NetBSD Foundation
8  * by Christos Zoulas.
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	_COMPAT_SYS_SIGINFO_H_
33 #define	_COMPAT_SYS_SIGINFO_H_
34 
35 #ifdef _KERNEL
36 
37 /* Avoids circular dependency with machine/netbsd32_machdep.h */
38 #if defined(__x86_64__) || (defined(__arm__) && defined(__ARM_EABI__))
39 #define NETBSD32_SIGINFO_UINT64_ALIGN __attribute__((__aligned__(4)))
40 #else
41 #define NETBSD32_SIGINFO_UINT64_ALIGN __attribute__((__aligned__(8)))
42 #endif
43 typedef uint64_t netbsd32_siginfo_uint64 NETBSD32_SIGINFO_UINT64_ALIGN;
44 #undef NETBSD32_SIGINFO_UINT64_ALIGN
45 
46 typedef union sigval32 {
47 	int sival_int;
48 	uint32_t sival_ptr;
49 } sigval32_t;
50 
51 struct __ksiginfo32 {
52 	int	_signo;
53 	int	_code;
54 	int	_errno;
55 
56 	union {
57 		struct {
58 			pid_t _pid;
59 			uid_t _uid;
60 			sigval32_t _value;
61 		} _rt;
62 
63 		struct {
64 			pid_t _pid;
65 			uid_t _uid;
66 			int _status;
67 			clock_t _utime;
68 			clock_t _stime;
69 		} _child;
70 
71 		struct {
72 			uint32_t _addr;
73 			int _trap;
74 		} _fault;
75 
76 		struct {
77 			int32_t _band;
78 			int _fd;
79 		} _poll;
80 
81 		struct {
82 			int	_sysnum;
83 			int	_retval[2];
84 			int	_error;
85 			netbsd32_siginfo_uint64 _args[8]; /* SYS_MAXSYSARGS */
86 		} _syscall;
87 
88 		struct {
89 			int	_pe_report_event;
90 			union {
91 				pid_t	_pe_other_pid;
92 				lwpid_t	_pe_lwp;
93 			} _option;
94 		} _ptrace_state;
95 	} _reason;
96 };
97 
98 typedef union siginfo32 {
99 	char	si_pad[128];
100 	struct __ksiginfo32 _info;
101 } siginfo32_t;
102 
103 #endif /* _KERNEL */
104 
105 #endif /* !_COMPAT_SYS_SIGINFO_H_ */
106