xref: /openbsd-src/gnu/lib/libiberty/src/sigsetmask.c (revision 150b7e42cfa21e6546d96ae514ca23e80d970ac7)
100bf4279Sespie /* Version of sigsetmask.c
200bf4279Sespie    Written by Steve Chamberlain (sac@cygnus.com).
300bf4279Sespie    Contributed by Cygnus Support.
400bf4279Sespie    This file is in the public doamin. */
500bf4279Sespie 
637c53322Sespie /*
737c53322Sespie 
837c53322Sespie @deftypefn Supplemental int sigsetmask (int @var{set})
937c53322Sespie 
1037c53322Sespie Sets the signal mask to the one provided in @var{set} and returns
1137c53322Sespie the old mask (which, for libiberty's implementation, will always
1237c53322Sespie be the value @code{1}).
1337c53322Sespie 
1437c53322Sespie @end deftypefn
1537c53322Sespie 
1637c53322Sespie */
1700bf4279Sespie 
1800bf4279Sespie #define _POSIX_SOURCE
1900bf4279Sespie #include <ansidecl.h>
2000bf4279Sespie /* Including <sys/types.h> seems to be needed by ISC. */
2100bf4279Sespie #include <sys/types.h>
2200bf4279Sespie #include <signal.h>
2300bf4279Sespie 
24*150b7e42Smiod extern void abort (void) ATTRIBUTE_NORETURN;
25f5dd06f4Sespie 
2600bf4279Sespie #ifdef SIG_SETMASK
2700bf4279Sespie int
sigsetmask(int set)28*150b7e42Smiod sigsetmask (int set)
2900bf4279Sespie {
30*150b7e42Smiod     sigset_t new_sig;
31*150b7e42Smiod     sigset_t old_sig;
3200bf4279Sespie 
33*150b7e42Smiod     sigemptyset (&new_sig);
3400bf4279Sespie     if (set != 0) {
3500bf4279Sespie       abort();	/* FIXME, we don't know how to translate old mask to new */
3600bf4279Sespie     }
37*150b7e42Smiod     sigprocmask(SIG_SETMASK, &new_sig, &old_sig);
3800bf4279Sespie     return 1;	/* FIXME, we always return 1 as old value.  */
3900bf4279Sespie }
4000bf4279Sespie #endif
41