blob: 3b708b16adb4f8148409060414718b89c0c0c082 [file] [log] [blame]
Richard Henderson252b5131999-05-03 07:29:11 +00001/* 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 Delorie39423522001-09-26 18:45:50 +00006/*
7
8@deftypefn Supplemental int sigsetmask (int @var{set})
9
10Sets the signal mask to the one provided in @var{set} and returns
11the old mask (which, for libiberty's implementation, will always
12be the value @code{1}).
13
14@end deftypefn
15
16*/
Richard Henderson252b5131999-05-03 07:29:11 +000017
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 Delorie1e45dee2005-03-28 05:07:08 +000024extern void abort (void) ATTRIBUTE_NORETURN;
DJ Delorie74bcd522000-10-12 02:16:48 +000025
Richard Henderson252b5131999-05-03 07:29:11 +000026#ifdef SIG_SETMASK
27int
DJ Delorie1e45dee2005-03-28 05:07:08 +000028sigsetmask (int set)
Richard Henderson252b5131999-05-03 07:29:11 +000029{
DJ Delorieabf6a752005-05-24 21:01:33 +000030 sigset_t new_sig;
31 sigset_t old_sig;
Richard Henderson252b5131999-05-03 07:29:11 +000032
DJ Delorieabf6a752005-05-24 21:01:33 +000033 sigemptyset (&new_sig);
Richard Henderson252b5131999-05-03 07:29:11 +000034 if (set != 0) {
35 abort(); /* FIXME, we don't know how to translate old mask to new */
36 }
DJ Delorieabf6a752005-05-24 21:01:33 +000037 sigprocmask(SIG_SETMASK, &new_sig, &old_sig);
Richard Henderson252b5131999-05-03 07:29:11 +000038 return 1; /* FIXME, we always return 1 as old value. */
39}
40#endif