signal.h 2.8 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. #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
  8. typedef unsigned long long greg_t, gregset_t[32];
  9. typedef struct {
  10. union {
  11. double fp_dregs[32];
  12. struct {
  13. float _fp_fregs;
  14. unsigned _fp_pad;
  15. } fp_fregs[32];
  16. } fp_r;
  17. } fpregset_t;
  18. struct sigcontext {
  19. unsigned long long sc_regs[32];
  20. unsigned long long sc_fpregs[32];
  21. unsigned long long sc_mdhi;
  22. unsigned long long sc_hi1;
  23. unsigned long long sc_hi2;
  24. unsigned long long sc_hi3;
  25. unsigned long long sc_mdlo;
  26. unsigned long long sc_lo1;
  27. unsigned long long sc_lo2;
  28. unsigned long long sc_lo3;
  29. unsigned long long sc_pc;
  30. unsigned int sc_fpc_csr;
  31. unsigned int sc_used_math;
  32. unsigned int sc_dsp;
  33. unsigned int sc_reserved;
  34. };
  35. typedef struct {
  36. gregset_t gregs;
  37. fpregset_t fpregs;
  38. greg_t mdhi;
  39. greg_t hi1;
  40. greg_t hi2;
  41. greg_t hi3;
  42. greg_t mdlo;
  43. greg_t lo1;
  44. greg_t lo2;
  45. greg_t lo3;
  46. greg_t pc;
  47. unsigned int fpc_csr;
  48. unsigned int used_math;
  49. unsigned int dsp;
  50. unsigned int reserved;
  51. } mcontext_t;
  52. #else
  53. typedef struct {
  54. unsigned long long __mc1[32];
  55. double __mc2[32];
  56. unsigned long long __mc3[9];
  57. unsigned __mc4[4];
  58. } mcontext_t;
  59. #endif
  60. struct sigaltstack {
  61. void *ss_sp;
  62. size_t ss_size;
  63. int ss_flags;
  64. };
  65. typedef struct __ucontext {
  66. unsigned long uc_flags;
  67. struct __ucontext *uc_link;
  68. stack_t uc_stack;
  69. mcontext_t uc_mcontext;
  70. sigset_t uc_sigmask;
  71. } ucontext_t;
  72. #define SA_NOCLDSTOP 1
  73. #define SA_NOCLDWAIT 0x10000
  74. #define SA_SIGINFO 8
  75. #define SA_ONSTACK 0x08000000
  76. #define SA_RESTART 0x10000000
  77. #define SA_NODEFER 0x40000000
  78. #define SA_RESETHAND 0x80000000
  79. #undef SIG_BLOCK
  80. #undef SIG_UNBLOCK
  81. #undef SIG_SETMASK
  82. #define SIG_BLOCK 1
  83. #define SIG_UNBLOCK 2
  84. #define SIG_SETMASK 3
  85. #undef SI_ASYNCIO
  86. #undef SI_MESGQ
  87. #undef SI_TIMER
  88. #define SI_ASYNCIO (-2)
  89. #define SI_MESGQ (-4)
  90. #define SI_TIMER (-3)
  91. #define __SI_SWAP_ERRNO_CODE
  92. #endif
  93. #define SIGHUP 1
  94. #define SIGINT 2
  95. #define SIGQUIT 3
  96. #define SIGILL 4
  97. #define SIGTRAP 5
  98. #define SIGABRT 6
  99. #define SIGIOT SIGABRT
  100. #define SIGEMT 7
  101. #define SIGFPE 8
  102. #define SIGKILL 9
  103. #define SIGBUS 10
  104. #define SIGSEGV 11
  105. #define SIGSYS 12
  106. #define SIGPIPE 13
  107. #define SIGALRM 14
  108. #define SIGTERM 15
  109. #define SIGUSR1 16
  110. #define SIGUSR2 17
  111. #define SIGCHLD 18
  112. #define SIGPWR 19
  113. #define SIGWINCH 20
  114. #define SIGURG 21
  115. #define SIGIO 22
  116. #define SIGPOLL SIGIO
  117. #define SIGSTOP 23
  118. #define SIGTSTP 24
  119. #define SIGCONT 25
  120. #define SIGTTIN 26
  121. #define SIGTTOU 27
  122. #define SIGVTALRM 28
  123. #define SIGPROF 29
  124. #define SIGXCPU 30
  125. #define SIGXFSZ 31
  126. #define SIGUNUSED SIGSYS
  127. #define _NSIG 128