signal.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. /* Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3. The GNU C Library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Library General Public License as
  5. published by the Free Software Foundation; either version 2 of the
  6. License, or (at your option) any later version.
  7. The GNU C Library is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. Library General Public License for more details.
  11. You should have received a copy of the GNU Library General Public
  12. License along with the GNU C Library; see the file COPYING.LIB. If
  13. not, write to the, 1992 Free Software Foundation, Inc., 675 Mass Ave,
  14. Cambridge, MA 02139, USA. */
  15. /*
  16. * ANSI Standard: 4.7 SIGNAL HANDLING <signal.h>
  17. */
  18. #ifndef _SIGNAL_H
  19. #define _SIGNAL_H
  20. #include <features.h>
  21. #include <sys/types.h>
  22. #include <linux/signal.h>
  23. #ifndef SIGCLD
  24. #define SIGCLD SIGCHLD
  25. #endif
  26. /* SVR4 */
  27. #ifndef SA_RESETHAND
  28. #define SA_RESETHAND SA_ONESHOT
  29. #endif
  30. /* SVR4 */
  31. #ifndef SA_NODEFER
  32. #define SA_NODEFER SA_NOMASK
  33. #endif
  34. typedef int sig_atomic_t;
  35. typedef __sighandler_t SignalHandler;
  36. #ifndef BADSIG
  37. #define BADSIG SIG_ERR
  38. #endif
  39. /* The Interviews version also has these ... */
  40. #define SignalBad ((SignalHandler)-1)
  41. #define SignalDefault ((SignalHandler)0)
  42. #define SignalIgnore ((SignalHandler)1)
  43. __BEGIN_DECLS
  44. extern __const char * __const sys_siglist[];
  45. extern __const char * __const _sys_siglist[];
  46. extern __sighandler_t
  47. signal __P ((int __sig, __sighandler_t));
  48. extern __sighandler_t
  49. __signal __P ((int __sig, __sighandler_t, int flags));
  50. extern int raise __P ((int __sig));
  51. extern int __kill __P ((pid_t __pid, int __sig));
  52. extern int kill __P ((pid_t __pid, int __sig));
  53. extern int killpg __P ((int __pgrp, int __sig));
  54. extern int sigaddset __P ((sigset_t *__mask, int __sig));
  55. extern int sigdelset __P ((sigset_t *__mask, int __sig));
  56. extern int sigemptyset __P ((sigset_t *__mask));
  57. extern int sigfillset __P ((sigset_t *__mask));
  58. extern int sigismember __P ((__const sigset_t *__mask, int __sig));
  59. extern int sigpending __P ((sigset_t *__set));
  60. extern int __sigprocmask __P ((int __how, __const sigset_t *__set,
  61. sigset_t *__oldset));
  62. extern int sigprocmask __P ((int __how, __const sigset_t *__set,
  63. sigset_t *__oldset));
  64. extern int sigsuspend __P ((__const sigset_t *sigmask));
  65. extern int __sigaction __P ((int __sig, struct sigaction *__act,
  66. struct sigaction *__oldact));
  67. extern int sigaction __P ((int __sig, struct sigaction *__act,
  68. struct sigaction *__oldact));
  69. #define __sigemptyset(set) ((*(set) = 0L), 0)
  70. #define __sigfillset(set) ((*(set) = -1L), 0)
  71. #define __sigaddset(set, sig) ((*(set) |= __sigmask (sig)), 0)
  72. #define __sigdelset(set, sig) ((*(set) &= ~__sigmask (sig)), 0)
  73. #define __sigismember(set, sig) ((*(set) & __sigmask (sig)) ? 1 : 0)
  74. #if 1
  75. #define sigemptyset __sigemptyset
  76. #define sigfillset __sigfillset
  77. /* We don't do that any more since it causes problems due to
  78. * "sig" > _NSIG and "sig" < 1. It isn't worth the touble to make
  79. * them inline and static. Use __sigxxxxx if you want speed with
  80. * correct "sig".
  81. */
  82. #if 1
  83. #define sigaddset __sigaddset
  84. #define sigdelset __sigdelset
  85. #define sigismember __sigismember
  86. #endif
  87. #endif
  88. /* Return a mask that includes SIG only. */
  89. #define __sigmask(sig) (1 << ((sig) - 1))
  90. extern int __sigsetmask __P ((int __mask));
  91. extern int __siggetmask __P ((void));
  92. extern int __sigblock __P ((int __mask));
  93. extern int __sigpause __P ((int __mask));
  94. #ifdef __USE_SVID
  95. /* SVID names for the same things. */
  96. extern __sighandler_t ssignal __P ((int __sig, __sighandler_t __handler));
  97. extern int gsignal __P ((int __sig));
  98. #endif /* Use SVID. */
  99. /* BSD */
  100. #ifdef __USE_BSD
  101. #define sigmask __sigmask
  102. extern int sigblock __P ((int __mask));
  103. extern int sigpause __P ((int __mask));
  104. extern int sigsetmask __P ((int __mask));
  105. extern int siggetmask __P ((void));
  106. extern void psignal __P ((int __sig, __const char *__str));
  107. extern int siginterrupt __P ((int __sig, int __flag));
  108. /* The `sig' bit is set if the interrupt on it
  109. * is enabled via siginterrupt (). */
  110. extern sigset_t _sigintr;
  111. #endif /* Use BSD. */
  112. #ifdef __USE_BSD_SIGNAL
  113. extern __sighandler_t
  114. __bsd_signal __P ((int __sig, __sighandler_t));
  115. #define signal __bsd_signal
  116. #endif /* __USE_BSD_SIGNAL */
  117. __END_DECLS
  118. #if _MIT_POSIX_THREADS
  119. #define __SIGFILLSET 0xffffffff
  120. #define __SIGEMPTYSET 0
  121. #define __SIGADDSET(s,n) ((*s) |= (1 << ((n) - 1)))
  122. #define __SIGDELSET(s,n) ((*s) &= ~(1 << ((n) - 1)))
  123. #define __SIGISMEMBER(s,n) ((*s) & (1 << ((n) - 1)))
  124. #endif
  125. #endif /* _SIGNAL_H */