4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-01-15 19:09:58 +08:00
Jeff Johnston ea55e3f7f3 2002-05-31 Jeff Johnston <jjohnstn@redhat.com>
* libc/sys/linux/Makefile.am: Add sig.c and sigaction.c.  Also
        make siglist.inc dependent on sig.c instead of signal.c.
        * libc/sys/linux/Makefile.in: Regenerated.
        * libc/sys/linux/sig.c: Rename from signal.c and change code to
        use NSIG instead of _NSIG.
        * libc/sys/linux/sigaction.c: New file.
        * libc/sys/linux/signal.c: Changed to be linux signal() function
        so as to override regular newlib default signal.c.
        * libc/sys/linux/linuxthreads/config.h: Add __ASSUME_REALTIME_SIGNALS
        definition.
        * libc/sys/linux/linuxthreads/testrtsig.h: New file.
        * libc/sys/linux/machine/i386/Makefile.am: Remove sigset.c.
        * libc/sys/linux/machine/i386/Makefile.in: Regenerated.
        * libc/sys/linux/machine/i386/sigset.c: Moved to linux main directory.
        * libc/sys/linux/sigset.c: Moved from machine/i386 directory.
        * libc/sys/linux/sys/signal.h: Redefine NSIG to _NSIG and override
        default linux sigset_t typedef by defining it equal to __sigset_t.
        * libc/unix/sigset.c: Add check so code isn't compiled on systems
        with a sigset_t that isn't implemented with a single int.
2002-05-31 20:18:59 +00:00

62 lines
897 B
C

#include <signal.h>
#include <errno.h>
#if defined(SIG_SETMASK) && NSIG <= 32 /* easier than trying to remove from Makefile */
#undef sigemptyset
int
sigemptyset (sigset_t * set)
{
*set = (sigset_t) 0;
return 0;
}
int
sigfillset (sigset_t * set)
{
*set = ~((sigset_t) 0);
return 0;
}
#undef sigaddset
int
sigaddset (sigset_t * set, int signo)
{
if (signo >= NSIG || signo <= 0)
{
errno = EINVAL;
return -1;
}
*set |= 1 << (signo - 1);
return 0;
}
int
sigdelset (sigset_t * set, int signo)
{
if (signo >= NSIG || signo <= 0)
{
errno = EINVAL;
return -1;
}
*set &= ~(1 << (signo - 1));
return 0;
}
int
sigismember (const sigset_t * set, int signo)
{
if (signo >= NSIG || signo <= 0)
{
errno = EINVAL;
return -1;
}
if (*set & (1 << (signo - 1)))
return 1;
else
return 0;
}
#endif /* SIG_SETMASK */