OSDN Git Service

Fix up sig handling so it is more in sync with glibc behavior
authorEric Andersen <andersen@codepoet.org>
Wed, 17 Oct 2001 06:02:35 +0000 (06:02 -0000)
committerEric Andersen <andersen@codepoet.org>
Wed, 17 Oct 2001 06:02:35 +0000 (06:02 -0000)
15 files changed:
libc/signal/Makefile
libc/signal/sigaddset.c
libc/signal/sigandset.c [new file with mode: 0644]
libc/signal/sigblock.c
libc/signal/sigdelset.c
libc/signal/sigempty.c [new file with mode: 0644]
libc/signal/sigfillset.c
libc/signal/siggetmask.c [new file with mode: 0644]
libc/signal/sighold.c [new file with mode: 0644]
libc/signal/sigisempty.c [new file with mode: 0644]
libc/signal/sigismem.c
libc/signal/sigorset.c [new file with mode: 0644]
libc/signal/sigrelse.c [new file with mode: 0644]
libc/signal/sigsetops.c [new file with mode: 0644]
libc/signal/sigsetops.h [new file with mode: 0644]

index fe9690c..3f82838 100644 (file)
 TOPDIR=../../
 include $(TOPDIR)Rules.mak
 
-CSRC=bsd_sig.c raise.c sigblock.c siggtmsk.c sigjmp.c signal.c sigintr.c\
-       sigpause.c sigstmsk.c sigaddset.c sigdelset.c sigismem.c \
-       sigemptyset.c sigfillset.c killpg.c allocrtsig.c
+CSRC=bsd_sig.c raise.c sigblock.c siggetmask.c sigjmp.c signal.c sigintr.c\
+       sigpause.c sigstmsk.c killpg.c allocrtsig.c sigsetops.c \
+       sigaddset.c sigandset.c sigdelset.c sigfillset.c sigorset.c \
+       sigempty.c sighold.c sigisempty.c sigismem.c sigrelse.c
 COBJS=$(patsubst %.c,%.o, $(CSRC))
 
 OBJS=$(COBJS)
index 8300dd7..be2968d 100644 (file)
@@ -2,31 +2,31 @@
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
 
    The GNU C Library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
+   Lesser General Public License for more details.
 
-   You should have received a copy of the GNU Library General Public
-   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
-
-#include <stdlib.h>
-#include <errno.h>
-#include <features.h>
-#include <signal.h>
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
+#include "sigsetops.h"
 
 /* Add SIGNO to SET.  */
