1
0

signal.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #ifndef __SIGNAL_H
  2. #define __SIGNAL_H
  3. #include "errno.h"
  4. #include "sys/types.h"
  5. typedef int sigset_t;
  6. union sigval {
  7. int sival_int;
  8. void *sival_ptr;
  9. };
  10. typedef struct {
  11. int si_signo;
  12. int si_code;
  13. int si_errno;
  14. pid_t si_pid;
  15. uid_t si_uid;
  16. void *si_addr;
  17. int si_status;
  18. long si_band;
  19. union sigval si_value;
  20. } siginfo_t;
  21. struct sigaction {
  22. void (*sa_handler)(int);
  23. sigset_t sa_mask;
  24. int sa_flags;
  25. void (*sa_sigaction)(int, siginfo_t*, void*);
  26. };
  27. #define SA_SIGINFO (1 << 0)
  28. #define SA_RESETHAND (1 << 1)
  29. typedef struct {
  30. int gregs[2];
  31. } mcontext_t;
  32. #define REG_EIP 0
  33. #define REG_EBP 1
  34. typedef struct {
  35. void *ss_sp;
  36. size_t ss_size;
  37. int ss_flags;
  38. } stack_t;
  39. typedef struct ucontext_t {
  40. struct ucontext_t *uc_link;
  41. sigset_t uc_sigmask;
  42. stack_t uc_stack;
  43. mcontext_t uc_mcontext;
  44. } ucontext_t;
  45. int sigemptyset(sigset_t *set) {
  46. *set = 0;
  47. }
  48. int sigaction(int sig, const struct sigaction *act, struct sigaction *oact) {
  49. errno = ENOTIMPL;
  50. return -1;
  51. }
  52. #define SIGFPE 1
  53. #define SIGBUS 2
  54. #define SIGSEGV 3
  55. #define SIGILL 4
  56. #define SIGABRT 5
  57. #define FPE_INTDIV 1
  58. #define FPE_FLTDIV 2
  59. #endif