newlib-cygwin/newlib/libc/sys/linux/machine/i386/sigset.c

98 lines
1.6 KiB
C
Raw Normal View History

2002-04-03 Jeff Johnston <jjohnstn@redhat.com> * configure.host: Add support for machine subdirectory of sys subdirectory. * configure.in: Add check for sys machine subdirectory. * Makefile.am: Ditto. * configure: Regenerated. * Makefile.in: Ditto. * libc/sys/linux/crt0.c: Moved to machine/i386 directory. * libc/sys/linux/sys/syscall.h: Ditto. * libc/sys/linux/sleep.c: New file. * libc/sys/linux/socket.c: Ditto. * libc/sys/linux/sockops.h: Ditto. * libc/sys/linux/stack.c: Ditto. * libc/sys/linux/usleep.c: Ditto. * libc/sys/linux/machine/Makefile.am: Ditto. * libc/sys/linux/machine/Makefile.in: Ditto. * libc/sys/linux/machine/aclocal.m4: Ditto. * libc/sys/linux/machine/configure: Ditto. * libc/sys/linux/machine/configure.in: Ditto. * libc/sys/linux/machine/i386/Makefile.am: Ditto. * libc/sys/linux/machine/i386/Makefile.in: Ditto. * libc/sys/linux/machine/i386/aclocal.m4: Ditto. * libc/sys/linux/machine/i386/configure: Ditto. * libc/sys/linux/machine/i386/configure.in: Ditto. * libc/sys/linux/machine/i386/crt0.c: Ditto. * libc/sys/linux/machine/i386/sigset.c: Ditto. * libc/sys/linux/machine/i386/sigstack.h: Ditto. * libc/sys/linux/machine/i386/socketcall.h: Ditto. * libc/sys/linux/machine/i386/syscall.h: Ditto. * libc/sys/linux/sys/select.h: Ditto. * libc/sys/linux/configure.in: Add support for machine directory. * libc/sys/linux/Makefile.am: Ditto plus add new files above. * libc/sys/linux/Makefile.in: Regenerated. * libc/sys/linux/configure: Ditto. * libc/sys/linux/brk.c: Use machine/syscall.h instead of sys/syscall.h. * libc/sys/linux/inode.c: Ditto. * libc/sys/linux/linux.c: Ditto. * libc/sys/linux/process.c: Ditto. * libc/sys/linux/systat.c: Ditto. * libc/sys/linux/time.c: Ditto. * libc/sys/linux/wait.c: Ditto. * libc/sys/linux/ids.c: Change header plus add setfsgid/setfsuid. * libc/sys/linux/io.c: Change header plus add readv/writev. * libc/sys/linux/signal.c: Change header plus change sigsuspend to use __sigsuspend syscall. * libc/sys/linux/select.c: Change header plus change select to use _newselect syscall. * libc/sys/linux/sys/cdefs.h: Add a number of standard definitions used by glibc header files. * libc/sys/linux/sys/types.h: Add __socklen_t and __useconds_t types.
2002-04-04 06:46:21 +08:00
/* sigset.c - signal set manipulation functions */
/* Copyright 2002, Red Hat Inc. */
/* Note: these are currently grouped together in one file so that
it will override the default version in the libc/unix
directory which has grouped all functions in one file. */
/* sigaddset function */
#include <signal.h>
#include <bits/sigset.h>
#include <errno.h>
#include <string.h>
int
sigaddset (sigset_t *set, const int signo)
{
int index, mask;
__sigset_t *st = (__sigset_t *)set;
if (signo > NSIG)
{
errno = EINVAL;
return -1;
}
index = (signo - 1) / 32;
mask = 1 << ((signo - 1) % 32);
st->__val[index] |= mask;
return 0;
}
/* sigdelset function */
int
sigdelset (sigset_t *set, const int signo)
{
int index, mask;
__sigset_t *st = (__sigset_t *)set;
if (signo > NSIG)
{
errno = EINVAL;
return -1;
}
index = (signo - 1) / 32;
mask = 1 << ((signo - 1) % 32);
st->__val[index] &= ~mask;
return 0;
}
/* sigemptyset function */
int
sigemptyset (sigset_t *set)
{
int size = NSIG / 8;
__sigset_t *st = (__sigset_t *)set;
memset (st->__val, 0, size);
return 0;
}
/* sigfillset function */
int
sigfillset (sigset_t *set)
{
int size = NSIG / 8;
__sigset_t *st = (__sigset_t *)set;
memset (st->__val, 0xff, size);
return 0;
}
/* sigismember function */
int
sigismember (const sigset_t *set, int signo)
{
int index, mask;
__sigset_t *st = (__sigset_t *)set;
if (signo > NSIG)
{
errno = EINVAL;
return -1;
}
index = (signo - 1) / 32;
mask = 1 << ((signo - 1) % 32);
return (st->__val[index] & mask) != 0;
}