signal.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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 4096
  5. #define SIGSTKSZ 16384
  6. #endif
  7. #if defined(_GNU_SOURCE)
  8. #define LARCH_NGREG 32
  9. #define LARCH_REG_RA 1
  10. #define LARCH_REG_SP 3
  11. #define LARCH_REG_S0 23
  12. #define LARCH_REG_S1 24
  13. #define LARCH_REG_A0 4
  14. #define LARCH_REG_S2 25
  15. #define LARCH_REG_NARGS 8
  16. #endif
  17. #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
  18. typedef unsigned long greg_t, gregset_t[32];
  19. struct sigcontext {
  20. unsigned long sc_pc;
  21. unsigned long sc_regs[32];
  22. unsigned sc_flags;
  23. unsigned long sc_extcontext[] __attribute__((__aligned__(16)));
  24. };
  25. #endif
  26. typedef struct {
  27. unsigned long __pc;
  28. unsigned long __gregs[32];
  29. unsigned __flags;
  30. unsigned long __extcontext[] __attribute__((__aligned__(16)));
  31. } mcontext_t;
  32. struct sigaltstack {
  33. void *ss_sp;
  34. int ss_flags;
  35. size_t ss_size;
  36. };
  37. typedef struct __ucontext
  38. {
  39. unsigned long uc_flags;
  40. struct __ucontext *uc_link;
  41. stack_t uc_stack;
  42. sigset_t uc_sigmask;
  43. long __uc_pad;
  44. mcontext_t uc_mcontext;
  45. } ucontext_t;
  46. #define __uc_flags uc_flags
  47. #define SA_NOCLDSTOP 1
  48. #define SA_NOCLDWAIT 2
  49. #define SA_SIGINFO 4
  50. #define SA_ONSTACK 0x08000000
  51. #define SA_RESTART 0x10000000
  52. #define SA_NODEFER 0x40000000
  53. #define SA_RESETHAND 0x80000000
  54. #endif
  55. #define SIGHUP 1
  56. #define SIGINT 2
  57. #define SIGQUIT 3
  58. #define SIGILL 4
  59. #define SIGTRAP 5
  60. #define SIGABRT 6
  61. #define SIGIOT SIGABRT
  62. #define SIGBUS 7
  63. #define SIGFPE 8
  64. #define SIGKILL 9
  65. #define SIGUSR1 10
  66. #define SIGSEGV 11
  67. #define SIGUSR2 12
  68. #define SIGPIPE 13
  69. #define SIGALRM 14
  70. #define SIGTERM 15
  71. #define SIGSTKFLT 16
  72. #define SIGCHLD 17
  73. #define SIGCONT 18
  74. #define SIGSTOP 19
  75. #define SIGTSTP 20
  76. #define SIGTTIN 21
  77. #define SIGTTOU 22
  78. #define SIGURG 23
  79. #define SIGXCPU 24
  80. #define SIGXFSZ 25
  81. #define SIGVTALRM 26
  82. #define SIGPROF 27
  83. #define SIGWINCH 28
  84. #define SIGIO 29
  85. #define SIGPOLL SIGIO
  86. #define SIGPWR 30
  87. #define SIGSYS 31
  88. #define SIGUNUSED SIGSYS
  89. #define _NSIG 65