| 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 | #ifdef _GNU_SOURCE |
| 10 | enum { REG_GS = 0 }; |
| 11 | #define REG_GS REG_GS |
| 12 | enum { REG_FS = 1 }; |
| 13 | #define REG_FS REG_FS |
| 14 | enum { REG_ES = 2 }; |
| 15 | #define REG_ES REG_ES |
| 16 | enum { REG_DS = 3 }; |
| 17 | #define REG_DS REG_DS |
| 18 | enum { REG_EDI = 4 }; |
| 19 | #define REG_EDI REG_EDI |
| 20 | enum { REG_ESI = 5 }; |
| 21 | #define REG_ESI REG_ESI |
| 22 | enum { REG_EBP = 6 }; |
| 23 | #define REG_EBP REG_EBP |
| 24 | enum { REG_ESP = 7 }; |
| 25 | #define REG_ESP REG_ESP |
| 26 | enum { REG_EBX = 8 }; |
| 27 | #define REG_EBX REG_EBX |
| 28 | enum { REG_EDX = 9 }; |
| 29 | #define REG_EDX REG_EDX |
| 30 | enum { REG_ECX = 10 }; |
| 31 | #define REG_ECX REG_ECX |
| 32 | enum { REG_EAX = 11 }; |
| 33 | #define REG_EAX REG_EAX |
| 34 | enum { REG_TRAPNO = 12 }; |
| 35 | #define REG_TRAPNO REG_TRAPNO |
| 36 | enum { REG_ERR = 13 }; |
| 37 | #define REG_ERR REG_ERR |
| 38 | enum { REG_EIP = 14 }; |
| 39 | #define REG_EIP REG_EIP |
| 40 | enum { REG_CS = 15 }; |
| 41 | #define REG_CS REG_CS |
| 42 | enum { REG_EFL = 16 }; |
| 43 | #define REG_EFL REG_EFL |
| 44 | enum { REG_UESP = 17 }; |
| 45 | #define REG_UESP REG_UESP |
| 46 | enum { REG_SS = 18 }; |
| 47 | #define REG_SS REG_SS |
| 48 | #endif |
| 49 | |
| 50 | #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) |
| 51 | typedef int greg_t, gregset_t[19]; |
| 52 | typedef struct _fpstate { |
| 53 | 	unsigned long cw, sw, tag, ipoff, cssel, dataoff, datasel; |
| 54 | 	struct { |
| 55 | 		unsigned short significand[4], exponent; |
| 56 | 	} _st[8]; |
| 57 | 	unsigned long status; |
| 58 | } *fpregset_t; |
| 59 | struct sigcontext { |
| 60 | 	unsigned short gs, __gsh, fs, __fsh, es, __esh, ds, __dsh; |
| 61 | 	unsigned long edi, esi, ebp, esp, ebx, edx, ecx, eax; |
| 62 | 	unsigned long trapno, err, eip; |
| 63 | 	unsigned short cs, __csh; |
| 64 | 	unsigned long eflags, esp_at_signal; |
| 65 | 	unsigned short ss, __ssh; |
| 66 | 	struct _fpstate *fpstate; |
| 67 | 	unsigned long oldmask, cr2; |
| 68 | }; |
| 69 | typedef struct { |
| 70 | 	gregset_t gregs; |
| 71 | 	fpregset_t fpregs; |
| 72 | 	unsigned long oldmask, cr2; |
| 73 | } mcontext_t; |
| 74 | #else |
| 75 | typedef struct { |
| 76 | 	unsigned __space[22]; |
| 77 | } mcontext_t; |
| 78 | #endif |
| 79 | |
| 80 | struct sigaltstack { |
| 81 | 	void *ss_sp; |
| 82 | 	int ss_flags; |
| 83 | 	size_t ss_size; |
| 84 | }; |
| 85 | |
| 86 | typedef struct __ucontext { |
| 87 | 	unsigned long uc_flags; |
| 88 | 	struct __ucontext *uc_link; |
| 89 | 	stack_t uc_stack; |
| 90 | 	mcontext_t uc_mcontext; |
| 91 | 	sigset_t uc_sigmask; |
| 92 | 	unsigned long __fpregs_mem[28]; |
| 93 | } ucontext_t; |
| 94 | |
| 95 | #define SA_NOCLDSTOP 1 |
| 96 | #define SA_NOCLDWAIT 2 |
| 97 | #define SA_SIGINFO 4 |
| 98 | #define SA_ONSTACK 0x08000000 |
| 99 | #define SA_RESTART 0x10000000 |
| 100 | #define SA_NODEFER 0x40000000 |
| 101 | #define SA_RESETHAND 0x80000000 |
| 102 | #define SA_RESTORER 0x04000000 |
| 103 | |
| 104 | #endif |
| 105 | |
| 106 | #define SIGHUP 1 |
| 107 | #define SIGINT 2 |
| 108 | #define SIGQUIT 3 |
| 109 | #define SIGILL 4 |
| 110 | #define SIGTRAP 5 |
| 111 | #define SIGABRT 6 |
| 112 | #define SIGIOT SIGABRT |
| 113 | #define SIGBUS 7 |
| 114 | #define SIGFPE 8 |
| 115 | #define SIGKILL 9 |
| 116 | #define SIGUSR1 10 |
| 117 | #define SIGSEGV 11 |
| 118 | #define SIGUSR2 12 |
| 119 | #define SIGPIPE 13 |
| 120 | #define SIGALRM 14 |
| 121 | #define SIGTERM 15 |
| 122 | #define SIGSTKFLT 16 |
| 123 | #define SIGCHLD 17 |
| 124 | #define SIGCONT 18 |
| 125 | #define SIGSTOP 19 |
| 126 | #define SIGTSTP 20 |
| 127 | #define SIGTTIN 21 |
| 128 | #define SIGTTOU 22 |
| 129 | #define SIGURG 23 |
| 130 | #define SIGXCPU 24 |
| 131 | #define SIGXFSZ 25 |
| 132 | #define SIGVTALRM 26 |
| 133 | #define SIGPROF 27 |
| 134 | #define SIGWINCH 28 |
| 135 | #define SIGIO 29 |
| 136 | #define SIGPOLL 29 |
| 137 | #define SIGPWR 30 |
| 138 | #define SIGSYS 31 |
| 139 | #define SIGUNUSED SIGSYS |
| 140 | |
| 141 | #define _NSIG 65 |