Sophie

Sophie

distrib > Mandriva > 2007.0 > i586 > media > contrib-release > by-pkgid > 4c9f17ec5da473f7fb52041bb9197c5a > files > 136

kaffe-devel-1.1.8-0.20060723.1mdv2007.0.i586.rpm

! =======================================================================
!
!  This patch is necessary for pthreads (linuxthread) support to work
!  with kaffe.  Essentially in glibc 2.1.1 the sigcontext is not passed
!  from the pthread signal handle to the user signal handler, so kaffe
!  cannot work out where the signal occured.
!
!  This will be fixed in glibc 2.1.2
!
! =======================================================================
--- glibc/linuxthreads/signals.c	1999/01/07 11:52:52	1.8
+++ glibc/linuxthreads/signals.c	1999/08/19 18:34:38	1.9
@@ -19,6 +19,7 @@
 #include "pthread.h"
 #include "internals.h"
 #include "spinlock.h"
+#include <sigcontextinfo.h>
 
 int pthread_sigmask(int how, const sigset_t * newmask, sigset_t * oldmask)
 {
@@ -67,10 +68,11 @@ int pthread_kill(pthread_t thread, int s
 }
 
 /* User-provided signal handlers */
-static __sighandler_t sighandler[NSIG];
+typedef void (*arch_sighandler_t) __PMT ((int, SIGCONTEXT));
+static arch_sighandler_t sighandler[NSIG];
 
 /* The wrapper around user-provided signal handlers */
-static void pthread_sighandler(int signo)
+static void pthread_sighandler(int signo, SIGCONTEXT ctx)
 {
   pthread_descr self = thread_self();
   char * in_sighandler;
@@ -86,7 +88,7 @@ static void pthread_sighandler(int signo
   in_sighandler = THREAD_GETMEM(self, p_in_sighandler);
   if (in_sighandler == NULL)
     THREAD_SETMEM(self, p_in_sighandler, CURRENT_STACK_FRAME);
-  sighandler[signo](signo);
+  sighandler[signo](signo, ctx);
   if (in_sighandler == NULL)
     THREAD_SETMEM(self, p_in_sighandler, NULL);
 }
@@ -108,7 +110,7 @@ int sigaction(int sig, const struct siga
       newact = *act;
       if (act->sa_handler != SIG_IGN && act->sa_handler != SIG_DFL
 	  && sig > 0 && sig < NSIG)
-	newact.sa_handler = pthread_sighandler;
+	newact.sa_handler = (__sighandler_t) pthread_sighandler;
       newactp = &newact;
     }
   else
@@ -118,9 +120,9 @@ int sigaction(int sig, const struct siga
   if (sig > 0 && sig < NSIG)
     {
       if (oact != NULL)
-	oact->sa_handler = sighandler[sig];
+	oact->sa_handler = (__sighandler_t) sighandler[sig];
       if (act)
-	sighandler[sig] = act->sa_handler;
+	sighandler[sig] = (arch_sighandler_t) act->sa_handler;
     }
   return 0;
 }
@@ -152,8 +154,8 @@ int sigwait(const sigset_t * set, int * 
         s != __pthread_sig_debug) {
       sigdelset(&mask, s);
       if (sighandler[s] == NULL ||
-          sighandler[s] == SIG_DFL ||
-          sighandler[s] == SIG_IGN) {
+          sighandler[s] == (arch_sighandler_t) SIG_DFL ||
+          sighandler[s] == (arch_sighandler_t) SIG_IGN) {
         sa.sa_handler = pthread_null_sighandler;
         sigemptyset(&sa.sa_mask);
         sa.sa_flags = 0;