1570af302Sopenharmony_ci#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
2570af302Sopenharmony_ci || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
3570af302Sopenharmony_ci
4570af302Sopenharmony_ci#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
5570af302Sopenharmony_ci#define MINSIGSTKSZ 2048
6570af302Sopenharmony_ci#define SIGSTKSZ 8192
7570af302Sopenharmony_ci#endif
8570af302Sopenharmony_ci
9570af302Sopenharmony_ci#ifdef _GNU_SOURCE
10570af302Sopenharmony_cienum { R_D0 = 0 };
11570af302Sopenharmony_ci#define R_D0 R_D0
12570af302Sopenharmony_cienum { R_D1 = 1 };
13570af302Sopenharmony_ci#define R_D1 R_D1
14570af302Sopenharmony_cienum { R_D2 = 2 };
15570af302Sopenharmony_ci#define R_D2 R_D2
16570af302Sopenharmony_cienum { R_D3 = 3 };
17570af302Sopenharmony_ci#define R_D3 R_D3
18570af302Sopenharmony_cienum { R_D4 = 4 };
19570af302Sopenharmony_ci#define R_D4 R_D4
20570af302Sopenharmony_cienum { R_D5 = 5 };
21570af302Sopenharmony_ci#define R_D5 R_D5
22570af302Sopenharmony_cienum { R_D6 = 6 };
23570af302Sopenharmony_ci#define R_D6 R_D6
24570af302Sopenharmony_cienum { R_D7 = 7 };
25570af302Sopenharmony_ci#define R_D7 R_D7
26570af302Sopenharmony_cienum { R_A0 = 8 };
27570af302Sopenharmony_ci#define R_A0 R_A0
28570af302Sopenharmony_cienum { R_A1 = 9 };
29570af302Sopenharmony_ci#define R_A1 R_A1
30570af302Sopenharmony_cienum { R_A2 = 10 };
31570af302Sopenharmony_ci#define R_A2 R_A2
32570af302Sopenharmony_cienum { R_A3 = 11 };
33570af302Sopenharmony_ci#define R_A3 R_A3
34570af302Sopenharmony_cienum { R_A4 = 12 };
35570af302Sopenharmony_ci#define R_A4 R_A4
36570af302Sopenharmony_cienum { R_A5 = 13 };
37570af302Sopenharmony_ci#define R_A5 R_A5
38570af302Sopenharmony_cienum { R_A6 = 14 };
39570af302Sopenharmony_ci#define R_A6 R_A6
40570af302Sopenharmony_cienum { R_A7 = 15 };
41570af302Sopenharmony_ci#define R_A7 R_A7
42570af302Sopenharmony_cienum { R_SP = 15 };
43570af302Sopenharmony_ci#define R_SP R_SP
44570af302Sopenharmony_cienum { R_PC = 16 };
45570af302Sopenharmony_ci#define R_PC R_PC
46570af302Sopenharmony_cienum { R_PS = 17 };
47570af302Sopenharmony_ci#define R_PS R_PS
48570af302Sopenharmony_ci#endif
49570af302Sopenharmony_ci
50570af302Sopenharmony_ci#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
51570af302Sopenharmony_ci
52570af302Sopenharmony_cistruct sigcontext {
53570af302Sopenharmony_ci	unsigned long sc_mask, sc_usp, sc_d0, sc_d1, sc_a0, sc_a1;
54570af302Sopenharmony_ci	unsigned short sc_sr;
55570af302Sopenharmony_ci	unsigned long sc_pc;
56570af302Sopenharmony_ci	unsigned short sc_formatvec;
57570af302Sopenharmony_ci	unsigned long sc_fpregs[6], sc_fpcntl[3];
58570af302Sopenharmony_ci	unsigned char sc_fpstate[216];
59570af302Sopenharmony_ci};
60570af302Sopenharmony_ci
61570af302Sopenharmony_citypedef int greg_t, gregset_t[18];
62570af302Sopenharmony_citypedef struct {
63570af302Sopenharmony_ci	int f_pcr, f_psr, f_fpiaddr, f_fpregs[8][3];
64570af302Sopenharmony_ci} fpregset_t;
65570af302Sopenharmony_ci
66570af302Sopenharmony_citypedef struct {
67570af302Sopenharmony_ci	int version;
68570af302Sopenharmony_ci	gregset_t gregs;
69570af302Sopenharmony_ci	fpregset_t fpregs;
70570af302Sopenharmony_ci} mcontext_t;
71570af302Sopenharmony_ci#else
72570af302Sopenharmony_citypedef struct {
73570af302Sopenharmony_ci	int __version;
74570af302Sopenharmony_ci	int __gregs[18];
75570af302Sopenharmony_ci	int __fpregs[27];
76570af302Sopenharmony_ci} mcontext_t;
77570af302Sopenharmony_ci#endif
78570af302Sopenharmony_ci
79570af302Sopenharmony_cistruct sigaltstack {
80570af302Sopenharmony_ci	void *ss_sp;
81570af302Sopenharmony_ci	int ss_flags;
82570af302Sopenharmony_ci	size_t ss_size;
83570af302Sopenharmony_ci};
84570af302Sopenharmony_ci
85570af302Sopenharmony_citypedef struct __ucontext {
86570af302Sopenharmony_ci	unsigned long uc_flags;
87570af302Sopenharmony_ci	struct __ucontext *uc_link;
88570af302Sopenharmony_ci	stack_t uc_stack;
89570af302Sopenharmony_ci	mcontext_t uc_mcontext;
90570af302Sopenharmony_ci	long __reserved[80];
91570af302Sopenharmony_ci	sigset_t uc_sigmask;
92570af302Sopenharmony_ci} ucontext_t;
93570af302Sopenharmony_ci
94570af302Sopenharmony_ci#define SA_NOCLDSTOP  1
95570af302Sopenharmony_ci#define SA_NOCLDWAIT  2
96570af302Sopenharmony_ci#define SA_SIGINFO    4
97570af302Sopenharmony_ci#define SA_ONSTACK    0x08000000
98570af302Sopenharmony_ci#define SA_RESTART    0x10000000
99570af302Sopenharmony_ci#define SA_NODEFER    0x40000000
100570af302Sopenharmony_ci#define SA_RESETHAND  0x80000000
101570af302Sopenharmony_ci#define SA_RESTORER   0x04000000
102570af302Sopenharmony_ci
103570af302Sopenharmony_ci#endif
104570af302Sopenharmony_ci
105570af302Sopenharmony_ci#define SIGHUP    1
106570af302Sopenharmony_ci#define SIGINT    2
107570af302Sopenharmony_ci#define SIGQUIT   3
108570af302Sopenharmony_ci#define SIGILL    4
109570af302Sopenharmony_ci#define SIGTRAP   5
110570af302Sopenharmony_ci#define SIGABRT   6
111570af302Sopenharmony_ci#define SIGIOT    SIGABRT
112570af302Sopenharmony_ci#define SIGBUS    7
113570af302Sopenharmony_ci#define SIGFPE    8
114570af302Sopenharmony_ci#define SIGKILL   9
115570af302Sopenharmony_ci#define SIGUSR1   10
116570af302Sopenharmony_ci#define SIGSEGV   11
117570af302Sopenharmony_ci#define SIGUSR2   12
118570af302Sopenharmony_ci#define SIGPIPE   13
119570af302Sopenharmony_ci#define SIGALRM   14
120570af302Sopenharmony_ci#define SIGTERM   15
121570af302Sopenharmony_ci#define SIGSTKFLT 16
122570af302Sopenharmony_ci#define SIGCHLD   17
123570af302Sopenharmony_ci#define SIGCONT   18
124570af302Sopenharmony_ci#define SIGSTOP   19
125570af302Sopenharmony_ci#define SIGTSTP   20
126570af302Sopenharmony_ci#define SIGTTIN   21
127570af302Sopenharmony_ci#define SIGTTOU   22
128570af302Sopenharmony_ci#define SIGURG    23
129570af302Sopenharmony_ci#define SIGXCPU   24
130570af302Sopenharmony_ci#define SIGXFSZ   25
131570af302Sopenharmony_ci#define SIGVTALRM 26
132570af302Sopenharmony_ci#define SIGPROF   27
133570af302Sopenharmony_ci#define SIGWINCH  28
134570af302Sopenharmony_ci#define SIGIO     29
135570af302Sopenharmony_ci#define SIGPOLL   29
136570af302Sopenharmony_ci#define SIGPWR    30
137570af302Sopenharmony_ci#define SIGSYS    31
138570af302Sopenharmony_ci#define SIGUNUSED SIGSYS
139570af302Sopenharmony_ci
140570af302Sopenharmony_ci#define _NSIG 65
141