source: trunk/libs/newlib/src/newlib/libc/unix/sigset.c @ 559

Last change on this file since 559 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 996 bytes
Line 
1#ifndef _NO_SIGSET
2
3#include <signal.h>
4#include <errno.h>
5
6#if defined(SIG_SETMASK) && NSIG <= 32  /* easier than trying to remove from Makefile */
7
8#undef sigemptyset
9int
10sigemptyset (sigset_t * set)
11{
12  *set = (sigset_t) 0;
13  return 0;
14}
15
16#undef sigfillset
17int
18sigfillset (sigset_t * set)
19{
20  *set = ~((sigset_t) 0);
21  return 0;
22}
23
24#undef sigaddset
25int
26sigaddset (sigset_t * set, int signo)
27{
28  if (signo >= NSIG || signo <= 0)
29    {
30      errno = EINVAL;
31      return -1;
32    }
33  *set |= 1 << (signo - 1);
34  return 0;
35}
36
37#undef sigdelset
38int
39sigdelset (sigset_t * set, int signo)
40{
41  if (signo >= NSIG || signo <= 0)
42    {
43      errno = EINVAL;
44      return -1;
45    }
46  *set &= ~(1 << (signo - 1));
47  return 0;
48}
49
50#undef sigismember
51int
52sigismember (const sigset_t * set, int signo)
53{
54  if (signo >= NSIG || signo <= 0)
55    {
56      errno = EINVAL;
57      return -1;
58    }
59
60  if (*set & (1 << (signo - 1)))
61    return 1;
62  else
63    return 0;
64}
65
66#endif /* SIG_SETMASK */
67#endif /* _NO_SIGSET  */
Note: See TracBrowser for help on using the repository browser.