signal.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. #ifndef __SIGNAL_H
  2. #define __SIGNAL_H
  3. #pragma lib "/$M/lib/ape/libap.a"
  4. typedef int sig_atomic_t;
  5. /*
  6. * We don't give arg types for signal handlers, in spite of ANSI requirement
  7. * that it be 'int' (the signal number), because some programs need an
  8. * additional context argument. So the real type of signal handlers is
  9. * void handler(int sig, char *, struct Ureg *)
  10. * where the char * is the Plan 9 message and Ureg is defined in <ureg.h>
  11. */
  12. #define SIG_DFL ((void (*)())0)
  13. #define SIG_ERR ((void (*)())-1)
  14. #define SIG_IGN ((void (*)())1)
  15. #define SIGHUP 1 /* hangup */
  16. #define SIGINT 2 /* interrupt */
  17. #define SIGQUIT 3 /* quit */
  18. #define SIGILL 4 /* illegal instruction (not reset when caught)*/
  19. #define SIGABRT 5 /* used by abort */
  20. #define SIGFPE 6 /* floating point exception */
  21. #define SIGKILL 7 /* kill (cannot be caught or ignored) */
  22. #define SIGSEGV 8 /* segmentation violation */
  23. #define SIGPIPE 9 /* write on a pipe with no one to read it */
  24. #define SIGALRM 10 /* alarm clock */
  25. #define SIGTERM 11 /* software termination signal from kill */
  26. #define SIGUSR1 12 /* user defined signal 1 */
  27. #define SIGUSR2 13 /* user defined signal 2 */
  28. #define SIGBUS 14 /* bus error */
  29. /* The following symbols must be defined, but the signals needn't be supported */
  30. #define SIGCHLD 15 /* child process terminated or stopped */
  31. #define SIGCONT 16 /* continue if stopped */
  32. #define SIGSTOP 17 /* stop */
  33. #define SIGTSTP 18 /* interactive stop */
  34. #define SIGTTIN 19 /* read from ctl tty by member of background */
  35. #define SIGTTOU 20 /* write to ctl tty by member of background */
  36. #ifdef _BSD_EXTENSION
  37. #define NSIG 21
  38. #endif
  39. #ifdef __cplusplus
  40. extern "C" {
  41. #endif
  42. extern void (*signal(int, void (*)()))();
  43. extern int raise(int);
  44. #ifdef __cplusplus
  45. }
  46. #endif
  47. #ifdef _POSIX_SOURCE
  48. typedef long sigset_t;
  49. struct sigaction {
  50. void (*sa_handler)();
  51. sigset_t sa_mask;
  52. int sa_flags;
  53. };
  54. /* values for sa_flags */
  55. #define SA_NOCLDSTOP 1
  56. /* first argument to sigprocmask */
  57. #define SIG_BLOCK 1
  58. #define SIG_UNBLOCK 2
  59. #define SIG_SETMASK 3
  60. #ifdef __cplusplus
  61. extern "C" {
  62. #endif
  63. #ifdef __TYPES_H
  64. extern int kill(pid_t, int);
  65. #endif
  66. extern int sigemptyset(sigset_t *);
  67. extern int sigfillset(sigset_t *);
  68. extern int sigaddset(sigset_t *, int);
  69. extern int sigdelset(sigset_t *, int);
  70. extern int sigismember(const sigset_t *, int);
  71. extern int sigaction(int, const struct sigaction *, struct sigaction *);
  72. extern int sigprocmask(int, sigset_t *, sigset_t *);
  73. extern int sigpending(sigset_t *);
  74. extern int sigsuspend(const sigset_t *);
  75. #ifdef __cplusplus
  76. }
  77. #endif
  78. #endif /* _POSIX_SOURCE */
  79. #endif /* __SIGNAL_H */