signal.h 2.6 KB

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