aboutsummaryrefslogtreecommitdiff
path: root/sysdeps
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/arm/sys/ucontext.h1
-rw-r--r--sysdeps/generic/sigsetops.h77
-rw-r--r--sysdeps/generic/sys/ucontext.h1
-rw-r--r--sysdeps/i386/sys/ucontext.h1
-rw-r--r--sysdeps/m68k/sys/ucontext.h1
-rw-r--r--sysdeps/mach/hurd/i386/bits/sigcontext.h1
-rw-r--r--sysdeps/mips/sys/ucontext.h1
-rw-r--r--sysdeps/posix/profil.c1
-rw-r--r--sysdeps/posix/sigignore.c5
-rw-r--r--sysdeps/posix/sigintr.c1
-rw-r--r--sysdeps/posix/signal.c7
-rw-r--r--sysdeps/posix/sigset.c63
-rw-r--r--sysdeps/posix/sprofil.c1
-rw-r--r--sysdeps/posix/sysv_signal.c5
-rw-r--r--sysdeps/powerpc/novmxsetjmp.h2
-rw-r--r--sysdeps/pthread/bits/sigthread.h1
-rw-r--r--sysdeps/unix/sysv/linux/Makefile3
-rw-r--r--sysdeps/unix/sysv/linux/aarch64/sys/ucontext.h1
-rw-r--r--sysdeps/unix/sysv/linux/alpha/sys/ucontext.h1
-rw-r--r--sysdeps/unix/sysv/linux/arm/sys/ucontext.h1
-rw-r--r--sysdeps/unix/sysv/linux/bits/sigevent-consts.h41
-rw-r--r--sysdeps/unix/sysv/linux/bits/siginfo-arch.h7
-rw-r--r--sysdeps/unix/sysv/linux/bits/siginfo-consts-arch.h7
-rw-r--r--sysdeps/unix/sysv/linux/bits/siginfo-consts.h185
-rw-r--r--sysdeps/unix/sysv/linux/bits/siginfo.h341
-rw-r--r--sysdeps/unix/sysv/linux/bits/sigset.h124
-rw-r--r--sysdeps/unix/sysv/linux/bits/types/__sigset_t.h10
-rw-r--r--sysdeps/unix/sysv/linux/bits/types/sigevent_t.h48
-rw-r--r--sysdeps/unix/sysv/linux/bits/types/siginfo_t.h139
-rw-r--r--sysdeps/unix/sysv/linux/hppa/sys/ucontext.h1
-rw-r--r--sysdeps/unix/sysv/linux/ia64/bits/siginfo-arch.h19
-rw-r--r--sysdeps/unix/sysv/linux/ia64/bits/siginfo-consts-arch.h45
-rw-r--r--sysdeps/unix/sysv/linux/ia64/bits/siginfo.h360
-rw-r--r--sysdeps/unix/sysv/linux/m68k/sys/ucontext.h1
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/siginfo-arch.h15
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/siginfo.h344
-rw-r--r--sysdeps/unix/sysv/linux/mips/sys/ucontext.h1
-rw-r--r--sysdeps/unix/sysv/linux/nios2/sys/ucontext.h1
-rw-r--r--sysdeps/unix/sysv/linux/nptl-signals.h1
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h3
-rw-r--r--sysdeps/unix/sysv/linux/s390/bits/siginfo.h341
-rw-r--r--sysdeps/unix/sysv/linux/s390/sys/ucontext.h1
-rw-r--r--sysdeps/unix/sysv/linux/sh/sys/ucontext.h1
-rw-r--r--sysdeps/unix/sysv/linux/sigsetops.h108
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/siginfo-arch.h14
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/siginfo-consts-arch.h12
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/siginfo.h352
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sys/ucontext.h1
-rw-r--r--sysdeps/unix/sysv/linux/sys/epoll.h8
-rw-r--r--sysdeps/unix/sysv/linux/sys/signalfd.h3
-rw-r--r--sysdeps/unix/sysv/linux/tile/bits/siginfo-arch.h11
-rw-r--r--sysdeps/unix/sysv/linux/tile/bits/siginfo-consts-arch.h14
-rw-r--r--sysdeps/unix/sysv/linux/tile/bits/siginfo.h347
-rw-r--r--sysdeps/unix/sysv/linux/tile/sys/ucontext.h1
-rw-r--r--sysdeps/unix/sysv/linux/x86/bits/siginfo-arch.h19
-rw-r--r--sysdeps/unix/sysv/linux/x86/bits/siginfo.h360
-rw-r--r--sysdeps/unix/sysv/linux/x86/sys/ucontext.h1
57 files changed, 831 insertions, 2631 deletions
diff --git a/sysdeps/arm/sys/ucontext.h b/sysdeps/arm/sys/ucontext.h
index 49d60395dd..bbfeb20bb5 100644
--- a/sysdeps/arm/sys/ucontext.h
+++ b/sysdeps/arm/sys/ucontext.h
@@ -25,6 +25,7 @@
/* We need the signal context definitions even if they are not exposed
by <signal.h>. */
+#include <bits/types/__sigset_t.h>
#include <bits/sigcontext.h>
#include <bits/sigstack.h>
#include <bits/types/struct_sigstack.h>
diff --git a/sysdeps/generic/sigsetops.h b/sysdeps/generic/sigsetops.h
new file mode 100644
index 0000000000..e8e5553981
--- /dev/null
+++ b/sysdeps/generic/sigsetops.h
@@ -0,0 +1,77 @@
+/* __sigset_t manipulators. Generic/BSD version.
+ Copyright (C) 1991-2017 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _SIGSETOPS_H
+#define _SIGSETOPS_H 1
+
+#include <signal.h>
+
+/* Return a mask that includes SIG only. The cast to `sigset_t' avoids
+ overflow if `sigset_t' is wider than `int'. */
+# define __sigmask(sig) (((__sigset_t) 1) << ((sig) - 1))
+
+#define __sigemptyset(set) \
+ (__extension__ ({ \
+ *(set) = (__sigset_t) 0; \
+ (void)0; \
+ }))
+#define __sigfillset(set) \
+ (__extension__ ({ \
+ *(set) = ~(__sigset_t) 0; \
+ (void)0; \
+ }))
+
+# define __sigisemptyset(set) \
+ (*(set) == (__sigset_t) 0)
+
+# define __sigandset(dest, left, right) \
+ (__extension__ ({ \
+ *(dest) = *(left) & *(right); \
+ (void)0; \
+ }))
+
+# define __sigorset(dest, left, right) \
+ (__extension__ ({ \
+ *(dest) = *(left) | *(right); \
+ (void)0; \
+ }))
+#endif
+
+/* These macros needn't check for a bogus signal number;
+ checking is done in the non-__ versions. */
+# define __sigismember(set, sig) \
+ (__extension__ ({ \
+ __sigset_t __mask = __sigmask (sig); \
+ (set) & __mask ? 1 : 0; \
+ }))
+
+# define __sigaddset(set, sig) \
+ (__extension__ ({ \
+ __sigset_t __mask = __sigmask (sig); \
+ (set) |= __mask; \
+ (void)0; \
+ }))
+
+# define __sigdelset(set, sig) \
+ (__extension__ ({ \
+ __sigset_t __mask = __sigmask (sig); \
+ (set) &= ~__mask; \
+ (void)0; \
+ }))
+
+#endif
diff --git a/sysdeps/generic/sys/ucontext.h b/sysdeps/generic/sys/ucontext.h
index 052c5401cb..a0602a7ad3 100644
--- a/sysdeps/generic/sys/ucontext.h
+++ b/sysdeps/generic/sys/ucontext.h
@@ -27,6 +27,7 @@
/* We need the signal context definitions even if they are not exposed
by <signal.h>. */
+#include <bits/types/__sigset_t.h>
#include <bits/sigcontext.h>
#include <bits/sigstack.h>
#include <bits/types/struct_sigstack.h>
diff --git a/sysdeps/i386/sys/ucontext.h b/sysdeps/i386/sys/ucontext.h
index 241f270a99..92deea92ea 100644
--- a/sysdeps/i386/sys/ucontext.h
+++ b/sysdeps/i386/sys/ucontext.h
@@ -25,6 +25,7 @@
/* We need the signal context definitions even if they are not exposed
by <signal.h>. */
+#include <bits/types/__sigset_t.h>
#include <bits/sigcontext.h>
#include <bits/sigstack.h>
#include <bits/types/struct_sigstack.h>
diff --git a/sysdeps/m68k/sys/ucontext.h b/sysdeps/m68k/sys/ucontext.h
index 4e5ec3b090..4f185ce63f 100644
--- a/sysdeps/m68k/sys/ucontext.h
+++ b/sysdeps/m68k/sys/ucontext.h
@@ -25,6 +25,7 @@
/* We need the signal context definitions even if they are not exposed
by <signal.h>. */
+#include <bits/types/__sigset_t.h>
#include <bits/sigcontext.h>
#include <bits/sigstack.h>
#include <bits/types/struct_sigstack.h>
diff --git a/sysdeps/mach/hurd/i386/bits/sigcontext.h b/sysdeps/mach/hurd/i386/bits/sigcontext.h
index 286b80efbd..3d5a6736aa 100644
--- a/sysdeps/mach/hurd/i386/bits/sigcontext.h
+++ b/sysdeps/mach/hurd/i386/bits/sigcontext.h
@@ -26,6 +26,7 @@
/* Signal handlers are actually called:
void handler (int sig, int code, struct sigcontext *scp); */
+#include <bits/types/__sigset_t.h>
#include <mach/machine/fp_reg.h>
/* State of this thread when the signal was taken. */
diff --git a/sysdeps/mips/sys/ucontext.h b/sysdeps/mips/sys/ucontext.h
index cb8fbcd3d2..9c6f8f8221 100644
--- a/sysdeps/mips/sys/ucontext.h
+++ b/sysdeps/mips/sys/ucontext.h
@@ -25,6 +25,7 @@
/* We need the signal context definitions even if they are not exposed
by <signal.h>. */
+#include <bits/types/__sigset_t.h>
#include <bits/sigcontext.h>
#include <bits/sigstack.h>
#include <bits/types/struct_sigstack.h>
diff --git a/sysdeps/posix/profil.c b/sysdeps/posix/profil.c
index f5b8ee19fc..4d3fbe0b8a 100644
--- a/sysdeps/posix/profil.c
+++ b/sysdeps/posix/profil.c
@@ -22,6 +22,7 @@
#include <signal.h>
#include <sys/time.h>
#include <libc-internal.h>
+#include <sigsetops.h>
#ifndef SIGPROF
diff --git a/sysdeps/posix/sigignore.c b/sysdeps/posix/sigignore.c
index e7975739e8..601ae9685a 100644
--- a/sysdeps/posix/sigignore.c
+++ b/sysdeps/posix/sigignore.c
@@ -22,7 +22,7 @@
#include <stddef.h>
#include <signal.h>
#include <string.h> /* For the real memset prototype. */
-
+#include <sigsetops.h>
int
sigignore (int sig)
@@ -30,8 +30,7 @@ sigignore (int sig)
struct sigaction act;
act.sa_handler = SIG_IGN;
- if (__sigemptyset (&act.sa_mask) < 0)
- return -1;
+ __sigemptyset (&act.sa_mask);
act.sa_flags = 0;
return __sigaction (sig, &act, NULL);
diff --git a/sysdeps/posix/sigintr.c b/sysdeps/posix/sigintr.c
index d02469a8dd..a6202de6a9 100644
--- a/sysdeps/posix/sigintr.c
+++ b/sysdeps/posix/sigintr.c
@@ -18,6 +18,7 @@
#include <stddef.h>
#include <signal.h>
#include <errno.h>
+#include <sigsetops.h>
/* If INTERRUPT is nonzero, make signal SIG interrupt system calls
(causing them to fail with EINTR); if INTERRUPT is zero, make system
diff --git a/sysdeps/posix/signal.c b/sysdeps/posix/signal.c
index 32db07b519..81ba17745d 100644
--- a/sysdeps/posix/signal.c
+++ b/sysdeps/posix/signal.c
@@ -19,7 +19,7 @@
#include <errno.h>
#include <signal.h>
#include <string.h> /* For the real memset prototype. */
-
+#include <sigsetops.h>
sigset_t _sigintr attribute_hidden; /* Set by siginterrupt. */
@@ -38,9 +38,8 @@ __bsd_signal (int sig, __sighandler_t handler)
}
act.sa_handler = handler;
- if (__sigemptyset (&act.sa_mask) < 0
- || __sigaddset (&act.sa_mask, sig) < 0)
- return SIG_ERR;
+ __sigemptyset (&act.sa_mask);
+ __sigaddset (&act.sa_mask, sig);
act.sa_flags = __sigismember (&_sigintr, sig) ? 0 : SA_RESTART;
if (__sigaction (sig, &act, &oact) < 0)
return SIG_ERR;
diff --git a/sysdeps/posix/sigset.c b/sysdeps/posix/sigset.c
index 0c2aa76ad4..a4dfe0ae93 100644
--- a/sysdeps/posix/sigset.c
+++ b/sysdeps/posix/sigset.c
@@ -8,7 +8,7 @@
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
+ 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
@@ -20,7 +20,7 @@
#include <stddef.h>
#include <signal.h>
#include <string.h> /* For the real memset prototype. */
-
+#include <sigsetops.h>
/* Set the disposition for SIG. */
__sighandler_t
@@ -31,19 +31,19 @@ sigset (int sig, __sighandler_t disp)
sigset_t set;
sigset_t oset;
-#ifdef SIG_HOLD
- /* Handle SIG_HOLD first. */
- if (disp == SIG_HOLD)
+ /* Check signal extents to protect __sigismember. */
+ if (disp == SIG_ERR || sig < 1 || sig >= NSIG)
{
- /* Create an empty signal set. */
- if (__sigempty