sigset.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /* __sig_atomic_t, __sigset_t, and related definitions. Linux version.
  2. Copyright (C) 1991, 1992, 1994, 1996, 1997 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Library General Public License as
  6. published by the Free Software Foundation; either version 2 of the
  7. License, or (at your option) any later version.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Library General Public License for more details.
  12. You should have received a copy of the GNU Library General Public
  13. License along with the GNU C Library; see the file COPYING.LIB. If not,
  14. write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  15. Boston, MA 02111-1307, USA. */
  16. #ifndef _SIGSET_H_types
  17. # define _SIGSET_H_types 1
  18. typedef int __sig_atomic_t;
  19. /* A `sigset_t' has a bit for each signal. */
  20. typedef unsigned long __sigset_t;
  21. #endif
  22. /* We only want to define these functions if <signal.h> was actually
  23. included; otherwise we were included just to define the types. Since we
  24. are namespace-clean, it wouldn't hurt to define extra macros. But
  25. trouble can be caused by functions being defined (e.g., any global
  26. register vars declared later will cause compilation errors). */
  27. #if !defined _SIGSET_H_fns && defined _SIGNAL_H
  28. # define _SIGSET_H_fns 1
  29. # ifndef _EXTERN_INLINE
  30. # define _EXTERN_INLINE extern __inline
  31. # endif
  32. /* Return a mask that includes the bit for SIG only. */
  33. # define __sigmask(sig) (1L << ((sig) - 1))
  34. # if defined __GNUC__ && __GNUC__ >= 2
  35. # define __sigemptyset(set) (*(set) = 0)
  36. # define __sigfillset(set) (*(set) = ~0)
  37. # ifdef __USE_GNU
  38. /* The POSIX does not specify for handling the whole signal set in one
  39. command. This is often wanted and so we define three more functions
  40. here. */
  41. # define __sigisemptyset(set) (*(set) == 0)
  42. # define __sigandset(dest, left, right) (*(dest) = *(left) & *(right))
  43. # define __sigorset(dest, left, right) (*(dest) = *(left) | *(right))
  44. # endif
  45. # endif
  46. /* These functions needn't check for a bogus signal number -- error
  47. checking is done in the non __ versions. */
  48. # define __sigismember(set, sig) (*(set) & (1L << ((sig)-1)))
  49. # define __sigaddset(set, sig) (*(set) |= (1L << ((sig)-1)))
  50. # define __sigdelset(set, sig) (*(set) &= ~(1L << ((sig)-1)))
  51. #endif /* ! _SIGSET_H_fns. */