1
0

signal.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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 { R_D0 = 0 };
  9. #define R_D0 R_D0
  10. enum { R_D1 = 1 };
  11. #define R_D1 R_D1
  12. enum { R_D2 = 2 };
  13. #define R_D2 R_D2
  14. enum { R_D3 = 3 };
  15. #define R_D3 R_D3
  16. enum { R_D4 = 4 };
  17. #define R_D4 R_D4
  18. enum { R_D5 = 5 };
  19. #define R_D5 R_D5
  20. enum { R_D6 = 6 };
  21. #define R_D6 R_D6
  22. enum { R_D7 = 7 };
  23. #define R_D7 R_D7
  24. enum { R_A0 = 8 };
  25. #define R_A0 R_A0
  26. enum { R_A1 = 9 };
  27. #define R_A1 R_A1
  28. enum { R_A2 = 10 };
  29. #define R_A2 R_A2
  30. enum { R_A3 = 11 };
  31. #define R_A3 R_A3
  32. enum { R_A4 = 12 };
  33. #define R_A4 R_A4
  34. enum { R_A5 = 13 };
  35. #define R_A5 R_A5
  36. enum { R_A6 = 14 };
  37. #define R_A6 R_A6
  38. enum { R_A7 = 15 };
  39. #define R_A7 R_A7
  40. enum { R_SP = 15 };
  41. #define R_SP R_SP
  42. enum { R_PC = 16 };
  43. #define R_PC R_PC
  44. enum { R_PS = 17 };
  45. #define R_PS R_PS
  46. #endif
  47. #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
  48. struct sigcontext {
  49. unsigned long sc_mask, sc_usp, sc_d0, sc_d1, sc_a0, sc_a1;
  50. unsigned short sc_sr;
  51. unsigned long sc_pc;
  52. unsigned short sc_formatvec;
  53. unsigned long sc_fpregs[6], sc_fpcntl[3];
  54. unsigned char sc_fpstate[216];
  55. };
  56. typedef int greg_t, gregset_t[18];
  57. typedef struct {
  58. int f_pcr, f_psr, f_fpiaddr, f_fpregs[8][3];
  59. } fpregset_t;
  60. typedef struct {
  61. int version;
  62. gregset_t gregs;
  63. fpregset_t fpregs;
  64. } mcontext_t;
  65. #else
  66. typedef struct {
  67. int __version;
  68. int __gregs[18];
  69. int __fpregs[27];
  70. } mcontext_t;
  71. #endif
  72. struct sigaltstack {
  73. void *ss_sp;
  74. int ss_flags;
  75. size_t ss_size;
  76. };
  77. typedef struct __ucontext {
  78. unsigned long uc_flags;
  79. struct __ucontext *uc_link;
  80. stack_t uc_stack;
  81. mcontext_t uc_mcontext;
  82. long __reserved[80];
  83. sigset_t uc_sigmask;
  84. } ucontext_t;
  85. #define SA_NOCLDSTOP 1
  86. #define SA_NOCLDWAIT 2
  87. #define SA_SIGINFO 4
  88. #define SA_ONSTACK 0x08000000
  89. #define SA_RESTART 0x10000000
  90. #define SA_NODEFER 0x40000000
  91. #define SA_RESETHAND 0x80000000
  92. #define SA_RESTORER 0x04000000
  93. #endif
  94. #define SIGHUP 1
  95. #define SIGINT 2
  96. #define SIGQUIT 3
  97. #define SIGILL 4
  98. #define SIGTRAP 5
  99. #define SIGABRT 6
  100. #define SIGIOT SIGABRT
  101. #define SIGBUS 7
  102. #define SIGFPE 8
  103. #define SIGKILL 9
  104. #define SIGUSR1 10
  105. #define SIGSEGV 11
  106. #define SIGUSR2 12
  107. #define SIGPIPE 13
  108. #define SIGALRM 14
  109. #define SIGTERM 15
  110. #define SIGSTKFLT 16
  111. #define SIGCHLD 17
  112. #define SIGCONT 18
  113. #define SIGSTOP 19
  114. #define SIGTSTP 20
  115. #define SIGTTIN 21
  116. #define SIGTTOU 22
  117. #define SIGURG 23
  118. #define SIGXCPU 24
  119. #define SIGXFSZ 25
  120. #define SIGVTALRM 26
  121. #define SIGPROF 27
  122. #define SIGWINCH 28
  123. #define SIGIO 29
  124. #define SIGPOLL 29
  125. #define SIGPWR 30
  126. #define SIGSYS 31
  127. #define SIGUNUSED SIGSYS
  128. #define _NSIG 65