Back to index

cell-binutils  2.17cvs20070401
sigsetmask.c
Go to the documentation of this file.
00001 /* Version of sigsetmask.c
00002    Written by Steve Chamberlain (sac@cygnus.com).
00003    Contributed by Cygnus Support.
00004    This file is in the public doamin. */
00005 
00006 /*
00007 
00008 @deftypefn Supplemental int sigsetmask (int @var{set})
00009 
00010 Sets the signal mask to the one provided in @var{set} and returns
00011 the old mask (which, for libiberty's implementation, will always
00012 be the value @code{1}).
00013 
00014 @end deftypefn
00015 
00016 */
00017 
00018 #define _POSIX_SOURCE
00019 #include <ansidecl.h>
00020 /* Including <sys/types.h> seems to be needed by ISC. */
00021 #include <sys/types.h>
00022 #include <signal.h>
00023 
00024 extern void abort (void) ATTRIBUTE_NORETURN;
00025 
00026 #ifdef SIG_SETMASK
00027 int
00028 sigsetmask (int set)
00029 {
00030     sigset_t new_sig;
00031     sigset_t old_sig;
00032     
00033     sigemptyset (&new_sig);
00034     if (set != 0) {
00035       abort();       /* FIXME, we don't know how to translate old mask to new */
00036     }
00037     sigprocmask(SIG_SETMASK, &new_sig, &old_sig);
00038     return 1; /* FIXME, we always return 1 as old value.  */
00039 }
00040 #endif