]>
Commit | Line | Data |
---|---|---|
28e9041c | 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 | ||
614a23c6 | 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 | */ | |
28e9041c | 17 | |
28e9041c | 18 | #include <ansidecl.h> |
19 | /* Including <sys/types.h> seems to be needed by ISC. */ | |
20 | #include <sys/types.h> | |
21 | #include <signal.h> | |
22 | ||
f8d9d6a0 | 23 | extern void abort (void) ATTRIBUTE_NORETURN; |
bb37062f | 24 | |
28e9041c | 25 | #ifdef SIG_SETMASK |
26 | int | |
f8d9d6a0 | 27 | sigsetmask (int set) |
28e9041c | 28 | { |
f2d737fc | 29 | sigset_t new_sig; |
30 | sigset_t old_sig; | |
28e9041c | 31 | |
f2d737fc | 32 | sigemptyset (&new_sig); |
28e9041c | 33 | if (set != 0) { |
34 | abort(); /* FIXME, we don't know how to translate old mask to new */ | |
35 | } | |
f2d737fc | 36 | sigprocmask(SIG_SETMASK, &new_sig, &old_sig); |
28e9041c | 37 | return 1; /* FIXME, we always return 1 as old value. */ |
38 | } | |
39 | #endif |