svn commit: branches/uClibc-nptl/libc: signal sysdeps/linux/arm sysdeps/linux/c etc...

sjhill at uclibc.org sjhill at uclibc.org
Wed Nov 16 03:30:32 UTC 2005


Author: sjhill
Date: 2005-11-15 19:30:28 -0800 (Tue, 15 Nov 2005)
New Revision: 12280

Log:
Update signal handlers for NPTL.


Modified:
   branches/uClibc-nptl/libc/signal/allocrtsig.c
   branches/uClibc-nptl/libc/signal/sigaction.c
   branches/uClibc-nptl/libc/signal/sigfillset.c
   branches/uClibc-nptl/libc/sysdeps/linux/arm/sigaction.c
   branches/uClibc-nptl/libc/sysdeps/linux/common/sigprocmask.c
   branches/uClibc-nptl/libc/sysdeps/linux/i386/sigaction.c
   branches/uClibc-nptl/libc/sysdeps/linux/mips/sigaction.c
   branches/uClibc-nptl/libc/sysdeps/linux/x86_64/sigaction.c


Changeset:
Modified: branches/uClibc-nptl/libc/signal/allocrtsig.c
===================================================================
--- branches/uClibc-nptl/libc/signal/allocrtsig.c	2005-11-16 03:15:35 UTC (rev 12279)
+++ branches/uClibc-nptl/libc/signal/allocrtsig.c	2005-11-16 03:30:28 UTC (rev 12280)
@@ -32,7 +32,7 @@
 static int current_rtmin = -1;
 static int current_rtmax = -1;
 #else
-static int current_rtmin = __SIGRTMIN;
+static int current_rtmin = __SIGRTMIN + 2;
 static int current_rtmax = __SIGRTMAX;
 #endif
 

Modified: branches/uClibc-nptl/libc/signal/sigaction.c
===================================================================
--- branches/uClibc-nptl/libc/signal/sigaction.c	2005-11-16 03:15:35 UTC (rev 12279)
+++ branches/uClibc-nptl/libc/signal/sigaction.c	2005-11-16 03:30:28 UTC (rev 12280)
@@ -32,12 +32,6 @@
     int result;
     struct kernel_sigaction kact, koact;
 
-#ifdef SIGCANCEL
-    if (sig == SIGCANCEL) {
-	__set_errno (EINVAL);
-	return -1;
-    }
-#endif
     if (act) {
 	kact.k_sa_handler = act->sa_handler;
 	memcpy (&kact.sa_mask, &act->sa_mask, sizeof (kact.sa_mask));
@@ -73,12 +67,6 @@
     int result;
     struct old_kernel_sigaction kact, koact;
 
-#ifdef SIGCANCEL
-    if (sig == SIGCANCEL) {
-	__set_errno (EINVAL);
-	return -1;
-    }
-#endif
     if (act) {
 	kact.k_sa_handler = act->sa_handler;
 	kact.sa_mask = act->sa_mask.__val[0];
@@ -103,5 +91,6 @@
 
 #endif
 
+#ifndef LIBC_SIGACTION
 weak_alias(__libc_sigaction, sigaction)
-
+#endif

Modified: branches/uClibc-nptl/libc/signal/sigfillset.c
===================================================================
--- branches/uClibc-nptl/libc/signal/sigfillset.c	2005-11-16 03:15:35 UTC (rev 12279)
+++ branches/uClibc-nptl/libc/signal/sigfillset.c	2005-11-16 03:30:28 UTC (rev 12280)
@@ -31,5 +31,14 @@
 
     memset (set, 0xff, sizeof (sigset_t));
 
+	/* If implementation uses a cancellation signal don't set the bit. */
+#ifdef SIGCANCEL
+	__sigdelset (set, SIGCANCEL);
+#endif
+	/* Likewise for the signal to implement setxid. */
+#ifdef SIGSETXID
+	__sigdelset (set, SIGSETXID);
+#endif
+
     return 0;
 }

Modified: branches/uClibc-nptl/libc/sysdeps/linux/arm/sigaction.c
===================================================================
--- branches/uClibc-nptl/libc/sysdeps/linux/arm/sigaction.c	2005-11-16 03:15:35 UTC (rev 12279)
+++ branches/uClibc-nptl/libc/sysdeps/linux/arm/sigaction.c	2005-11-16 03:30:28 UTC (rev 12280)
@@ -132,5 +132,7 @@
 }
 
 #endif
