signal.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /*
  2. * Copyright (c) 1982, 1986, 1989, 1991, 1993
  3. * The Regents of the University of California. All rights reserved.
  4. * (c) UNIX System Laboratories, Inc.
  5. * All or some portions of this file are derived from material licensed
  6. * to the University of California by American Telephone and Telegraph
  7. * Co. or Unix System Laboratories, Inc. and are reproduced herein with
  8. * the permission of UNIX System Laboratories, Inc.
  9. *
  10. * Redistribution and use in source and binary forms, with or without
  11. * modification, are permitted provided that the following conditions
  12. * are met:
  13. * 1. Redistributions of source code must retain the above copyright
  14. * notice, this list of conditions and the following disclaimer.
  15. * 2. Redistributions in binary form must reproduce the above copyright
  16. * notice, this list of conditions and the following disclaimer in the
  17. * documentation and/or other materials provided with the distribution.
  18. * 3. Neither the name of the University nor the names of its contributors
  19. * may be used to endorse or promote products derived from this software
  20. * without specific prior written permission.
  21. *
  22. * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  23. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  24. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  25. * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  26. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  27. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  28. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  29. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  30. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  31. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  32. * SUCH DAMAGE.
  33. *
  34. * @(#)signal.h 8.4 (Berkeley) 5/4/95
  35. */
  36. #ifndef _KERN_SIGNAL_H_
  37. #define _KERN_SIGNAL_H_
  38. /*
  39. * Machine-independent definitions for signals.
  40. */
  41. /*
  42. * The signals.
  43. *
  44. * The values of many of these are "well known", particularly 1, 9,
  45. * 10, and 11.
  46. *
  47. * Note that Unix signals are a semantic cesspool; many have special
  48. * properties or are supposed to interact with the system in special
  49. * ways. It is gross.
  50. */
  51. #define SIGHUP 1 /* Hangup */
  52. #define SIGINT 2 /* Interrupt (^C) */
  53. #define SIGQUIT 3 /* Quit (typically ^\) */
  54. #define SIGILL 4 /* Illegal instruction */
  55. #define SIGTRAP 5 /* Breakpoint trap */
  56. #define SIGABRT 6 /* abort() call */
  57. #define SIGEMT 7 /* Emulator trap */
  58. #define SIGFPE 8 /* Floating point exception */
  59. #define SIGKILL 9 /* Hard kill (unblockable) */
  60. #define SIGBUS 10 /* Bus error, typically bad pointer alignment*/
  61. #define SIGSEGV 11 /* Segmentation fault */
  62. #define SIGSYS 12 /* Bad system call */
  63. #define SIGPIPE 13 /* Broken pipe */
  64. #define SIGALRM 14 /* alarm() expired */
  65. #define SIGTERM 15 /* Termination requested (default kill) */
  66. #define SIGURG 16 /* Urgent data on socket */
  67. #define SIGSTOP 17 /* Hard process stop (unblockable) */
  68. #define SIGTSTP 18 /* Terminal stop (^Z) */
  69. #define SIGCONT 19 /* Time to continue after stop */
  70. #define SIGCHLD 20 /* Child process exited */
  71. #define SIGTTIN 21 /* Stop on tty read while in background */
  72. #define SIGTTOU 22 /* Stop on tty write while in background */
  73. #define SIGIO 23 /* Nonblocking or async I/O is now ready */
  74. #define SIGXCPU 24 /* CPU time resource limit exceeded */
  75. #define SIGXFSZ 25 /* File size resource limit exceeded */
  76. #define SIGVTALRM 26 /* Like SIGALRM but in virtual time */
  77. #define SIGPROF 27 /* Profiling timer */
  78. #define SIGWINCH 28 /* Window size change on tty */
  79. #define SIGINFO 29 /* Information request (typically ^T) */
  80. #define SIGUSR1 20 /* Application-defined */
  81. #define SIGUSR2 31 /* Application-defined */
  82. #define SIGPWR 32 /* Power failure */
  83. #define _NSIG 32
  84. /* Type for a set of signals; used by e.g. sigprocmask(). */
  85. typedef __u32 sigset_t;
  86. /* flags for sigaction.sa_flags */
  87. #define SA_ONSTACK 1 /* Use sigaltstack() stack. */
  88. #define SA_RESTART 2 /* Restart syscall instead of interrupting. */
  89. #define SA_RESETHAND 4 /* Clear handler after one usage. */
  90. /* codes for sigprocmask() */
  91. #define SIG_BLOCK 1 /* Block selected signals. */
  92. #define SIG_UNBLOCK 2 /* Unblock selected signals. */
  93. #define SIG_SETMASK 3 /* Set mask to the selected signals. */
  94. /* Type for a signal handler function. */
  95. typedef void (*__sigfunc)(int);
  96. /* Magic values for signal handlers. */
  97. #define SIG_DFL ((__sigfunc) 0) /* Default behavior. */
  98. #define SIG_IGN ((__sigfunc) 1) /* Ignore the signal. */
  99. /*
  100. * Struct for sigaction().
  101. */
  102. struct sigaction {
  103. __sigfunc sa_handler;
  104. sigset_t sa_mask;
  105. unsigned sa_flags;
  106. };
  107. /*
  108. * Struct for sigaltstack().
  109. * (not very important)
  110. */
  111. struct sigaltstack {
  112. void *ss_sp;
  113. size_t ss_size;
  114. unsigned ss_flags;
  115. };
  116. #endif /* _KERN_SIGNAL_H_ */