signal.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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. #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 SIGIO
  101. #define SIGPWR 30
  102. #define SIGSYS 31
  103. #define SIGUNUSED SIGSYS
  104. #define _NSIG 65