+
+#ifndef LIBC_SIGACTION
 weak_alias(__libc_sigaction, sigaction)
-
+#endir

Modified: branches/uClibc-nptl/libc/sysdeps/linux/common/sigprocmask.c
===================================================================
--- branches/uClibc-nptl/libc/sysdeps/linux/common/sigprocmask.c	2005-11-16 03:15:35 UTC (rev 12279)
+++ branches/uClibc-nptl/libc/sysdeps/linux/common/sigprocmask.c	2005-11-16 03:30:28 UTC (rev 12280)
@@ -18,8 +18,30 @@
 _syscall4(int, __rt_sigprocmask, int, how, const sigset_t *, set,
 		  sigset_t *, oldset, size_t, size);
 
-int sigprocmask(int how, const sigset_t * set, sigset_t * oldset)
+int __sigprocmask(int how, const sigset_t * set, sigset_t * oldset)
 {
+#ifdef SIGCANCEL
+	sigset_t local_newmask;
+
+	/*
+	 * The only thing we have to make sure here is that SIGCANCEL and
+	 * SIGSETXID are not blocked.
+	 */
+	if (set != NULL && (__builtin_expect (__sigismember (set, SIGCANCEL), 0)
+# ifdef SIGSETXID
+		|| __builtin_expect (__sigismember (set, SIGSETXID), 0)
+# endif
+		))
+	{
+		local_newmask = *set;
+		__sigdelset (&local_newmask, SIGCANCEL);
+# ifdef SIGSETXID
+		__sigdelset (&local_newmask, SIGSETXID);
+# endif
+		set = &local_newmask;
+	}
+#endif
+
 	if (set &&
 #if (SIG_BLOCK == 0) && (SIG_UNBLOCK == 1) && (SIG_SETMASK == 2)
 		(((unsigned int) how) > 2)
@@ -43,8 +65,30 @@
 _syscall3(int, __syscall_sigprocmask, int, how, const sigset_t *, set,
 		  sigset_t *, oldset);
 
-int sigprocmask(int how, const sigset_t * set, sigset_t * oldset)
+int __sigprocmask(int how, const sigset_t * set, sigset_t * oldset)
 {
+#ifdef SIGCANCEL
+	sigset_t local_newmask;
+
+	/*
+	 * The only thing we have to make sure here is that SIGCANCEL and
+	 * SIGSETXID are not blocked.
+	 */
+	if (set != NULL && (__builtin_expect (__sigismember (set, SIGCANCEL), 0)
+# ifdef SIGSETXID
+		|| __builtin_expect (__sigismember (set, SIGSETXID), 0)
+# endif
+		))
+	{
+		local_newmask = *set;
+		__sigdelset (&local_newmask, SIGCANCEL);
+# ifdef SIGSETXID
+		__sigdelset (&local_newmask, SIGSETXID);
+# endif
+		set = &local_newmask;
+	}
+#endif
+
 	if (set &&
 #if (SIG_BLOCK == 0) && (SIG_UNBLOCK == 1) && (SIG_SETMASK == 2)
 		(((unsigned int) how) > 2)
@@ -60,3 +104,5 @@
 	return (__syscall_sigprocmask(how, set, oldset));
 }
 #endif
+
+weak_alias (__sigprocmask, sigprocmask)

Modified: branches/uClibc-nptl/libc/sysdeps/linux/i386/sigaction.c
===================================================================
--- branches/uClibc-nptl/libc/sysdeps/linux/i386/sigaction.c	2005-11-16 03:15:35 UTC (rev 12279)
+++ branches/uClibc-nptl/libc/sysdeps/linux/i386/sigaction.c	2005-11-16 03:30:28 UTC (rev 12280)
@@ -121,7 +121,10 @@
 }
 
 #endif
+
+#ifndef LIBC_SIGACTION
 weak_alias (__libc_sigaction, sigaction)
+#endif
 
 
 

Modified: branches/uClibc-nptl/libc/sysdeps/linux/mips/sigaction.c
===================================================================
--- branches/uClibc-nptl/libc/sysdeps/linux/mips/sigaction.c	2005-11-16 03:15:35 UTC (rev 12279)
+++ branches/uClibc-nptl/libc/sysdeps/linux/mips/sigaction.c	2005-11-16 03:30:28 UTC (rev 12280)
@@ -25,10 +25,10 @@
 #include <sys/syscall.h>
 #include <bits/kernel_sigaction.h>
 
-#define SA_RESTORER	0x04000000
 
-
 #if defined __NR_rt_sigaction
+#warning "Yes there is a warning here.  Don't worry about it."
+static void restore_rt (void) asm ("__restore_rt");
 
 /* If ACT is not NULL, change the action for SIG to *ACT.
    If OACT is not NULL, put the old action for SIG in *OACT.  */
@@ -37,22 +37,17 @@
     int result;
     struct kernel_sigaction kact, koact;
 
-#ifdef SIGCANCEL
-    if (sig == SIGCANCEL) {
-	__set_errno (EINVAL);
-	return -1;
-    }
-#endif
-
     if (act) {
 	kact.k_sa_handler = act->sa_handler;
 	memcpy (&kact.sa_mask, &act->sa_mask, sizeof (kact.sa_mask));
 	kact.sa_flags = act->sa_flags;
-
-	kact.sa_flags = act->sa_flags | SA_RESTORER;
-#ifdef HAVE_SA_RESTORER
+# ifdef HAVE_SA_RESTORER
+#  if _MIPS_SIM == _ABIO32
 	kact.sa_restorer = act->sa_restorer;
-#endif
+#  else
+	kact.sa_restorer = &restore_rt;
+#  endif
+# endif
     }
 
     /* XXX The size argument hopefully will have to be changed to the
@@ -64,9 +59,9 @@
 	oact->sa_handler = koact.k_sa_handler;
 	memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (oact->sa_mask));
 	oact->sa_flags = koact.sa_flags;
-#ifdef HAVE_SA_RESTORER
+# ifdef HAVE_SA_RESTORER
 	oact->sa_restorer = koact.sa_restorer;
-#endif
+# endif
     }
     return result;
 }
@@ -83,20 +78,17 @@
     int result;
     struct old_kernel_sigaction kact, koact;
 
-#ifdef SIGCANCEL
-    if (sig == SIGCANCEL) {
-	__set_errno (EINVAL);
-	return -1;
-    }
-#endif
-
     if (act) {
 	kact.k_sa_handler = act->sa_handler;
 	kact.sa_mask = act->sa_mask.__val[0];
-	kact.sa_flags = act->sa_flags | SA_RESTORER;
-#ifdef HAVE_SA_RESTORER
+	kact.sa_flags = act->sa_flags;
+# ifdef HAVE_SA_RESTORER
+#  if _MIPS_SIM == _ABIO32
 	kact.sa_restorer = act->sa_restorer;
-#endif
+#  else
+	kact.sa_restorer = &restore_rt;
+#  endif
+# endif
     }
 
     result = __syscall_sigaction(sig, act ? __ptrvalue (&kact) : NULL,
@@ -111,13 +103,15 @@
 	oact->sa_handler = koact.k_sa_handler;
 	oact->sa_mask.__val[0] = koact.sa_mask;
 	oact->sa_flags = koact.sa_flags;
-#ifdef HAVE_SA_RESTORER
+# ifdef HAVE_SA_RESTORER
 	oact->sa_restorer = koact.sa_restorer;
-#endif
+# endif
     }
     return result;
 }
 
 #endif
-weak_alias (__libc_sigaction, sigaction)
 
+#ifndef LIBC_SIGACTION
+weak_alias (__libc_sigaction, sigaction)
+#endif

Modified: branches/uClibc-nptl/libc/sysdeps/linux/x86_64/sigaction.c
===================================================================
--- branches/uClibc-nptl/libc/sysdeps/linux/x86_64/sigaction.c	2005-11-16 03:15:35 UTC (rev 12279)
+++ branches/uClibc-nptl/libc/sysdeps/linux/x86_64/sigaction.c	2005-11-16 03:30:28 UTC (rev 12280)
@@ -106,7 +106,9 @@
 }
 #endif
 
+#ifndef LIBC_SIGACTION
 weak_alias (__libc_sigaction, sigaction)
+#endif
 
 /* NOTE: Please think twice before making any changes to the bits of
    code below.  GDB needs some intimate knowledge about it to




More information about the uClibc-cvs mailing list