sigsetmask.c 902 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /* Version of sigsetmask.c
  2. Written by Steve Chamberlain (sac@cygnus.com).
  3. Contributed by Cygnus Support.
  4. This file is in the public doamin. */
  5. /*
  6. @deftypefn Supplemental int sigsetmask (int @var{set})
  7. Sets the signal mask to the one provided in @var{set} and returns
  8. the old mask (which, for libiberty's implementation, will always
  9. be the value @code{1}).
  10. @end deftypefn
  11. */
  12. #include <ansidecl.h>
  13. /* Including <sys/types.h> seems to be needed by ISC. */
  14. #include <sys/types.h>
  15. #include <signal.h>
  16. extern void abort (void) ATTRIBUTE_NORETURN;
  17. #ifdef SIG_SETMASK
  18. int
  19. sigsetmask (int set)
  20. {
  21. sigset_t new_sig;
  22. sigset_t old_sig;
  23. sigemptyset (&new_sig);
  24. if (set != 0) {
  25. abort(); /* FIXME, we don't know how to translate old mask to new */
  26. }
  27. sigprocmask(SIG_SETMASK, &new_sig, &old_sig);
  28. return 1; /* FIXME, we always return 1 as old value. */
  29. }
  30. #endif