1
0

signal.h 2.4 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. typedef unsigned long __riscv_mc_gp_state[32];
  8. struct __riscv_mc_f_ext_state {
  9. unsigned int __f[32];
  10. unsigned int __fcsr;
  11. };
  12. struct __riscv_mc_d_ext_state {
  13. unsigned long long __f[32];
  14. unsigned int __fcsr;
  15. };
  16. struct __riscv_mc_q_ext_state {
  17. unsigned long long __f[64] __attribute__((__aligned__(16)));
  18. unsigned int __fcsr;
  19. unsigned int __reserved[3];
  20. };
  21. union __riscv_mc_fp_state {
  22. struct __riscv_mc_f_ext_state __f;
  23. struct __riscv_mc_d_ext_state __d;
  24. struct __riscv_mc_q_ext_state __q;
  25. };
  26. typedef struct mcontext_t {
  27. __riscv_mc_gp_state __gregs;
  28. union __riscv_mc_fp_state __fpregs;
  29. } mcontext_t;
  30. #if defined(_GNU_SOURCE)
  31. #define REG_PC 0
  32. #define REG_RA 1
  33. #define REG_SP 2
  34. #define REG_TP 4
  35. #define REG_S0 8
  36. #define REG_S1 9
  37. #define REG_A0 10
  38. #define REG_S2 18
  39. #endif
  40. #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
  41. typedef unsigned long greg_t;
  42. typedef unsigned long gregset_t[32];
  43. typedef union __riscv_mc_fp_state fpregset_t;
  44. struct sigcontext {
  45. gregset_t gregs;
  46. fpregset_t fpregs;
  47. };
  48. #endif
  49. struct sigaltstack {
  50. void *ss_sp;
  51. int ss_flags;
  52. size_t ss_size;
  53. };
  54. typedef struct __ucontext
  55. {
  56. unsigned long uc_flags;
  57. struct __ucontext *uc_link;
  58. stack_t uc_stack;
  59. sigset_t uc_sigmask;
  60. mcontext_t uc_mcontext;
  61. } ucontext_t;
  62. #define SA_NOCLDSTOP 1
  63. #define SA_NOCLDWAIT 2
  64. #define SA_SIGINFO 4
  65. #define SA_ONSTACK 0x08000000
  66. #define SA_RESTART 0x10000000
  67. #define SA_NODEFER 0x40000000
  68. #define SA_RESETHAND 0x80000000
  69. #define SA_RESTORER 0x04000000
  70. #endif
  71. #define SIGHUP 1
  72. #define SIGINT 2
  73. #define SIGQUIT 3
  74. #define SIGILL 4
  75. #define SIGTRAP 5
  76. #define SIGABRT 6
  77. #define SIGIOT SIGABRT
  78. #define SIGBUS 7
  79. #define SIGFPE 8
  80. #define SIGKILL 9
  81. #define SIGUSR1 10
  82. #define SIGSEGV 11
  83. #define SIGUSR2 12
  84. #define SIGPIPE 13
  85. #define SIGALRM 14
  86. #define SIGTERM 15
  87. #define SIGSTKFLT 16
  88. #define SIGCHLD 17
  89. #define SIGCONT 18
  90. #define SIGSTOP 19
  91. #define SIGTSTP 20
  92. #define SIGTTIN 21
  93. #define SIGTTOU 22
  94. #define SIGURG 23
  95. #define SIGXCPU 24
  96. #define SIGXFSZ 25
  97. #define SIGVTALRM 26
  98. #define SIGPROF 27
  99. #define SIGWINCH 28
  100. #define SIGIO 29
  101. #define SIGPOLL SIGIO
  102. #define SIGPWR 30
  103. #define SIGSYS 31
  104. #define SIGUNUSED SIGSYS
  105. #define _NSIG 65