signal.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /*
  2. * signal.h - signal handling
  3. *
  4. * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  5. * See the copyright notice in the ACK home directory, in the file "Copyright".
  6. */
  7. /* $Header$ */
  8. #ifndef _SIGNAL_HEADER_
  9. #define _SIGNAL_HEADER_
  10. typedef int sig_atomic_t;
  11. #define SIG_ERR (void (*)())-1
  12. #if defined(em22) || defined(em24) || defined(em44)
  13. #define SIG_DFL ((void (*)())-2)
  14. #define SIG_IGN ((void (*)())-3)
  15. #else
  16. #define SIG_DFL ((void (*)())0)
  17. #define SIG_IGN ((void (*)())1)
  18. #endif /* SIG_ERR */
  19. #define SIGHUP 1 /* hangup */
  20. #define SIGINT 2 /* interrupt */
  21. #define SIGQUIT 3 /* quit */
  22. #define SIGILL 4 /* illegal instruction (not reset when caught) */
  23. #define SIGTRAP 5 /* trace trap (not reset when caught) */
  24. #define SIGIOT 6 /* IOT instruction */
  25. #define SIGABRT 6 /* ANSI abort trap */
  26. #define SIGEMT 7 /* EMT instruction */
  27. #define SIGFPE 8 /* floating point exception */
  28. #define SIGKILL 9 /* kill (cannot be caught or ignored) */
  29. #define SIGBUS 10 /* bus error */
  30. #define SIGSEGV 11 /* segmentation violation */
  31. #define SIGSYS 12 /* bad argument to system call */
  32. #define SIGPIPE 13 /* write on a pipe with no one to read it */
  33. #define SIGALRM 14 /* alarm clock */
  34. #define SIGTERM 15 /* software termination signal from kill */
  35. #ifdef __USG
  36. #define SIGUSR1 16 /* user defined signal 1 */
  37. #define SIGUSR2 17 /* user defined signal 2 */
  38. #define SIGCLD 18 /* death of a child */
  39. #define SIGPWR 19 /* power-fail signal */
  40. #define _NSIG 20
  41. #elif defined(__BSD4_2)
  42. #define SIGURG 16 /* urgent condition */
  43. #define SIGSTOP 17 /* stop signal not from tty */
  44. #define SIGTSTP 18 /* stop signal from tty */
  45. #define SIGCONT 19 /* continue a stopped process */
  46. #define SIGCHLD 20 /* death of a child */
  47. #define SIGCLD 20 /* System V compat. */
  48. #define SIGTTIN 21 /* background tty read */
  49. #define SIGTTOU 22 /* background tty write */
  50. #define SIGIO 23 /* I/O possible signal */
  51. #define SIGPOLL SIGIO /* System V compat. */
  52. #define SIGXCPU 24 /* exceeded CPU time limit */
  53. #define SIGXFSZ 25 /* exceeded file size limit */
  54. #define SIGVTALRM 26 /* virtual time alarm */
  55. #define SIGPROF 27 /* profiling time alarm */
  56. #define SIGWINCH 28 /* window has changed */
  57. #define SIGLOST 29 /* resource lost */
  58. #define SIGUSR1 30 /* user defined signal 1 */
  59. #define SIGUSR2 31 /* user defined signal 2 */
  60. #define _NSIG 32
  61. #else
  62. #define _NSIG 16
  63. #endif /* __USG or __BSD4_2 */
  64. #ifdef __BSD4_2
  65. struct sigvec {
  66. int (*sv_handler)(); /* handler */
  67. int sv_mask; /* mask to apply */
  68. int sv_flags;
  69. };
  70. #define SV_ONSTACK 0x0001 /* take signal on signal stack */
  71. #define SV_INTERRUPT 0x0002 /* do not restart system on signal return */
  72. #define SV_RESETHAND 0x0004 /* reset signal handler to SIG_DFL when signal taken */
  73. #define sv_onstack sv_flags /* compat. */
  74. struct sigstack {
  75. char *ss_sp; /* signal stack pointer */
  76. int ss_onstack; /* current status */
  77. };
  78. struct sigcontext {
  79. int sc_onstack; /* sigstack state to restore */
  80. int sc_mask; /* signal mask to restore */
  81. int sc_sp; /* sp to restore */
  82. #ifdef vax
  83. int sc_fp; /* fp to restore */
  84. int sc_ap; /* ap to restore */
  85. #endif /* vax */
  86. int sc_pc; /* pc to retore */
  87. int sc_ps; /* psl to restore */
  88. };
  89. #define BADSIG SIG_ERR /* compat. */
  90. #define sigmask(m) (1 << ((m)-1))
  91. /*
  92. * These are only defined for shutting up the compiler.
  93. */
  94. #ifdef __STDC__
  95. int sigvec(int sig, struct sigvec *vec, struct sigvec *ovec);
  96. int sigstack(struct sigstack *ss, struct sigstack *oss);
  97. int sigblock(int mask);
  98. int sigsetmask(int mask);
  99. int sigpause(int sigmask);
  100. #endif /* __STDC__ */
  101. #endif /* __BSD4_2 */
  102. #ifdef __STDC__
  103. void (*signal(int sig, void (*func)(int)))(int);
  104. int raise(int sig);
  105. #endif /* __STDC__ */
  106. #endif /* _SIGNAL_HEADER_ */