support the ugly and deprecated ucontext and sigcontext header stuff...
[musl] / arch / i386 / bits / signal.h
1 #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
2  || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)
3
4 struct __fpstate {
5         unsigned long __x[7];
6         unsigned char __y[80];
7         unsigned long __z;
8 };
9
10 typedef struct {
11         unsigned long __gregs[19];
12         void *__fpregs;
13         unsigned long __oldmask, __cr2;
14 } mcontext_t;
15
16 typedef struct __ucontext {
17         unsigned long uc_flags;
18         struct __ucontext *uc_link;
19         stack_t uc_stack;
20         mcontext_t uc_mcontext;
21         sigset_t uc_sigmask;
22         struct __fpstate __fpregs_mem;
23 } ucontext_t;
24
25 #ifdef _GNU_SOURCE
26 struct sigcontext {
27         unsigned short gs, __gsh, fs, __fsh, es, __esh, ds, __dsh;
28         unsigned long edi, esi, ebp, esp, ebx, edx, ecx, eax;
29         unsigned long trapno, err, eip;
30         unsigned short cs, __csh;
31         unsigned long eflags, esp_at_signal;
32         unsigned short ss, __ssh;
33         struct __fpstate *fpstate;
34         unsigned long oldmask, cr2;
35 };
36 #endif
37
38 struct __siginfo
39 {
40         int si_signo;
41         int si_errno;
42         int si_code;
43         union
44         {
45                 char __pad[128 - 3*sizeof(int)];
46                 struct {
47                         pid_t si_pid;
48                         uid_t si_uid;
49                         union sigval si_sigval;
50                 } __rt;
51                 struct {
52                         unsigned int si_timer1;
53                         unsigned int si_timer2;
54                 } __timer;
55                 struct {
56                         pid_t si_pid;
57                         uid_t si_uid;
58                         int si_status;
59                         clock_t si_utime;
60                         clock_t si_stime;
61                 } __sigchld;
62                 struct {
63                         void *si_addr;
64                 } __sigfault;
65                 struct {
66                         long int si_band;
67                         int si_fd;
68                 } __sigpoll;
69         } __si_fields;
70 };
71
72 #define si_pid     __si_fields.__sigchld.si_pid
73 #define si_uid     __si_fields.__sigchld.si_uid
74 #define si_status  __si_fields.__sigchld.si_status
75 #define si_utime   __si_fields.__sigchld.si_utime
76 #define si_stime   __si_fields.__sigchld.si_stime
77 #define si_value   __si_fields.__rt.si_sigval
78 #define si_addr    __si_fields.__sigfault.si_addr
79 #define si_band    __si_fields.__sigpoll.si_band
80
81 #define SA_NOCLDSTOP  1
82 #define SA_NOCLDWAIT  2
83 #define SA_SIGINFO    4
84 #define SA_ONSTACK    0x08000000
85 #define SA_RESTART    0x10000000
86 #define SA_NODEFER    0x40000000
87 #define SA_RESETHAND  0x80000000
88 #define SA_RESTORER   0x04000000
89
90 #define SS_ONSTACK    1
91 #define SS_DISABLE    2
92
93 #define SIG_BLOCK     0
94 #define SIG_UNBLOCK   1
95 #define SIG_SETMASK   2
96
97 #define SIG_HOLD ((void (*)(int)) 2)
98
99 #endif
100
101 #ifdef _GNU_SOURCE
102 #define NSIG      64
103 #endif
104
105 #define SIG_ERR  ((void (*)(int))-1)
106 #define SIG_DFL  ((void (*)(int)) 0)
107 #define SIG_IGN  ((void (*)(int)) 1)
108
109 #define SIGHUP    1
110 #define SIGINT    2
111 #define SIGQUIT   3
112 #define SIGILL    4
113 #define SIGTRAP   5
114 #define SIGABRT   6
115 #define SIGBUS    7
116 #define SIGFPE    8
117 #define SIGKILL   9
118 #define SIGUSR1   10
119 #define SIGSEGV   11
120 #define SIGUSR2   12
121 #define SIGPIPE   13
122 #define SIGALRM   14
123 #define SIGTERM   15
124 #define SIGSTKFLT 16
125 #define SIGCHLD   17
126 #define SIGCONT   18
127 #define SIGSTOP   19
128 #define SIGTSTP   20
129 #define SIGTTIN   21
130 #define SIGTTOU   22
131 #define SIGURG    23
132 #define SIGXCPU   24
133 #define SIGXFSZ   25
134 #define SIGVTALRM 26
135 #define SIGPROF   27
136 #define SIGWINCH  28
137 #define SIGIO     29
138 #define SIGPOLL   29
139 #define SIGPWR    30
140 #define SIGSYS    31
141 #define SIGUNUSED SIGSYS