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