ia64, s390-64, sparc64, x86_64 and alpha ports has their own
implementations of sigprocmask(). They all but alpha do exactly
what generic sigprocmask() except the check and clear SIGCANCEL
and SIGSETXID flags.
In this patch, the NEED_CLEAR_SIGCANCEL_SIGSETXID option is
introduced and disabled for that ports which allows to swith
them to generic implementation.
* sysdeps/unix/sysv/linux/sigprocmask.c: Introduce
NEED_CLEAR_SIGCANCEL_SIGSETXID option for consolidation
of Linux sigprocmask() implementation;
* sysdeps/unix/sysv/linux/ia64/sigprocmask.c: Consolidate
sigprocmask() implementation;
* sysdeps/unix/sysv/linux/s390/s390-64/sigprocmask.c: Likewise;
* sysdeps/unix/sysv/linux/sparc/sparc64/sigprocmask.c: Likewise;
* sysdeps/unix/sysv/linux/x86_64/sigprocmask.c: Likewise.
---
sysdeps/unix/sysv/linux/ia64/sigprocmask.c | 22 ++--------------------
sysdeps/unix/sysv/linux/s390/s390-64/sigprocmask.c | 22 ++--------------------
sysdeps/unix/sysv/linux/sigprocmask.c | 11 +++++++++--
.../unix/sysv/linux/sparc/sparc64/sigprocmask.c | 18 ++----------------
sysdeps/unix/sysv/linux/x86_64/sigprocmask.c | 22 ++--------------------
5 files changed, 17 insertions(+), 78 deletions(-)
@@ -17,24 +17,6 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-/* Linux/ia64 only has rt signals, thus we do not even want to try falling
- back to the old style signals as the default Linux handler does. */
+#define NEED_CLEAR_SIGCANCEL_SIGSETXID 0
-#include <errno.h>
-#include <signal.h>
-#include <unistd.h>
-
-#include <sysdep.h>
-#include <sys/syscall.h>
-
-/* Get and/or change the set of blocked signals. */
-int
-__sigprocmask (int how, const sigset_t *set, sigset_t *oset)
-{
-
- /* XXX The size argument hopefully will have to be changed to the
- real size of the user-level sigset_t. */
- return INLINE_SYSCALL (rt_sigprocmask, 4, how, set, oset, _NSIG / 8);
-}
-libc_hidden_def (__sigprocmask)
-weak_alias (__sigprocmask, sigprocmask)
+#include <sysdeps/unix/sysv/linux/sigprocmask.c>
@@ -15,24 +15,6 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-/* 64 bit Linux for S/390 only has rt signals, thus we do not even want to try
- falling back to the old style signals as the default Linux handler does. */
+#define NEED_CLEAR_SIGCANCEL_SIGSETXID 0
-#include <errno.h>
-#include <signal.h>
-#include <unistd.h>
-
-#include <sysdep.h>
-#include <sys/syscall.h>
-
-/* Get and/or change the set of blocked signals. */
-int
-__sigprocmask (int how, const sigset_t *set, sigset_t *oset)
-{
-
- /* XXX The size argument hopefully will have to be changed to the
- real size of the user-level sigset_t. */
- return INLINE_SYSCALL (rt_sigprocmask, 4, how, set, oset, _NSIG / 8);
-}
-libc_hidden_def (__sigprocmask)
-weak_alias (__sigprocmask, sigprocmask)
+#include <sysdeps/unix/sysv/linux/sigprocmask.c>
@@ -17,19 +17,25 @@
#include <errno.h>
#include <signal.h>
-#include <string.h> /* Needed for string function builtin redirection. */
#include <unistd.h>
#include <sysdep.h>
#include <sys/syscall.h>
-#include <nptl/pthreadP.h> /* SIGCANCEL, SIGSETXID */
+#ifndef NEED_CLEAR_SIGCANCEL_SIGSETXID
+#define NEED_CLEAR_SIGCANCEL_SIGSETXID 1
+#endif
+#if NEED_CLEAR_SIGCANCEL_SIGSETXID
+#include <nptl/pthreadP.h>
+#include <string.h>
+#endif
/* Get and/or change the set of blocked signals. */
int
__sigprocmask (int how, const sigset_t *set, sigset_t *oset)
{
+#if NEED_CLEAR_SIGCANCEL_SIGSETXID
sigset_t local_newmask;
/* The only thing we have to make sure here is that SIGCANCEL and
@@ -43,6 +49,7 @@ __sigprocmask (int how, const sigset_t *set, sigset_t *oset)
__sigdelset (&local_newmask, SIGSETXID);
set = &local_newmask;
}
+#endif
return INLINE_SYSCALL (rt_sigprocmask, 4, how, set, oset, _NSIG / 8);
}
@@ -15,20 +15,6 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include <errno.h>
-#include <signal.h>
-#include <unistd.h>
+#define NEED_CLEAR_SIGCANCEL_SIGSETXID 0
-#include <sysdep.h>
-#include <sys/syscall.h>
-
-/* Get and/or change the set of blocked signals. */
-int
-__sigprocmask (int how, const sigset_t *set, sigset_t *oset)
-{
- /* XXX The size argument hopefully will have to be changed to the
- real size of the user-level sigset_t. */
- return INLINE_SYSCALL (rt_sigprocmask, 4, how, set, oset, _NSIG / 8);
-}
-libc_hidden_def (__sigprocmask)
-weak_alias (__sigprocmask, sigprocmask)
+#include <sysdeps/unix/sysv/linux/sigprocmask.c>
@@ -16,24 +16,6 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-/* Linux/x86_64 only has rt signals, thus we do not even want to try falling
- back to the old style signals as the default Linux handler does. */
+#define NEED_CLEAR_SIGCANCEL_SIGSETXID 0
-#include <errno.h>
-#include <signal.h>
-#include <unistd.h>
-
-#include <sysdep.h>
-#include <sys/syscall.h>
-
-/* Get and/or change the set of blocked signals. */
-int
-__sigprocmask (int how, const sigset_t *set, sigset_t *oset)
-{
-
- /* XXX The size argument hopefully will have to be changed to the
- real size of the user-level sigset_t. */
- return INLINE_SYSCALL (rt_sigprocmask, 4, how, set, oset, _NSIG / 8);
-}
-libc_hidden_def (__sigprocmask)
-weak_alias (__sigprocmask, sigprocmask)
+#include <sysdeps/unix/sysv/linux/sigprocmask.c>