signal.h 2.5 KB

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