signal.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
  2. || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)
  3. struct __fpstate {
  4. unsigned long __x[7];
  5. unsigned char __y[80];
  6. unsigned long __z;
  7. };
  8. typedef struct {
  9. unsigned long __gregs[19];
  10. void *__fpregs;
  11. unsigned long __oldmask, __cr2;
  12. } mcontext_t;
  13. typedef struct __ucontext {
  14. unsigned long uc_flags;
  15. struct __ucontext *uc_link;
  16. stack_t uc_stack;
  17. mcontext_t uc_mcontext;
  18. sigset_t uc_sigmask;
  19. struct __fpstate __fpregs_mem;
  20. } ucontext_t;
  21. #ifdef _GNU_SOURCE
  22. struct sigcontext {
  23. unsigned short gs, __gsh, fs, __fsh, es, __esh, ds, __dsh;
  24. unsigned long edi, esi, ebp, esp, ebx, edx, ecx, eax;
  25. unsigned long trapno, err, eip;
  26. unsigned short cs, __csh;
  27. unsigned long eflags, esp_at_signal;
  28. unsigned short ss, __ssh;
  29. struct __fpstate *fpstate;
  30. unsigned long oldmask, cr2;
  31. };
  32. #endif
  33. struct __siginfo
  34. {
  35. int si_signo;
  36. int si_errno;
  37. int si_code;
  38. union
  39. {
  40. char __pad[128 - 3*sizeof(int)];
  41. struct {
  42. pid_t si_pid;
  43. uid_t si_uid;
  44. union sigval si_sigval;
  45. } __rt;
  46. struct {
  47. unsigned int si_timer1;
  48. unsigned int si_timer2;
  49. } __timer;
  50. struct {
  51. pid_t si_pid;
  52. uid_t si_uid;
  53. int si_status;
  54. clock_t si_utime;
  55. clock_t si_stime;
  56. } __sigchld;
  57. struct {
  58. void *si_addr;
  59. } __sigfault;
  60. struct {
  61. long int si_band;
  62. int si_fd;
  63. } __sigpoll;
  64. } __si_fields;
  65. };
  66. #define si_pid __si_fields.__sigchld.si_pid
  67. #define si_uid __si_fields.__sigchld.si_uid
  68. #define si_status __si_fields.__sigchld.si_status
  69. #define si_utime __si_fields.__sigchld.si_utime
  70. #define si_stime __si_fields.__sigchld.si_stime
  71. #define si_value __si_fields.__rt.si_sigval
  72. #define si_addr __si_fields.__sigfault.si_addr
  73. #define si_band __si_fields.__sigpoll.si_band
  74. #define SA_NOCLDSTOP 1
  75. #define SA_NOCLDWAIT 2
  76. #define SA_SIGINFO 4
  77. #define SA_ONSTACK 0x08000000
  78. #define SA_RESTART 0x10000000
  79. #define SA_NODEFER 0x40000000
  80. #define SA_RESETHAND 0x80000000
  81. #define SA_RESTORER 0x04000000
  82. #define SS_ONSTACK 1
  83. #define SS_DISABLE 2
  84. #define SIG_BLOCK 0
  85. #define SIG_UNBLOCK 1
  86. #define SIG_SETMASK 2
  87. #define SIG_HOLD ((void (*)(int)) 2)
  88. #endif
  89. #ifdef _GNU_SOURCE
  90. #define NSIG 64
  91. #endif
  92. #define SIG_ERR ((void (*)(int))-1)
  93. #define SIG_DFL ((void (*)(int)) 0)
  94. #define SIG_IGN ((void (*)(int)) 1)
  95. #define SIGHUP 1
  96. #define SIGINT 2
  97. #define SIGQUIT 3
  98. #define SIGILL 4
  99. #define SIGTRAP 5
  100. #define SIGABRT 6
  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