Cygwin: mmap: allow remapping part of an existing anonymous mapping
[newlib-cygwin.git] / newlib / libc / unix / sigset.c
blob186134956a778d7e77d19d57f6e47ce411d2fd99
1 #ifndef _NO_SIGSET
3 #include <signal.h>
4 #include <errno.h>
6 #if defined(SIG_SETMASK) && NSIG <= 32 /* easier than trying to remove from Makefile */
8 #undef sigemptyset
9 int
10 sigemptyset (sigset_t * set)
12 *set = (sigset_t) 0;
13 return 0;
16 #undef sigfillset
17 int
18 sigfillset (sigset_t * set)
20 *set = ~((sigset_t) 0);
21 return 0;
24 #undef sigaddset
25 int
26 sigaddset (sigset_t * set, int signo)
28 if (signo >= NSIG || signo <= 0)
30 errno = EINVAL;
31 return -1;
33 *set |= 1 << (signo - 1);
34 return 0;
37 #undef sigdelset
38 int
39 sigdelset (sigset_t * set, int signo)
41 if (signo >= NSIG || signo <= 0)
43 errno = EINVAL;
44 return -1;
46 *set &= ~(1 << (signo - 1));
47 return 0;
50 #undef sigismember
51 int
52 sigismember (const sigset_t * set, int signo)
54 if (signo >= NSIG || signo <= 0)
56 errno = EINVAL;
57 return -1;
60 if (*set & (1 << (signo - 1)))
61 return 1;
62 else
63 return 0;
66 #endif /* SIG_SETMASK */
67 #endif /* _NO_SIGSET */