This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 2/3] Consolidate Linux sigprocmask() implementation


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(-)

diff --git a/sysdeps/unix/sysv/linux/ia64/sigprocmask.c b/sysdeps/unix/sysv/linux/ia64/sigprocmask.c
index 920c5fd052..9e95e52d58 100644
--- a/sysdeps/unix/sysv/linux/ia64/sigprocmask.c
+++ b/sysdeps/unix/sysv/linux/ia64/sigprocmask.c
@@ -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>
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/sigprocmask.c b/sysdeps/unix/sysv/linux/s390/s390-64/sigprocmask.c
index a8010e7f14..227b512910 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/sigprocmask.c
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/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>
diff --git a/sysdeps/unix/sysv/linux/sigprocmask.c b/sysdeps/unix/sysv/linux/sigprocmask.c
index e776563336..94d4d0945f 100644
--- a/sysdeps/unix/sysv/linux/sigprocmask.c
+++ b/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);
 }
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/sigprocmask.c b/sysdeps/unix/sysv/linux/sparc/sparc64/sigprocmask.c
index ef7d7feb49..0db24d6fce 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/sigprocmask.c
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/sigprocmask.c
@@ -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>
diff --git a/sysdeps/unix/sysv/linux/x86_64/sigprocmask.c b/sysdeps/unix/sysv/linux/x86_64/sigprocmask.c
index 1610ddf47f..d3179ebea5 100644
--- a/sysdeps/unix/sysv/linux/x86_64/sigprocmask.c
+++ b/sysdeps/unix/sysv/linux/x86_64/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>
-- 
2.11.0


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]