1 #ifndef _TARGET_OS_SIGINFO_H_
2 #define _TARGET_OS_SIGINFO_H_
3 
4 #define TARGET_NSIG     32   /* counting 0; could be 33 (mask is 1-32) */
5 #define TARGET_NSIG_BPW     (sizeof(uint32_t) * 8)
6 #define TARGET_NSIG_WORDS   (TARGET_NSIG / TARGET_NSIG_BPW)
7 
8 /* this struct defines a stack used during syscall handling */
9 typedef struct target_sigaltstack {
10     abi_long    ss_sp;
11     abi_ulong   ss_size;
12     abi_long    ss_flags;
13 } target_stack_t;
14 
15 typedef struct {
16     uint32_t __bits[TARGET_NSIG_WORDS];
17 } target_sigset_t
18 
19 struct target_sigaction {
20     abi_ulong   _sa_handler;
21     int32_t     sa_flags;
22     target_sigset_t sa_mask;
23 };
24 
25 /* Compare to sys/siginfo.h */
26 typedef union target_sigval {
27     int         sival_int;
28     abi_ulong   sival_ptr;
29 } target_sigval_t;
30 
31 struct target_ksiginfo {
32     int32_t     _signo;
33     int32_t     _code;
34     int32_t     _errno;
35 #if TARGET_ABI_BITS == 64
36     int32_t     _pad;
37 #endif
38     union {
39         struct {
40             int32_t             _pid;
41             int32_t             _uid;
42             target_sigval_t    _value;
43         } _rt;
44 
45         struct {
46             int32_t             _pid;
47             int32_t             _uid;
48             int32_t             _struct;
49             /* clock_t          _utime; */
50             /* clock_t          _stime; */
51         } _child;
52 
53         struct {
54             abi_ulong           _addr;
55             int32_t             _trap;
56         } _fault;
57 
58         struct {
59             long                _band;
60             int                 _fd;
61         } _poll;
62     } _reason;
63 };
64 
65 typedef union target_siginfo {
66     int8_t     si_pad[128];
67     struct     target_ksiginfo  _info;
68 } target_siginfo_t;
69 
70 #define target_si_signo     _info._signo
71 #define target_si_code      _info._code
72 #define target_si_errno     _info._errno
73 #define target_si_addr      _info._reason._fault._addr
74 
75 #define TARGET_SEGV_MAPERR  1
76 #define TARGET_SEGV_ACCERR  2
77 
78 #define TARGET_TRAP_BRKPT   1
79 #define TARGET_TRAP_TRACE   2
80 
81 
82 #endif /* ! _TARGET_OS_SIGINFO_H_ */
83