merge from gcc
[deliverable/binutils-gdb.git] / libiberty / sigsetmask.c
CommitLineData
252b5132
RH
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
39423523
DD
6/*
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*/
252b5132
RH
17
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
1e45deed 24extern void abort (void) ATTRIBUTE_NORETURN;
74bcd529 25
252b5132
RH
26#ifdef SIG_SETMASK
27int
1e45deed 28sigsetmask (int set)
252b5132 29{
abf6a75b
DD
30 sigset_t new_sig;
31 sigset_t old_sig;
252b5132 32
abf6a75b 33 sigemptyset (&new_sig);
252b5132
RH
34 if (set != 0) {
35 abort(); /* FIXME, we don't know how to translate old mask to new */
36 }
abf6a75b 37 sigprocmask(SIG_SETMASK, &new_sig, &old_sig);
252b5132
RH
38 return 1; /* FIXME, we always return 1 as old value. */
39}
40#endif
This page took 0.615704 seconds and 4 git commands to generate.