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#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
10570af302Sopenharmony_citypedef unsigned long long greg_t, gregset_t[32];
11570af302Sopenharmony_citypedef struct {
12570af302Sopenharmony_ci	union {
13570af302Sopenharmony_ci		double fp_dregs[32];
14570af302Sopenharmony_ci		struct {
15570af302Sopenharmony_ci			float _fp_fregs;
16570af302Sopenharmony_ci			unsigned _fp_pad;
17570af302Sopenharmony_ci		} fp_fregs[32];
18570af302Sopenharmony_ci	} fp_r;
19570af302Sopenharmony_ci} fpregset_t;
20570af302Sopenharmony_cistruct sigcontext {
21570af302Sopenharmony_ci	unsigned sc_regmask, sc_status;
22570af302Sopenharmony_ci	unsigned long long sc_pc;
23570af302Sopenharmony_ci	gregset_t sc_regs;
24570af302Sopenharmony_ci	fpregset_t sc_fpregs;
25570af302Sopenharmony_ci	unsigned sc_ownedfp, sc_fpc_csr, sc_fpc_eir, sc_used_math, sc_dsp;
26570af302Sopenharmony_ci	unsigned long long sc_mdhi, sc_mdlo;
27570af302Sopenharmony_ci	unsigned long sc_hi1, sc_lo1, sc_hi2, sc_lo2, sc_hi3, sc_lo3;
28570af302Sopenharmony_ci};
29570af302Sopenharmony_citypedef struct {
30570af302Sopenharmony_ci	unsigned regmask, status;
31570af302Sopenharmony_ci	unsigned long long pc;
32570af302Sopenharmony_ci	gregset_t gregs;
33570af302Sopenharmony_ci	fpregset_t fpregs;
34570af302Sopenharmony_ci	unsigned ownedfp, fpc_csr, fpc_eir, used_math, dsp;
35570af302Sopenharmony_ci	unsigned long long mdhi, mdlo;
36570af302Sopenharmony_ci	unsigned long hi1, lo1, hi2, lo2, hi3, lo3;
37570af302Sopenharmony_ci} mcontext_t;
38570af302Sopenharmony_ci#else
39570af302Sopenharmony_citypedef struct {
40570af302Sopenharmony_ci	unsigned __mc1[2];
41570af302Sopenharmony_ci	unsigned long long __mc2[65];
42570af302Sopenharmony_ci	unsigned __mc3[5];
43570af302Sopenharmony_ci	unsigned long long __mc4[2];
44570af302Sopenharmony_ci	unsigned __mc5[6];
45570af302Sopenharmony_ci} mcontext_t;
46570af302Sopenharmony_ci#endif
47570af302Sopenharmony_ci
48570af302Sopenharmony_cistruct sigaltstack {
49570af302Sopenharmony_ci	void *ss_sp;
50570af302Sopenharmony_ci	size_t ss_size;
51570af302Sopenharmony_ci	int ss_flags;
52570af302Sopenharmony_ci};
53570af302Sopenharmony_ci
54570af302Sopenharmony_citypedef struct __ucontext {
55570af302Sopenharmony_ci	unsigned long uc_flags;
56570af302Sopenharmony_ci	struct __ucontext *uc_link;
57570af302Sopenharmony_ci	stack_t uc_stack;
58570af302Sopenharmony_ci	mcontext_t uc_mcontext;
59570af302Sopenharmony_ci	sigset_t uc_sigmask;
60570af302Sopenharmony_ci} ucontext_t;
61570af302Sopenharmony_ci
62570af302Sopenharmony_ci#define SA_NOCLDSTOP  1
63570af302Sopenharmony_ci#define SA_NOCLDWAIT  0x10000
64570af302Sopenharmony_ci#define SA_SIGINFO    8
65570af302Sopenharmony_ci#define SA_ONSTACK    0x08000000
66570af302Sopenharmony_ci#define SA_RESTART    0x10000000
67570af302Sopenharmony_ci#define SA_NODEFER    0x40000000
68570af302Sopenharmony_ci#define SA_RESETHAND  0x80000000
69570af302Sopenharmony_ci
70570af302Sopenharmony_ci#undef SIG_BLOCK
71570af302Sopenharmony_ci#undef SIG_UNBLOCK
72570af302Sopenharmony_ci#undef SIG_SETMASK
73570af302Sopenharmony_ci#define SIG_BLOCK     1
74570af302Sopenharmony_ci#define SIG_UNBLOCK   2
75570af302Sopenharmony_ci#define SIG_SETMASK   3
76570af302Sopenharmony_ci
77570af302Sopenharmony_ci#undef SI_ASYNCIO
78570af302Sopenharmony_ci#undef SI_MESGQ
79570af302Sopenharmony_ci#undef SI_TIMER
80570af302Sopenharmony_ci#define SI_ASYNCIO (-2)
81570af302Sopenharmony_ci#define SI_MESGQ (-4)
82570af302Sopenharmony_ci#define SI_TIMER (-3)
83570af302Sopenharmony_ci
84570af302Sopenharmony_ci#define __SI_SWAP_ERRNO_CODE
85570af302Sopenharmony_ci
86570af302Sopenharmony_ci#endif
87570af302Sopenharmony_ci
88570af302Sopenharmony_ci#define SIGHUP    1
89570af302Sopenharmony_ci#define SIGINT    2
90570af302Sopenharmony_ci#define SIGQUIT   3
91570af302Sopenharmony_ci#define SIGILL    4
92570af302Sopenharmony_ci#define SIGTRAP   5
93570af302Sopenharmony_ci#define SIGABRT   6
94570af302Sopenharmony_ci#define SIGIOT    SIGABRT
95570af302Sopenharmony_ci#define SIGEMT    7
96570af302Sopenharmony_ci#define SIGFPE    8
97570af302Sopenharmony_ci#define SIGKILL   9
98570af302Sopenharmony_ci#define SIGBUS    10
99570af302Sopenharmony_ci#define SIGSEGV   11
100570af302Sopenharmony_ci#define SIGSYS    12
101570af302Sopenharmony_ci#define SIGPIPE   13
102570af302Sopenharmony_ci#define SIGALRM   14
103570af302Sopenharmony_ci#define SIGTERM   15
104570af302Sopenharmony_ci#define SIGUSR1   16
105570af302Sopenharmony_ci#define SIGUSR2   17
106570af302Sopenharmony_ci#define SIGCHLD   18
107570af302Sopenharmony_ci#define SIGPWR    19
108570af302Sopenharmony_ci#define SIGWINCH  20
109570af302Sopenharmony_ci#define SIGURG    21
110570af302Sopenharmony_ci#define SIGIO     22
111570af302Sopenharmony_ci#define SIGPOLL   SIGIO
112570af302Sopenharmony_ci#define SIGSTOP   23
113570af302Sopenharmony_ci#define SIGTSTP   24
114570af302Sopenharmony_ci#define SIGCONT   25
115570af302Sopenharmony_ci#define SIGTTIN   26
116570af302Sopenharmony_ci#define SIGTTOU   27
117570af302Sopenharmony_ci#define SIGVTALRM 28
118570af302Sopenharmony_ci#define SIGPROF   29
119570af302Sopenharmony_ci#define SIGXCPU   30
120570af302Sopenharmony_ci#define SIGXFSZ   31
121570af302Sopenharmony_ci#define SIGUNUSED SIGSYS
122570af302Sopenharmony_ci
123570af302Sopenharmony_ci#define _NSIG 128
124