aboutsummaryrefslogtreecommitdiff
path: root/bsd-user/netbsd/target_os_siginfo.h
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2021-08-05 13:41:52 -0600
committerWarner Losh <imp@bsdimp.com>2021-09-10 14:13:06 -0600
commit790baacc63c1cb29bfc3bf0755f49ca73a348eae (patch)
tree18e7ea67e8081e13d23ff7e4cf0fca8347d5a26b /bsd-user/netbsd/target_os_siginfo.h
parent312a0b1cbf941c37d3d3aeb1ed651613e04262b5 (diff)
bsd-user: *BSD specific siginfo defintions
Add FreeBSD, NetBSD and OpenBSD values for the various signal info types and defines to decode different signals to discover more information about the specific signal types. Signed-off-by: Stacey Son <sson@FreeBSD.org> Signed-off-by: Warner Losh <imp@bsdimp.com> Acked-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Kyle Evans <kevans@FreeBSD.org>
Diffstat (limited to 'bsd-user/netbsd/target_os_siginfo.h')
-rw-r--r--bsd-user/netbsd/target_os_siginfo.h82
1 files changed, 82 insertions, 0 deletions
diff --git a/bsd-user/netbsd/target_os_siginfo.h b/bsd-user/netbsd/target_os_siginfo.h
new file mode 100644
index 0000000000..667c19cc7c
--- /dev/null
+++ b/bsd-user/netbsd/target_os_siginfo.h
@@ -0,0 +1,82 @@
+#ifndef _TARGET_OS_SIGINFO_H_
+#define _TARGET_OS_SIGINFO_H_
+
+#define TARGET_NSIG 32 /* counting 0; could be 33 (mask is 1-32) */
+#define TARGET_NSIG_BPW (sizeof(uint32_t) * 8)
+#define TARGET_NSIG_WORDS (TARGET_NSIG / TARGET_NSIG_BPW)
+
+/* this struct defines a stack used during syscall handling */
+typedef struct target_sigaltstack {
+ abi_long ss_sp;
+ abi_ulong ss_size;
+ abi_long ss_flags;
+} target_stack_t;
+
+typedef struct {
+ uint32_t __bits[TARGET_NSIG_WORDS];
+} target_sigset_t
+
+struct target_sigaction {
+ abi_ulong _sa_handler;
+ int32_t sa_flags;
+ target_sigset_t sa_mask;
+};
+
+/* Compare to sys/siginfo.h */
+typedef union target_sigval {
+ int sival_int;
+ abi_ulong sival_ptr;
+} target_sigval_t;
+
+struct target_ksiginfo {
+ int32_t _signo;
+ int32_t _code;
+ int32_t _errno;
+#if TARGET_ABI_BITS == 64
+ int32_t _pad;
+#endif
+ union {
+ struct {
+ int32_t _pid;
+ int32_t _uid;
+ target_sigval_t _value;
+ } _rt;
+
+ struct {
+ int32_t _pid;
+ int32_t _uid;
+ int32_t _struct;
+ /* clock_t _utime; */
+ /* clock_t _stime; */
+ } _child;
+
+ struct {
+ abi_ulong _addr;
+ int32_t _trap;
+ } _fault;
+
+ struct {
+ long _band;
+ int _fd;
+ } _poll;
+ } _reason;
+};
+
+typedef union target_siginfo {
+ int8_t si_pad[128];
+ struct target_ksiginfo _info;
+} target_siginfo_t;
+
+#define target_si_signo _info._signo
+#define target_si_code _info._code
+#define target_si_errno _info._errno
+#define target_si_addr _info._reason._fault._addr
+
+#define TARGET_SEGV_MAPERR 1
+#define TARGET_SEGV_ACCERR 2
+
+#define TARGET_TRAP_BRKPT 1
+#define TARGET_TRAP_TRACE 2
+
+
+#endif /* ! _TARGET_OS_SIGINFO_H_ */