2
0

signal.h 3.1 KB

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