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 { REG_R8 = 0 }; 11570af302Sopenharmony_ci#define REG_R8 REG_R8 12570af302Sopenharmony_cienum { REG_R9 = 1 }; 13570af302Sopenharmony_ci#define REG_R9 REG_R9 14570af302Sopenharmony_cienum { REG_R10 = 2 }; 15570af302Sopenharmony_ci#define REG_R10 REG_R10 16570af302Sopenharmony_cienum { REG_R11 = 3 }; 17570af302Sopenharmony_ci#define REG_R11 REG_R11 18570af302Sopenharmony_cienum { REG_R12 = 4 }; 19570af302Sopenharmony_ci#define REG_R12 REG_R12 20570af302Sopenharmony_cienum { REG_R13 = 5 }; 21570af302Sopenharmony_ci#define REG_R13 REG_R13 22570af302Sopenharmony_cienum { REG_R14 = 6 }; 23570af302Sopenharmony_ci#define REG_R14 REG_R14 24570af302Sopenharmony_cienum { REG_R15 = 7 }; 25570af302Sopenharmony_ci#define REG_R15 REG_R15 26570af302Sopenharmony_cienum { REG_RDI = 8 }; 27570af302Sopenharmony_ci#define REG_RDI REG_RDI 28570af302Sopenharmony_cienum { REG_RSI = 9 }; 29570af302Sopenharmony_ci#define REG_RSI REG_RSI 30570af302Sopenharmony_cienum { REG_RBP = 10 }; 31570af302Sopenharmony_ci#define REG_RBP REG_RBP 32570af302Sopenharmony_cienum { REG_RBX = 11 }; 33570af302Sopenharmony_ci#define REG_RBX REG_RBX 34570af302Sopenharmony_cienum { REG_RDX = 12 }; 35570af302Sopenharmony_ci#define REG_RDX REG_RDX 36570af302Sopenharmony_cienum { REG_RAX = 13 }; 37570af302Sopenharmony_ci#define REG_RAX REG_RAX 38570af302Sopenharmony_cienum { REG_RCX = 14 }; 39570af302Sopenharmony_ci#define REG_RCX REG_RCX 40570af302Sopenharmony_cienum { REG_RSP = 15 }; 41570af302Sopenharmony_ci#define REG_RSP REG_RSP 42570af302Sopenharmony_cienum { REG_RIP = 16 }; 43570af302Sopenharmony_ci#define REG_RIP REG_RIP 44570af302Sopenharmony_cienum { REG_EFL = 17 }; 45570af302Sopenharmony_ci#define REG_EFL REG_EFL 46570af302Sopenharmony_cienum { REG_CSGSFS = 18 }; 47570af302Sopenharmony_ci#define REG_CSGSFS REG_CSGSFS 48570af302Sopenharmony_cienum { REG_ERR = 19 }; 49570af302Sopenharmony_ci#define REG_ERR REG_ERR 50570af302Sopenharmony_cienum { REG_TRAPNO = 20 }; 51570af302Sopenharmony_ci#define REG_TRAPNO REG_TRAPNO 52570af302Sopenharmony_cienum { REG_OLDMASK = 21 }; 53570af302Sopenharmony_ci#define REG_OLDMASK REG_OLDMASK 54570af302Sopenharmony_cienum { REG_CR2 = 22 }; 55570af302Sopenharmony_ci#define REG_CR2 REG_CR2 56570af302Sopenharmony_ci#endif 57570af302Sopenharmony_ci 58570af302Sopenharmony_ci#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) 59570af302Sopenharmony_citypedef long long greg_t, gregset_t[23]; 60570af302Sopenharmony_citypedef struct _fpstate { 61570af302Sopenharmony_ci unsigned short cwd, swd, ftw, fop; 62570af302Sopenharmony_ci unsigned long long rip, rdp; 63570af302Sopenharmony_ci unsigned mxcsr, mxcr_mask; 64570af302Sopenharmony_ci struct { 65570af302Sopenharmony_ci unsigned short significand[4], exponent, padding[3]; 66570af302Sopenharmony_ci } _st[8]; 67570af302Sopenharmony_ci struct { 68570af302Sopenharmony_ci unsigned element[4]; 69570af302Sopenharmony_ci } _xmm[16]; 70570af302Sopenharmony_ci unsigned padding[24]; 71570af302Sopenharmony_ci} *fpregset_t; 72570af302Sopenharmony_cistruct sigcontext { 73570af302Sopenharmony_ci unsigned long r8, r9, r10, r11, r12, r13, r14, r15; 74570af302Sopenharmony_ci unsigned long rdi, rsi, rbp, rbx, rdx, rax, rcx, rsp, rip, eflags; 75570af302Sopenharmony_ci unsigned short cs, gs, fs, __pad0; 76570af302Sopenharmony_ci unsigned long err, trapno, oldmask, cr2; 77570af302Sopenharmony_ci struct _fpstate *fpstate; 78570af302Sopenharmony_ci unsigned long __reserved1[8]; 79570af302Sopenharmony_ci}; 80570af302Sopenharmony_citypedef struct { 81570af302Sopenharmony_ci gregset_t gregs; 82570af302Sopenharmony_ci fpregset_t fpregs; 83570af302Sopenharmony_ci unsigned long long __reserved1[8]; 84570af302Sopenharmony_ci} mcontext_t; 85570af302Sopenharmony_ci#else 86570af302Sopenharmony_citypedef struct { 87570af302Sopenharmony_ci unsigned long __space[32]; 88570af302Sopenharmony_ci} mcontext_t; 89570af302Sopenharmony_ci#endif 90570af302Sopenharmony_ci 91570af302Sopenharmony_cistruct sigaltstack { 92570af302Sopenharmony_ci void *ss_sp; 93570af302Sopenharmony_ci int ss_flags; 94570af302Sopenharmony_ci size_t ss_size; 95570af302Sopenharmony_ci}; 96570af302Sopenharmony_ci 97570af302Sopenharmony_citypedef struct __ucontext { 98570af302Sopenharmony_ci unsigned long uc_flags; 99570af302Sopenharmony_ci struct __ucontext *uc_link; 100570af302Sopenharmony_ci stack_t uc_stack; 101570af302Sopenharmony_ci mcontext_t uc_mcontext; 102570af302Sopenharmony_ci sigset_t uc_sigmask; 103570af302Sopenharmony_ci unsigned long __fpregs_mem[64]; 104570af302Sopenharmony_ci} ucontext_t; 105570af302Sopenharmony_ci 106570af302Sopenharmony_ci#define SA_NOCLDSTOP 1 107570af302Sopenharmony_ci#define SA_NOCLDWAIT 2 108570af302Sopenharmony_ci#define SA_SIGINFO 4 109570af302Sopenharmony_ci#define SA_ONSTACK 0x08000000 110570af302Sopenharmony_ci#define SA_RESTART 0x10000000 111570af302Sopenharmony_ci#define SA_NODEFER 0x40000000 112570af302Sopenharmony_ci#define SA_RESETHAND 0x80000000 113570af302Sopenharmony_ci#define SA_RESTORER 0x04000000 114570af302Sopenharmony_ci 115570af302Sopenharmony_ci#endif 116570af302Sopenharmony_ci 117570af302Sopenharmony_ci#define SIGHUP 1 118570af302Sopenharmony_ci#define SIGINT 2 119570af302Sopenharmony_ci#define SIGQUIT 3 120570af302Sopenharmony_ci#define SIGILL 4 121570af302Sopenharmony_ci#define SIGTRAP 5 122570af302Sopenharmony_ci#define SIGABRT 6 123570af302Sopenharmony_ci#define SIGIOT SIGABRT 124570af302Sopenharmony_ci#define SIGBUS 7 125570af302Sopenharmony_ci#define SIGFPE 8 126570af302Sopenharmony_ci#define SIGKILL 9 127570af302Sopenharmony_ci#define SIGUSR1 10 128570af302Sopenharmony_ci#define SIGSEGV 11 129570af302Sopenharmony_ci#define SIGUSR2 12 130570af302Sopenharmony_ci#define SIGPIPE 13 131570af302Sopenharmony_ci#define SIGALRM 14 132570af302Sopenharmony_ci#define SIGTERM 15 133570af302Sopenharmony_ci#define SIGSTKFLT 16 134570af302Sopenharmony_ci#define SIGCHLD 17 135570af302Sopenharmony_ci#define SIGCONT 18 136570af302Sopenharmony_ci#define SIGSTOP 19 137570af302Sopenharmony_ci#define SIGTSTP 20 138570af302Sopenharmony_ci#define SIGTTIN 21 139570af302Sopenharmony_ci#define SIGTTOU 22 140570af302Sopenharmony_ci#define SIGURG 23 141570af302Sopenharmony_ci#define SIGXCPU 24 142570af302Sopenharmony_ci#define SIGXFSZ 25 143570af302Sopenharmony_ci#define SIGVTALRM 26 144570af302Sopenharmony_ci#define SIGPROF 27 145570af302Sopenharmony_ci#define SIGWINCH 28 146570af302Sopenharmony_ci#define SIGIO 29 147570af302Sopenharmony_ci#define SIGPOLL 29 148570af302Sopenharmony_ci#define SIGPWR 30 149570af302Sopenharmony_ci#define SIGSYS 31 150570af302Sopenharmony_ci#define SIGUNUSED SIGSYS 151570af302Sopenharmony_ci#define SIGHOOK 36 152570af302Sopenharmony_ci#define SIGUNHOOK 37 153570af302Sopenharmony_ci 154570af302Sopenharmony_ci#define _NSIG 65 155570af302Sopenharmony_ci 156