fixes for host gcc 4.6.1
[zpugcc/jano.git] / toolchain / gcc / newlib / libc / unix / sigset.c
blobcd73a78c844eb6ed3466b68d3036dcc94944f6c6
1 #include <signal.h>
2 #include <errno.h>
4 #if defined(SIG_SETMASK) && NSIG <= 32 /* easier than trying to remove from Makefile */
6 #undef sigemptyset
7 int
8 sigemptyset (sigset_t * set)
10 *set = (sigset_t) 0;
11 return 0;
14 int
15 sigfillset (sigset_t * set)
17 *set = ~((sigset_t) 0);
18 return 0;
21 #undef sigaddset
22 int
23 sigaddset (sigset_t * set, int signo)
25 if (signo >= NSIG || signo <= 0)
27 errno = EINVAL;
28 return -1;
30 *set |= 1 << (signo - 1);
31 return 0;
34 int
35 sigdelset (sigset_t * set, int signo)
37 if (signo >= NSIG || signo <= 0)
39 errno = EINVAL;
40 return -1;
42 *set &= ~(1 << (signo - 1));
43 return 0;
46 int
47 sigismember (const sigset_t * set, int signo)
49 if (signo >= NSIG || signo <= 0)
51 errno = EINVAL;
52 return -1;
55 if (*set & (1 << (signo - 1)))
56 return 1;
57 else
58 return 0;
61 #endif /* SIG_SETMASK */