2
0

signal.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
  2. || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
  3. #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
  4. #define MINSIGSTKSZ 2048
  5. #define SIGSTKSZ 8192
  6. #endif
  7. #ifdef _GNU_SOURCE
  8. enum { REG_R8 = 0 };
  9. #define REG_R8 REG_R8
  10. enum { REG_R9 = 1 };
  11. #define REG_R9 REG_R9
  12. enum { REG_R10 = 2 };
  13. #define REG_R10 REG_R10
  14. enum { REG_R11 = 3 };
  15. #define REG_R11 REG_R11
  16. enum { REG_R12 = 4 };
  17. #define REG_R12 REG_R12
  18. enum { REG_R13 = 5 };
  19. #define REG_R13 REG_R13
  20. enum { REG_R14 = 6 };
  21. #define REG_R14 REG_R14
  22. enum { REG_R15 = 7 };
  23. #define REG_R15 REG_R15
  24. enum { REG_RDI = 8 };
  25. #define REG_RDI REG_RDI
  26. enum { REG_RSI = 9 };
  27. #define REG_RSI REG_RSI
  28. enum { REG_RBP = 10 };
  29. #define REG_RBP REG_RBP
  30. enum { REG_RBX = 11 };
  31. #define REG_RBX REG_RBX
  32. enum { REG_RDX = 12 };
  33. #define REG_RDX REG_RDX
  34. enum { REG_RAX = 13 };
  35. #define REG_RAX REG_RAX
  36. enum { REG_RCX = 14 };
  37. #define REG_RCX REG_RCX
  38. enum { REG_RSP = 15 };
  39. #define REG_RSP REG_RSP
  40. enum { REG_RIP = 16 };
  41. #define REG_RIP REG_RIP
  42. enum { REG_EFL = 17 };
  43. #define REG_EFL REG_EFL
  44. enum { REG_CSGSFS = 18 };
  45. #define REG_CSGSFS REG_CSGSFS
  46. enum { REG_ERR = 19 };
  47. #define REG_ERR REG_ERR
  48. enum { REG_TRAPNO = 20 };
  49. #define REG_TRAPNO REG_TRAPNO
  50. enum { REG_OLDMASK = 21 };
  51. #define REG_OLDMASK REG_OLDMASK
  52. enum { REG_CR2 = 22 };
  53. #define REG_CR2 REG_CR2
  54. #endif
  55. #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
  56. typedef long long greg_t, gregset_t[23];
  57. typedef struct _fpstate {
  58. unsigned short cwd, swd, ftw, fop;
  59. unsigned long long rip, rdp;
  60. unsigned mxcsr, mxcr_mask;
  61. struct {
  62. unsigned short significand[4], exponent, padding[3];
  63. } _st[8];
  64. struct {
  65. unsigned element[4];
  66. } _xmm[16];
  67. unsigned padding[24];
  68. } *fpregset_t;
  69. struct sigcontext {
  70. unsigned long r8, r9, r10, r11, r12, r13, r14, r15;
  71. unsigned long rdi, rsi, rbp, rbx, rdx, rax, rcx, rsp, rip, eflags;
  72. unsigned short cs, gs, fs, __pad0;
  73. unsigned long err, trapno, oldmask, cr2;
  74. struct _fpstate *fpstate;
  75. unsigned long __reserved1[8];
  76. };
  77. typedef struct {
  78. gregset_t gregs;
  79. fpregset_t fpregs;
  80. unsigned long long __reserved1[8];
  81. } mcontext_t;
  82. #else
  83. typedef struct {
  84. unsigned long __space[32];
  85. } mcontext_t;
  86. #endif
  87. struct sigaltstack {
  88. void *ss_sp;
  89. int ss_flags;
  90. size_t ss_size;
  91. };
  92. typedef struct __ucontext {
  93. unsigned long uc_flags;
  94. struct __ucontext *uc_link;
  95. stack_t uc_stack;
  96. mcontext_t uc_mcontext;
  97. sigset_t uc_sigmask;
  98. unsigned long __fpregs_mem[64];
  99. } ucontext_t;
  100. #define SA_NOCLDSTOP 1
  101. #define SA_NOCLDWAIT 2
  102. #define SA_SIGINFO 4
  103. #define SA_ONSTACK 0x08000000
  104. #define SA_RESTART 0x10000000
  105. #define SA_NODEFER 0x40000000
  106. #define SA_RESETHAND 0x80000000
  107. #define SA_RESTORER 0x04000000
  108. #endif
  109. #define SIGHUP 1
  110. #define SIGINT 2
  111. #define SIGQUIT 3
  112. #define SIGILL 4
  113. #define SIGTRAP 5
  114. #define SIGABRT 6
  115. #define SIGIOT SIGABRT
  116. #define SIGBUS 7
  117. #define SIGFPE 8
  118. #define SIGKILL 9
  119. #define SIGUSR1 10
  120. #define SIGSEGV 11
  121. #define SIGUSR2 12
  122. #define SIGPIPE 13
  123. #define SIGALRM 14
  124. #define SIGTERM 15
  125. #define SIGSTKFLT 16
  126. #define SIGCHLD 17
  127. #define SIGCONT 18
  128. #define SIGSTOP 19
  129. #define SIGTSTP 20
  130. #define SIGTTIN 21
  131. #define SIGTTOU 22
  132. #define SIGURG 23
  133. #define SIGXCPU 24
  134. #define SIGXFSZ 25
  135. #define SIGVTALRM 26
  136. #define SIGPROF 27
  137. #define SIGWINCH 28
  138. #define SIGIO 29
  139. #define SIGPOLL 29
  140. #define SIGPWR 30
  141. #define SIGSYS 31
  142. #define SIGUNUSED SIGSYS
  143. #define _NSIG 65