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 16384
7570af302Sopenharmony_ci#endif
8570af302Sopenharmony_ci
9570af302Sopenharmony_ci#if defined(_GNU_SOURCE)
10570af302Sopenharmony_ci#define LARCH_NGREG 32
11570af302Sopenharmony_ci#define LARCH_REG_RA 1
12570af302Sopenharmony_ci#define LARCH_REG_SP 3
13570af302Sopenharmony_ci#define LARCH_REG_S0 23
14570af302Sopenharmony_ci#define LARCH_REG_S1 24
15570af302Sopenharmony_ci#define LARCH_REG_A0 4
16570af302Sopenharmony_ci#define LARCH_REG_S2 25
17570af302Sopenharmony_ci#define LARCH_REG_NARGS 8
18570af302Sopenharmony_ci#endif
19570af302Sopenharmony_ci
20570af302Sopenharmony_ci#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
21570af302Sopenharmony_citypedef unsigned long greg_t, gregset_t[32];
22570af302Sopenharmony_ci
23570af302Sopenharmony_cistruct sigcontext {
24570af302Sopenharmony_ci	unsigned long sc_pc;
25570af302Sopenharmony_ci	unsigned long sc_regs[32];
26570af302Sopenharmony_ci	unsigned sc_flags;
27570af302Sopenharmony_ci	unsigned long sc_extcontext[0] __attribute__((__aligned__(16)));
28570af302Sopenharmony_ci};
29570af302Sopenharmony_ci#endif
30570af302Sopenharmony_ci
31570af302Sopenharmony_citypedef struct {
32570af302Sopenharmony_ci	unsigned long __pc;
33570af302Sopenharmony_ci	unsigned long __gregs[32];
34570af302Sopenharmony_ci	unsigned __flags;
35570af302Sopenharmony_ci	unsigned long __extcontext[0] __attribute__((__aligned__(16)));
36570af302Sopenharmony_ci} mcontext_t;
37570af302Sopenharmony_ci
38570af302Sopenharmony_cistruct sigaltstack {
39570af302Sopenharmony_ci	void *ss_sp;
40570af302Sopenharmony_ci	int ss_flags;
41570af302Sopenharmony_ci	size_t ss_size;
42570af302Sopenharmony_ci};
43570af302Sopenharmony_ci
44570af302Sopenharmony_citypedef struct __ucontext
45570af302Sopenharmony_ci{
46570af302Sopenharmony_ci	unsigned long uc_flags;
47570af302Sopenharmony_ci	struct __ucontext *uc_link;
48570af302Sopenharmony_ci	stack_t uc_stack;
49570af302Sopenharmony_ci	sigset_t uc_sigmask;
50570af302Sopenharmony_ci	long __uc_pad;
51570af302Sopenharmony_ci	mcontext_t uc_mcontext;
52570af302Sopenharmony_ci} ucontext_t;
53570af302Sopenharmony_ci
54570af302Sopenharmony_ci#define __uc_flags uc_flags
55570af302Sopenharmony_ci
56570af302Sopenharmony_ci#define SA_NOCLDSTOP 1
57570af302Sopenharmony_ci#define SA_NOCLDWAIT 2
58570af302Sopenharmony_ci#define SA_SIGINFO   4
59570af302Sopenharmony_ci#define SA_ONSTACK   0x08000000
60570af302Sopenharmony_ci#define SA_RESTART   0x10000000
61570af302Sopenharmony_ci#define SA_NODEFER   0x40000000
62570af302Sopenharmony_ci#define SA_RESETHAND 0x80000000
63570af302Sopenharmony_ci
64570af302Sopenharmony_ci#endif
65570af302Sopenharmony_ci
66570af302Sopenharmony_ci#define SIGHUP     1
67570af302Sopenharmony_ci#define SIGINT     2
68570af302Sopenharmony_ci#define SIGQUIT    3
69570af302Sopenharmony_ci#define SIGILL     4
70570af302Sopenharmony_ci#define SIGTRAP    5
71570af302Sopenharmony_ci#define SIGABRT    6
72570af302Sopenharmony_ci#define SIGIOT     SIGABRT
73570af302Sopenharmony_ci#define SIGBUS     7
74570af302Sopenharmony_ci#define SIGFPE     8
75570af302Sopenharmony_ci#define SIGKILL    9
76570af302Sopenharmony_ci#define SIGUSR1   10
77570af302Sopenharmony_ci#define SIGSEGV   11
78570af302Sopenharmony_ci#define SIGUSR2   12
79570af302Sopenharmony_ci#define SIGPIPE   13
80570af302Sopenharmony_ci#define SIGALRM   14
81570af302Sopenharmony_ci#define SIGTERM   15
82570af302Sopenharmony_ci#define SIGSTKFLT 16
83570af302Sopenharmony_ci#define SIGCHLD   17
84570af302Sopenharmony_ci#define SIGCONT   18
85570af302Sopenharmony_ci#define SIGSTOP   19
86570af302Sopenharmony_ci#define SIGTSTP   20
87570af302Sopenharmony_ci#define SIGTTIN   21
88570af302Sopenharmony_ci#define SIGTTOU   22
89570af302Sopenharmony_ci#define SIGURG    23
90570af302Sopenharmony_ci#define SIGXCPU   24
91570af302Sopenharmony_ci#define SIGXFSZ   25
92570af302Sopenharmony_ci#define SIGVTALRM 26
93570af302Sopenharmony_ci#define SIGPROF   27
94570af302Sopenharmony_ci#define SIGWINCH  28
95570af302Sopenharmony_ci#define SIGIO     29
96570af302Sopenharmony_ci#define SIGPOLL   SIGIO
97570af302Sopenharmony_ci#define SIGPWR    30
98570af302Sopenharmony_ci#define SIGSYS    31
99570af302Sopenharmony_ci#define SIGUNUSED SIGSYS
100570af302Sopenharmony_ci
101570af302Sopenharmony_ci#define _NSIG 65
102