xref: /haiku/src/libs/stdc++/legacy/sigsetmask.c (revision 16d5c24e533eb14b7b8a99ee9f3ec9ba66335b1e)
1*16d5c24eSOliver Tappe /* Version of sigsetmask.c
2*16d5c24eSOliver Tappe    Written by Steve Chamberlain (sac@cygnus.com).
3*16d5c24eSOliver Tappe    Contributed by Cygnus Support.
4*16d5c24eSOliver Tappe    This file is in the public doamin. */
5*16d5c24eSOliver Tappe 
6*16d5c24eSOliver Tappe /* Set the current signal mask to the set provided, and return the
7*16d5c24eSOliver Tappe    previous value */
8*16d5c24eSOliver Tappe 
9*16d5c24eSOliver Tappe #define _POSIX_SOURCE
10*16d5c24eSOliver Tappe #include <ansidecl.h>
11*16d5c24eSOliver Tappe /* Including <sys/types.h> seems to be needed by ISC. */
12*16d5c24eSOliver Tappe #include <sys/types.h>
13*16d5c24eSOliver Tappe #include <signal.h>
14*16d5c24eSOliver Tappe 
15*16d5c24eSOliver Tappe #ifdef SIG_SETMASK
16*16d5c24eSOliver Tappe int
17*16d5c24eSOliver Tappe DEFUN(sigsetmask,(set),
18*16d5c24eSOliver Tappe       int set)
19*16d5c24eSOliver Tappe {
20*16d5c24eSOliver Tappe     sigset_t new;
21*16d5c24eSOliver Tappe     sigset_t old;
22*16d5c24eSOliver Tappe 
23*16d5c24eSOliver Tappe     sigemptyset (&new);
24*16d5c24eSOliver Tappe     if (set != 0) {
25*16d5c24eSOliver Tappe       abort();	/* FIXME, we don't know how to translate old mask to new */
26*16d5c24eSOliver Tappe     }
27*16d5c24eSOliver Tappe     sigprocmask(SIG_SETMASK, &new, &old);
28*16d5c24eSOliver Tappe     return 1;	/* FIXME, we always return 1 as old value.  */
29*16d5c24eSOliver Tappe }
30*16d5c24eSOliver Tappe #endif
31