Richard Henderson | 252b513 | 1999-05-03 07:29:11 +0000 | [diff] [blame] | 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 | |
DJ Delorie | 3942352 | 2001-09-26 18:45:50 +0000 | [diff] [blame] | 6 | /* |
| 7 | |
| 8 | @deftypefn Supplemental int sigsetmask (int @var{set}) |
| 9 | |
| 10 | Sets the signal mask to the one provided in @var{set} and returns |
| 11 | the old mask (which, for libiberty's implementation, will always |
| 12 | be the value @code{1}). |
| 13 | |
| 14 | @end deftypefn |
| 15 | |
| 16 | */ |
Richard Henderson | 252b513 | 1999-05-03 07:29:11 +0000 | [diff] [blame] | 17 | |
| 18 | #define _POSIX_SOURCE |
| 19 | #include <ansidecl.h> |
| 20 | /* Including <sys/types.h> seems to be needed by ISC. */ |
| 21 | #include <sys/types.h> |
| 22 | #include <signal.h> |
| 23 | |
DJ Delorie | 1e45dee | 2005-03-28 05:07:08 +0000 | [diff] [blame] | 24 | extern void abort (void) ATTRIBUTE_NORETURN; |
DJ Delorie | 74bcd52 | 2000-10-12 02:16:48 +0000 | [diff] [blame] | 25 | |
Richard Henderson | 252b513 | 1999-05-03 07:29:11 +0000 | [diff] [blame] | 26 | #ifdef SIG_SETMASK |
| 27 | int |
DJ Delorie | 1e45dee | 2005-03-28 05:07:08 +0000 | [diff] [blame] | 28 | sigsetmask (int set) |
Richard Henderson | 252b513 | 1999-05-03 07:29:11 +0000 | [diff] [blame] | 29 | { |
DJ Delorie | abf6a75 | 2005-05-24 21:01:33 +0000 | [diff] [blame] | 30 | sigset_t new_sig; |
| 31 | sigset_t old_sig; |
Richard Henderson | 252b513 | 1999-05-03 07:29:11 +0000 | [diff] [blame] | 32 | |
DJ Delorie | abf6a75 | 2005-05-24 21:01:33 +0000 | [diff] [blame] | 33 | sigemptyset (&new_sig); |
Richard Henderson | 252b513 | 1999-05-03 07:29:11 +0000 | [diff] [blame] | 34 | if (set != 0) { |
| 35 | abort(); /* FIXME, we don't know how to translate old mask to new */ |
| 36 | } |
DJ Delorie | abf6a75 | 2005-05-24 21:01:33 +0000 | [diff] [blame] | 37 | sigprocmask(SIG_SETMASK, &new_sig, &old_sig); |
Richard Henderson | 252b513 | 1999-05-03 07:29:11 +0000 | [diff] [blame] | 38 | return 1; /* FIXME, we always return 1 as old value. */ |
| 39 | } |
| 40 | #endif |