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 4096
6570af302Sopenharmony_ci#define SIGSTKSZ    10240
7570af302Sopenharmony_ci#endif
8570af302Sopenharmony_ci
9570af302Sopenharmony_ci#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
10570af302Sopenharmony_ci
11570af302Sopenharmony_citypedef unsigned long greg_t, gregset_t[48];
12570af302Sopenharmony_citypedef double fpregset_t[33];
13570af302Sopenharmony_ci
14570af302Sopenharmony_citypedef struct {
15570af302Sopenharmony_ci#ifdef __GNUC__
16570af302Sopenharmony_ci	__attribute__((__aligned__(16)))
17570af302Sopenharmony_ci#endif
18570af302Sopenharmony_ci	unsigned vrregs[32][4];
19570af302Sopenharmony_ci	struct {
20570af302Sopenharmony_ci#if __BIG_ENDIAN__
21570af302Sopenharmony_ci		unsigned _pad[3], vscr_word;
22570af302Sopenharmony_ci#else
23570af302Sopenharmony_ci		unsigned vscr_word, _pad[3];
24570af302Sopenharmony_ci#endif
25570af302Sopenharmony_ci	} vscr;
26570af302Sopenharmony_ci	unsigned vrsave, _pad[3];
27570af302Sopenharmony_ci} vrregset_t;
28570af302Sopenharmony_ci
29570af302Sopenharmony_citypedef struct sigcontext {
30570af302Sopenharmony_ci	unsigned long _unused[4];
31570af302Sopenharmony_ci	int signal;
32570af302Sopenharmony_ci	int _pad0;
33570af302Sopenharmony_ci	unsigned long handler;
34570af302Sopenharmony_ci	unsigned long oldmask;
35570af302Sopenharmony_ci	struct pt_regs *regs;
36570af302Sopenharmony_ci	gregset_t gp_regs;
37570af302Sopenharmony_ci	fpregset_t fp_regs;
38570af302Sopenharmony_ci	vrregset_t *v_regs;
39570af302Sopenharmony_ci	long vmx_reserve[34+34+32+1];
40570af302Sopenharmony_ci} mcontext_t;
41570af302Sopenharmony_ci
42570af302Sopenharmony_ci#else
43570af302Sopenharmony_ci
44570af302Sopenharmony_citypedef struct {
45570af302Sopenharmony_ci	long __regs[4+4+48+33+1+34+34+32+1];
46570af302Sopenharmony_ci} mcontext_t;
47570af302Sopenharmony_ci
48570af302Sopenharmony_ci#endif
49570af302Sopenharmony_ci
50570af302Sopenharmony_cistruct sigaltstack {
51570af302Sopenharmony_ci	void *ss_sp;
52570af302Sopenharmony_ci	int ss_flags;
53570af302Sopenharmony_ci	size_t ss_size;
54570af302Sopenharmony_ci};
55570af302Sopenharmony_ci
56570af302Sopenharmony_citypedef struct __ucontext {
57570af302Sopenharmony_ci	unsigned long uc_flags;
58570af302Sopenharmony_ci	struct __ucontext *uc_link;
59570af302Sopenharmony_ci	stack_t uc_stack;
60570af302Sopenharmony_ci	sigset_t uc_sigmask;
61570af302Sopenharmony_ci	mcontext_t uc_mcontext;
62570af302Sopenharmony_ci} ucontext_t;
63570af302Sopenharmony_ci
64570af302Sopenharmony_ci#define SA_NOCLDSTOP  1U
65570af302Sopenharmony_ci#define SA_NOCLDWAIT  2U
66570af302Sopenharmony_ci#define SA_SIGINFO    4U
67570af302Sopenharmony_ci#define SA_ONSTACK    0x08000000U
68570af302Sopenharmony_ci#define SA_RESTART    0x10000000U
69570af302Sopenharmony_ci#define SA_NODEFER    0x40000000U
70570af302Sopenharmony_ci#define SA_RESETHAND  0x80000000U
71570af302Sopenharmony_ci#define SA_RESTORER   0x04000000U
72570af302Sopenharmony_ci
73570af302Sopenharmony_ci#endif
74570af302Sopenharmony_ci
75570af302Sopenharmony_ci#define SIGHUP    1
76570af302Sopenharmony_ci#define SIGINT    2
77570af302Sopenharmony_ci#define SIGQUIT   3
78570af302Sopenharmony_ci#define SIGILL    4
79570af302Sopenharmony_ci#define SIGTRAP   5
80570af302Sopenharmony_ci#define SIGABRT   6
81570af302Sopenharmony_ci#define SIGIOT    SIGABRT
82570af302Sopenharmony_ci#define SIGBUS    7
83570af302Sopenharmony_ci#define SIGFPE    8
84570af302Sopenharmony_ci#define SIGKILL   9
85570af302Sopenharmony_ci#define SIGUSR1   10
86570af302Sopenharmony_ci#define SIGSEGV   11
87570af302Sopenharmony_ci#define SIGUSR2   12
88570af302Sopenharmony_ci#define SIGPIPE   13
89570af302Sopenharmony_ci#define SIGALRM   14
90570af302Sopenharmony_ci#define SIGTERM   15
91570af302Sopenharmony_ci#define SIGSTKFLT 16
92570af302Sopenharmony_ci#define SIGCHLD   17
93570af302Sopenharmony_ci#define SIGCONT   18
94570af302Sopenharmony_ci#define SIGSTOP   19
95570af302Sopenharmony_ci#define SIGTSTP   20
96570af302Sopenharmony_ci#define SIGTTIN   21
97570af302Sopenharmony_ci#define SIGTTOU   22
98570af302Sopenharmony_ci#define SIGURG    23
99570af302Sopenharmony_ci#define SIGXCPU   24
100570af302Sopenharmony_ci#define SIGXFSZ   25
101570af302Sopenharmony_ci#define SIGVTALRM 26
102570af302Sopenharmony_ci#define SIGPROF   27
103570af302Sopenharmony_ci#define SIGWINCH  28
104570af302Sopenharmony_ci#define SIGIO     29
105570af302Sopenharmony_ci#define SIGPOLL   SIGIO
106570af302Sopenharmony_ci#define SIGPWR    30
107570af302Sopenharmony_ci#define SIGSYS    31
108570af302Sopenharmony_ci#define SIGUNUSED SIGSYS
109570af302Sopenharmony_ci
110570af302Sopenharmony_ci#define _NSIG 65
111