signal.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
  2. || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)
  3. struct __fpstate {
  4. unsigned long __x[4];
  5. unsigned char __y[384];
  6. unsigned long __z[12];
  7. };
  8. typedef struct {
  9. unsigned long __gregs[23];
  10. void *__fpregs;
  11. unsigned long __reserved1[8];
  12. } mcontext_t;
  13. typedef struct __ucontext {
  14. unsigned long uc_flags;
  15. struct __ucontext *uc_link;
  16. stack_t uc_stack;
  17. mcontext_t uc_mcontext;
  18. sigset_t uc_sigmask;
  19. struct __fpstate __fpregs_mem;
  20. } ucontext_t;
  21. #ifdef _GNU_SOURCE
  22. struct sigcontext {
  23. unsigned long r8, r9, r10, r11, r12, r13, r14, r15;
  24. unsigned long rdi, rsi, rbp, rbx, rdx, rax, rcx, rsp, rip, eflags;
  25. unsigned short cs, gs, fs, __pad0;
  26. unsigned long err, trapno, oldmask, cr2;
  27. struct __fpstate *fpstate;
  28. unsigned long __reserved1[8];
  29. };
  30. #endif
  31. struct __siginfo
  32. {
  33. int si_signo;
  34. int si_errno;
  35. int si_code;
  36. union
  37. {
  38. int __pad[(128 - 4*sizeof(int)) / sizeof(int)];
  39. struct {
  40. pid_t si_pid;
  41. uid_t si_uid;
  42. } __kill;
  43. struct {
  44. void *si_timerid;
  45. int si_overrun;
  46. char __pad[sizeof(uid_t) - sizeof(int)];
  47. union sigval si_sigval;
  48. int si_private;
  49. } __timer;
  50. struct {
  51. pid_t si_pid;
  52. uid_t si_uid;
  53. union sigval si_sigval;
  54. } __rt;
  55. struct {
  56. pid_t si_pid;
  57. uid_t si_uid;
  58. int si_status;
  59. clock_t si_utime;
  60. clock_t si_stime;
  61. } __sigchld;
  62. struct {
  63. void *si_addr;
  64. short addr_lsb;
  65. } __sigfault;
  66. struct {
  67. long si_band;
  68. int si_fd;
  69. } __sigpoll;
  70. } __si_fields;
  71. };
  72. #define si_pid __si_fields.__sigchld.si_pid
  73. #define si_uid __si_fields.__sigchld.si_uid
  74. #define si_status __si_fields.__sigchld.si_status
  75. #define si_utime __si_fields.__sigchld.si_utime
  76. #define si_stime __si_fields.__sigchld.si_stime
  77. #define si_value __si_fields.__rt.si_sigval
  78. #define si_addr __si_fields.__sigfault.si_addr
  79. #define si_band __si_fields.__sigpoll.si_band
  80. #define SI_ASYNCNL (-60)
  81. #define SI_TKILL (-6)
  82. #define SI_SIGIO (-5)
  83. #define SI_ASYNCIO (-4)
  84. #define SI_MESGQ (-3)
  85. #define SI_TIMER (-2)
  86. #define SI_QUEUE (-1)
  87. #define SI_USER 0
  88. #define SI_KERNEL 128
  89. #define FPE_INTDIV 1
  90. #define FPE_INTOVF 2
  91. #define FPE_FLTDIV 3
  92. #define FPE_FLTOVF 4
  93. #define FPE_FLTUNT 5
  94. #define FPE_FLTRES 6
  95. #define FPE_FLTINV 7
  96. #define FPE_FLTSUB 8
  97. #define ILL_ILLOPC 1
  98. #define ILL_ILLOPN 2
  99. #define ILL_ILLADR 3
  100. #define ILL_ILLTRP 4
  101. #define ILL_PRVOPC 5
  102. #define ILL_PRVREG 6
  103. #define ILL_COPROC 7
  104. #define ILL_BADSTK 8
  105. #define SEGV_MAPERR 1
  106. #define SEGV_ACCERR 2
  107. #define BUS_ADRALN 1
  108. #define BUS_ADRERR 2
  109. #define BUS_OBJERR 3
  110. #define CLD_EXITED 1
  111. #define CLD_KILLED 2
  112. #define CLD_DUMPED 3
  113. #define CLD_TRAPPED 4
  114. #define CLD_STOPPED 5
  115. #define CLD_CONTINUED 6
  116. #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)
  117. #define TRAP_BRKPT 1
  118. #define TRAP_TRACE 2
  119. #define POLL_IN 1
  120. #define POLL_OUT 2
  121. #define POLL_MSG 3
  122. #define POLL_ERR 4
  123. #define POLL_PRI 5
  124. #define POLL_HUP 6
  125. #define SS_ONSTACK 1
  126. #define SS_DISABLE 2
  127. #define MINSIGSTKSZ 2048
  128. #define SIGSTKSZ 8192
  129. #endif
  130. #define SA_NOCLDSTOP 1
  131. #define SA_NOCLDWAIT 2
  132. #define SA_SIGINFO 4
  133. #define SA_ONSTACK 0x08000000
  134. #define SA_RESTART 0x10000000
  135. #define SA_NODEFER 0x40000000
  136. #define SA_RESETHAND 0x80000000
  137. #define SA_RESTORER 0x04000000
  138. #define SIG_BLOCK 0
  139. #define SIG_UNBLOCK 1
  140. #define SIG_SETMASK 2
  141. #endif
  142. #ifdef _GNU_SOURCE
  143. #define NSIG 64
  144. #endif
  145. #define SIG_ERR ((void (*)(int))-1)
  146. #define SIG_DFL ((void (*)(int)) 0)
  147. #define SIG_IGN ((void (*)(int)) 1)
  148. #define SIG_HOLD ((void (*)(int)) 2)
  149. #define SIGHUP 1
  150. #define SIGINT 2
  151. #define SIGQUIT 3
  152. #define SIGILL 4
  153. #define SIGTRAP 5
  154. #define SIGABRT 6
  155. #define SIGBUS 7
  156. #define SIGFPE 8
  157. #define SIGKILL 9
  158. #define SIGUSR1 10
  159. #define SIGSEGV 11
  160. #define SIGUSR2 12
  161. #define SIGPIPE 13
  162. #define SIGALRM 14
  163. #define SIGTERM 15
  164. #define SIGSTKFLT 16
  165. #define SIGCHLD 17
  166. #define SIGCONT 18
  167. #define SIGSTOP 19
  168. #define SIGTSTP 20
  169. #define SIGTTIN 21
  170. #define SIGTTOU 22
  171. #define SIGURG 23
  172. #define SIGXCPU 24
  173. #define SIGXFSZ 25
  174. #define SIGVTALRM 26
  175. #define SIGPROF 27
  176. #define SIGWINCH 28
  177. #define SIGIO 29
  178. #define SIGPOLL 29
  179. #define SIGPWR 30
  180. #define SIGSYS 31
  181. #define SIGUNUSED SIGSYS