1#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
  2 || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
  3
  4#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
  5#define MINSIGSTKSZ 2048
  6#define SIGSTKSZ 8192
  7#endif
  8
  9#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
 10typedef int greg_t, gregset_t[18];
 11typedef struct sigcontext
 12{
 13	unsigned long  r0,  r1,  r2,  r3;
 14	unsigned long  r4,  r5,  r6,  r7;
 15	unsigned long  r8,  r9, r10, r11;
 16	unsigned long r12, r13, r14, r15;
 17	unsigned long r16, r17, r18, r19;
 18	unsigned long r20, r21, r22, r23;
 19	unsigned long r24, r25, r26, r27;
 20	unsigned long r28, r29, r30, r31;
 21	unsigned long sa0;
 22	unsigned long lc0;
 23	unsigned long sa1;
 24	unsigned long lc1;
 25	unsigned long m0;
 26	unsigned long m1;
 27	unsigned long usr;
 28	unsigned long p3_0;
 29	unsigned long gp;
 30	unsigned long ugp;
 31	unsigned long pc;
 32	unsigned long cause;
 33	unsigned long badva;
 34	unsigned long pad1;
 35	unsigned long long pad2;
 36} mcontext_t;
 37#else
 38typedef struct {
 39	unsigned long __regs[48];
 40} __attribute__((__aligned__(8))) mcontext_t;
 41#endif
 42
 43struct sigaltstack {
 44	void *ss_sp;
 45	int ss_flags;
 46	size_t ss_size;
 47};
 48
 49typedef struct __ucontext {
 50	unsigned long uc_flags;
 51	struct __ucontext *uc_link;
 52	stack_t uc_stack;
 53	mcontext_t uc_mcontext;
 54	sigset_t uc_sigmask;
 55} ucontext_t;
 56
 57#define SA_NOCLDSTOP  1
 58#define SA_NOCLDWAIT  2
 59#define SA_SIGINFO    4
 60#define SA_ONSTACK    0x08000000
 61#define SA_RESTART    0x10000000
 62#define SA_NODEFER    0x40000000
 63#define SA_RESETHAND  0x80000000
 64#define SA_RESTORER   0x04000000
 65
 66#endif
 67
 68#define SIGHUP    1
 69#define SIGINT    2
 70#define SIGQUIT   3
 71#define SIGILL    4
 72#define SIGTRAP   5
 73#define SIGABRT   6
 74#define SIGIOT    SIGABRT
 75#define SIGBUS    7
 76#define SIGFPE    8
 77#define SIGKILL   9
 78#define SIGUSR1   10
 79#define SIGSEGV   11
 80#define SIGUSR2   12
 81#define SIGPIPE   13
 82#define SIGALRM   14
 83#define SIGTERM   15
 84#define SIGSTKFLT 16
 85#define SIGCHLD   17
 86#define SIGCONT   18
 87#define SIGSTOP   19
 88#define SIGTSTP   20
 89#define SIGTTIN   21
 90#define SIGTTOU   22
 91#define SIGURG    23
 92#define SIGXCPU   24
 93#define SIGXFSZ   25
 94#define SIGVTALRM 26
 95#define SIGPROF   27
 96#define SIGWINCH  28
 97#define SIGIO     29
 98#define SIGPOLL   29
 99#define SIGPWR    30
100#define SIGSYS    31
101#define SIGUNUSED SIGSYS
102
103#define _NSIG 65