aboutsummaryrefslogtreecommitdiff
path: root/bsd-user/openbsd/target_os_siginfo.h
blob: 732009a8201aab66d9567d9aedc80f3f591a567e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
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 */