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 int greg_t, gregset_t[16];
11570af302Sopenharmony_citypedef int freg_t, fpregset_t[16];
12570af302Sopenharmony_citypedef struct {
13570af302Sopenharmony_ci	unsigned long oldmask;
14570af302Sopenharmony_ci	unsigned long gregs[16];
15570af302Sopenharmony_ci	unsigned long pc, pr, sr;
16570af302Sopenharmony_ci	unsigned long gbr, mach, macl;
17570af302Sopenharmony_ci	unsigned long fpregs[16];
18570af302Sopenharmony_ci	unsigned long xfpregs[16];
19570af302Sopenharmony_ci	unsigned int fpscr, fpul, ownedfp;
20570af302Sopenharmony_ci} mcontext_t;
21570af302Sopenharmony_cistruct sigcontext {
22570af302Sopenharmony_ci	unsigned long oldmask;
23570af302Sopenharmony_ci	unsigned long sc_regs[16];
24570af302Sopenharmony_ci	unsigned long sc_pc, sc_pr, sc_sr;
25570af302Sopenharmony_ci	unsigned long sc_gbr, sc_mach, sc_macl;
26570af302Sopenharmony_ci	unsigned long sc_fpregs[16];
27570af302Sopenharmony_ci	unsigned long sc_xfpregs[16];
28570af302Sopenharmony_ci	unsigned int sc_fpscr, sc_fpul, sc_ownedfp;
29570af302Sopenharmony_ci};
30570af302Sopenharmony_ci#else
31570af302Sopenharmony_citypedef struct {
32570af302Sopenharmony_ci	unsigned long __regs[58];
33570af302Sopenharmony_ci} mcontext_t;
34570af302Sopenharmony_ci#endif
35570af302Sopenharmony_ci
36570af302Sopenharmony_cistruct sigaltstack {
37570af302Sopenharmony_ci	void *ss_sp;
38570af302Sopenharmony_ci	int ss_flags;
39570af302Sopenharmony_ci	size_t ss_size;
40570af302Sopenharmony_ci};
41570af302Sopenharmony_ci
42570af302Sopenharmony_citypedef struct __ucontext {
43570af302Sopenharmony_ci	unsigned long uc_flags;
44570af302Sopenharmony_ci	struct __ucontext *uc_link;
45570af302Sopenharmony_ci	stack_t uc_stack;
46570af302Sopenharmony_ci	mcontext_t uc_mcontext;
47570af302Sopenharmony_ci	sigset_t uc_sigmask;
48570af302Sopenharmony_ci} ucontext_t;
49570af302Sopenharmony_ci
50570af302Sopenharmony_ci#define SA_NOCLDSTOP  1
51570af302Sopenharmony_ci#define SA_NOCLDWAIT  2
52570af302Sopenharmony_ci#define SA_SIGINFO    4
53570af302Sopenharmony_ci#define SA_ONSTACK    0x08000000
54570af302Sopenharmony_ci#define SA_RESTART    0x10000000
55570af302Sopenharmony_ci#define SA_NODEFER    0x40000000
56570af302Sopenharmony_ci#define SA_RESETHAND  0x80000000
57570af302Sopenharmony_ci#define SA_RESTORER   0x04000000
58570af302Sopenharmony_ci
59570af302Sopenharmony_ci#endif
60570af302Sopenharmony_ci
61570af302Sopenharmony_ci#define SIGHUP    1
62570af302Sopenharmony_ci#define SIGINT    2
63570af302Sopenharmony_ci#define SIGQUIT   3
64570af302Sopenharmony_ci#define SIGILL    4
65570af302Sopenharmony_ci#define SIGTRAP   5
66570af302Sopenharmony_ci#define SIGABRT   6
67570af302Sopenharmony_ci#define SIGIOT    SIGABRT
68570af302Sopenharmony_ci#define SIGBUS    7
69570af302Sopenharmony_ci#define SIGFPE    8
70570af302Sopenharmony_ci#define SIGKILL   9
71570af302Sopenharmony_ci#define SIGUSR1   10
72570af302Sopenharmony_ci#define SIGSEGV   11
73570af302Sopenharmony_ci#define SIGUSR2   12
74570af302Sopenharmony_ci#define SIGPIPE   13
75570af302Sopenharmony_ci#define SIGALRM   14
76570af302Sopenharmony_ci#define SIGTERM   15
77570af302Sopenharmony_ci#define SIGSTKFLT 16
78570af302Sopenharmony_ci#define SIGCHLD   17
79570af302Sopenharmony_ci#define SIGCONT   18
80570af302Sopenharmony_ci#define SIGSTOP   19
81570af302Sopenharmony_ci#define SIGTSTP   20
82570af302Sopenharmony_ci#define SIGTTIN   21
83570af302Sopenharmony_ci#define SIGTTOU   22
84570af302Sopenharmony_ci#define SIGURG    23
85570af302Sopenharmony_ci#define SIGXCPU   24
86570af302Sopenharmony_ci#define SIGXFSZ   25
87570af302Sopenharmony_ci#define SIGVTALRM 26
88570af302Sopenharmony_ci#define SIGPROF   27
89570af302Sopenharmony_ci#define SIGWINCH  28
90570af302Sopenharmony_ci#define SIGIO     29
91570af302Sopenharmony_ci#define SIGPOLL   29
92570af302Sopenharmony_ci#define SIGPWR    30
93570af302Sopenharmony_ci#define SIGSYS    31
94570af302Sopenharmony_ci#define SIGUNUSED SIGSYS
95570af302Sopenharmony_ci
96570af302Sopenharmony_ci#define _NSIG 65
97