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