-int sigaddset ( sigset_t *set, int signo)
+int
+sigaddset (set, signo)
+     sigset_t *set;
+     int signo;
 {
-  if (set == NULL || signo <= 0 || signo >= NSIG) {
-      __set_errno(EINVAL);
+  if (set == NULL || signo <= 0 || signo >= NSIG)
+    {
+      __set_errno (EINVAL);
       return -1;
     }
 
diff --git a/libc/signal/sigandset.c b/libc/signal/sigandset.c
new file mode 100644 (file)
index 0000000..4e1abd9
--- /dev/null
@@ -0,0 +1,39 @@
+/* Copyright (C) 1991, 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#define __USE_GNU
+#include <signal.h>
+#define __need_NULL
+#include <stddef.h>
+
+/* Combine sets LEFT and RIGHT by logical AND and place result in DEST.  */
+int
+sigandset (dest, left, right)
+     sigset_t *dest;
+     const sigset_t *left;
+     const sigset_t *right;
+{
+  if (dest == NULL || left == NULL || right == NULL)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  return __sigandset (dest, left, right);
+}
index 78d7a19..f47b758 100644 (file)
@@ -1,45 +1,56 @@
-/* Copyright (C) 1991 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+/* Copyright (C) 1991, 94, 95, 96, 97, 98, 2001 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
 
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
 
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Library General Public License for more details.
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
 
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
-#include <stdlib.h>
 #include <errno.h>
+#define __USE_GNU
 #include <signal.h>
 
 /* Block signals in MASK, returning the old mask.  */
-int sigblock (int mask)
+int sigblock (mask)
+     int mask;
 {
-  register int sig;
+  register unsigned int sig;
   sigset_t set, oset;
 
-  if (sigemptyset(&set) < 0)
+  if (__sigemptyset (&set) < 0)
     return -1;
-  
-  for (sig = 1; sig < NSIG; ++sig)
-    if ((mask & sigmask(sig)) && sigaddset(&set, sig) < 0)
-      return -1;
 
-  if (sigprocmask(SIG_BLOCK, &set, &oset) < 0)
+  if (sizeof (mask) == sizeof (set))
+    *(int *) &set = mask;
+  else if (sizeof (unsigned long int) == sizeof (set))
+    *(unsigned long int *) &set = (unsigned int) mask;
+  else
+    for (sig = 1; sig < NSIG && sig <= sizeof (mask) * 8; ++sig)
+      if ((mask & sigmask (sig)) && __sigaddset (&set, sig) < 0)
+       return -1;
+
+  if (sigprocmask (SIG_BLOCK, &set, &oset) < 0)
     return -1;
 
-  mask = 0;
-  for (sig = 1; sig < NSIG; ++sig)
-    if (sigismember(&oset, sig))
-      mask |= sigmask(sig);
+  if (sizeof (mask) == sizeof (oset))
+    mask = *(int *) &oset;
+  else if (sizeof (unsigned long int) == sizeof (oset))
+    mask = *(unsigned long int*) &oset;
+  else
+    for (sig = 1, mask = 0; sig < NSIG && sig <= sizeof (mask) * 8; ++sig)
+      if (__sigismember (&oset, sig))
+       mask |= sigmask (sig);
 
   return mask;
 }
+
index 6698ff6..7e20331 100644 (file)
@@ -2,30 +2,31 @@
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
 
    The GNU C Library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
+   Lesser General Public License for more details.
 
-   You should have received a copy of the GNU Library General Public
-   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
-#include <stdlib.h>
-#include <errno.h>
-#include <features.h>
-#include <signal.h>
+#include "sigsetops.h"
 
 /* Add SIGNO to SET.  */
-int sigdelset ( sigset_t *set, int signo)
+int
+sigdelset (set, signo)
+     sigset_t *set;
+     int signo;
 {
-  if (set == NULL || signo <= 0 || signo >= NSIG) {
-      __set_errno(EINVAL);
+  if (set == NULL || signo <= 0 || signo >= NSIG)
+    {
+      __set_errno (EINVAL);
       return -1;
     }
 
diff --git a/libc/signal/sigempty.c b/libc/signal/sigempty.c
new file mode 100644 (file)
index 0000000..0164ed3
--- /dev/null
@@ -0,0 +1,37 @@
+/* Copyright (C) 1991, 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <signal.h>
+#include <string.h>
+
+/* Clear all signals from SET.  */
+int
+sigemptyset (set)
+     sigset_t *set;
+{
+  if (set == NULL)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  memset (set, 0, sizeof (sigset_t));
+
+  return 0;
+}
index c3ebcce..3126774 100644 (file)
@@ -2,19 +2,19 @@
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
 
    The GNU C Library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
+   Lesser General Public License for more details.
 
-   You should have received a copy of the GNU Library General Public
-   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
 #include <errno.h>
 #include <signal.h>
@@ -27,7 +27,7 @@ sigfillset (set)
 {
   if (set == NULL)
     {
-      __set_errno(EINVAL);
+      __set_errno (EINVAL);
       return -1;
     }
 
diff --git a/libc/signal/siggetmask.c b/libc/signal/siggetmask.c
new file mode 100644 (file)
index 0000000..cb5270d
--- /dev/null
@@ -0,0 +1,30 @@
+/* siggetmask -- useless alias for `sigblock (0)' for old Linux compatibility.
+   Copyright (C) 1996 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#define __USE_GNU
+#include <signal.h>
+
+int
+siggetmask (void)
+{
+  return sigblock (0);
+}
+
+link_warning (siggetmask,
+             "warning: `siggetmask' is obsolete; `sigprocmask' is best")
diff --git a/libc/signal/sighold.c b/libc/signal/sighold.c
new file mode 100644 (file)
index 0000000..f2978a3
--- /dev/null
@@ -0,0 +1,42 @@
+/* Add SIG to the calling process' signal mask.
+   Copyright (C) 1998, 2000 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#define __need_NULL
+#include <stddef.h>
+#define __USE_GNU
+#include <signal.h>
+
+int
+sighold (sig)
+     int sig;
+{
+  sigset_t set;
+
+  /* Retrieve current signal set.  */
+  if (sigprocmask (SIG_SETMASK, NULL, &set) < 0)
+    return -1;
+
+  /* Add the specified signal.  */
+  if (__sigaddset (&set, sig) < 0)
+    return -1;
+
+  /* Set the new mask.  */
+  return sigprocmask (SIG_SETMASK, &set, NULL);
+}
diff --git a/libc/signal/sigisempty.c b/libc/signal/sigisempty.c
new file mode 100644 (file)
index 0000000..6d1de45
--- /dev/null
@@ -0,0 +1,37 @@
+/* Copyright (C) 1991, 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#define __USE_GNU
+#include <signal.h>
+#define __need_NULL
+#include <stddef.h>
+
+/* Test whether SET is empty.  */
+int
+sigisemptyset (set)
+     const sigset_t *set;
+{
+  if (set == NULL)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+    return __sigisemptyset (set);
+}
index 89d8864..0a5d6b6 100644 (file)
@@ -2,32 +2,31 @@
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
 
    The GNU C Library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
+   Lesser General Public License for more details.
 
-   You should have received a copy of the GNU Library General Public
-   License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
 
-#include <stdlib.h>
-#include <errno.h>
-#include <features.h>
-#define _EXTERN_INLINE
-#define __USE_EXTERN_INLINES   1
-#include <signal.h>
+#include "sigsetops.h"
 
 /* Return 1 if SIGNO is in SET, 0 if not.  */
-int sigismember ( const sigset_t *set, int signo)
+int
+sigismember (set, signo)
+     const sigset_t *set;
+     int signo;
 {
-  if (set == NULL || signo <= 0 || signo >= NSIG) {
-      __set_errno(EINVAL);
+  if (set == NULL || signo <= 0 || signo >= NSIG)
+    {
+      __set_errno (EINVAL);
       return -1;
     }
 
diff --git a/libc/signal/sigorset.c b/libc/signal/sigorset.c
new file mode 100644 (file)
index 0000000..ffabf37
--- /dev/null
@@ -0,0 +1,39 @@
+/* Copyright (C) 1991, 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#define __USE_GNU
+#include <signal.h>
+#define __need_NULL
+#include <stddef.h>
+
+/* Combine sets LEFT and RIGHT by logical OR and place result in DEST.  */
+int
+sigorset (dest, left, right)
+     sigset_t *dest;
+     const sigset_t *left;
+     const sigset_t *right;
+{
+  if (dest == NULL || left == NULL || right == NULL)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  return __sigorset (dest, left, right);
+}
diff --git a/libc/signal/sigrelse.c b/libc/signal/sigrelse.c
new file mode 100644 (file)
index 0000000..725a551
--- /dev/null
@@ -0,0 +1,42 @@
+/* Remove SIG from the calling process' signal mask.
+   Copyright (C) 1998, 2000 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#define __need_NULL
+#include <stddef.h>
+#define __USE_GNU
+#include <signal.h>
+
+int
+sigrelse (sig)
+     int sig;
+{
+  sigset_t set;
+
+  /* Retrieve current signal set.  */
+  if (sigprocmask (SIG_SETMASK, NULL, &set) < 0)
+    return -1;
+
+  /* Remove the specified signal.  */
+  if (__sigdelset (&set, sig) < 0)
+    return -1;
+
+  /* Set the new mask.  */
+  return sigprocmask (SIG_SETMASK, &set, NULL);
+}
diff --git a/libc/signal/sigsetops.c b/libc/signal/sigsetops.c
new file mode 100644 (file)
index 0000000..0317662
--- /dev/null
@@ -0,0 +1,11 @@
+/* Define the real-function versions of all inline functions
+   defined in signal.h (or bits/sigset.h).  */
+
+#include <features.h>
+
+#define _EXTERN_INLINE
+#ifndef __USE_EXTERN_INLINES
+# define __USE_EXTERN_INLINES  1
+#endif
+
+#include "signal.h"
diff --git a/libc/signal/sigsetops.h b/libc/signal/sigsetops.h
new file mode 100644 (file)
index 0000000..16f9b36
--- /dev/null
@@ -0,0 +1,34 @@
+/* Copyright (C) 1991, 1995, 1996 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/* Definitions relevant to functions that operate on `sigset_t's.  */
+
+#include <errno.h>
+#define __USE_GNU
+#include <signal.h>
+#include <string.h>
+
+#define        BITS            (_NSIG - 1)
+#define        ELT(signo)      (((signo) - 1) / BITS)
+#define        MASK(signo)     (1 << (((signo) - 1) % BITS))
+
+#undef sigemptyset
+#undef sigfillset
+#undef sigaddset
+#undef sigdelset
+#undef sigismember