about summary refs log tree commit diff
path: root/linuxthreads/pthread.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-09-18 23:21:25 +0000
committerUlrich Drepper <drepper@redhat.com>1999-09-18 23:21:25 +0000
commit9cf44e65641b946949db0bbf3059901ff2ef08cb (patch)
treec46268cea32dfcb5e08b5e7846281cc1babfab08 /linuxthreads/pthread.c
parentc68d04feb7fca7f45eb30c286812092653e24ca1 (diff)
downloadglibc-9cf44e65641b946949db0bbf3059901ff2ef08cb.tar.gz
glibc-9cf44e65641b946949db0bbf3059901ff2ef08cb.tar.xz
glibc-9cf44e65641b946949db0bbf3059901ff2ef08cb.zip
Update.
1999-09-18  Ulrich Drepper  <drepper@cygnus.com>

	* pthread.c (pthread_handle_sigrestart_rt): New function.  Use
	this instead of pthread_handle_sigrestart if the signal is an RT
	signal.

	* signals.c: Handle passing through of sighandler arguments also
	for real-time signals.
Diffstat (limited to 'linuxthreads/pthread.c')
-rw-r--r--linuxthreads/pthread.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/linuxthreads/pthread.c b/linuxthreads/pthread.c
index 86f24469de..2f10f06790 100644
--- a/linuxthreads/pthread.c
+++ b/linuxthreads/pthread.c
@@ -21,6 +21,9 @@
 #include <string.h>
 #include <unistd.h>
 #include <fcntl.h>
+#ifdef __i386__
+# include <ucontext.h>
+#endif
 #include <sys/wait.h>
 #include <sys/resource.h>
 #include "pthread.h"
@@ -161,6 +164,8 @@ static void pthread_handle_sigrestart(int sig);
 #else
 static void pthread_handle_sigcancel(int sig, struct sigcontext ctx);
 static void pthread_handle_sigrestart(int sig, struct sigcontext ctx);
+static void pthread_handle_sigrestart_rt(int sig, struct siginfo *si,
+					 struct ucontext *uc);
 #endif
 static void pthread_handle_sigdebug(int sig);
 
@@ -318,7 +323,10 @@ static void pthread_initialize(void)
 #ifndef __i386__
   sa.sa_handler = pthread_handle_sigrestart;
 #else
-  sa.sa_handler = (__sighandler_t) pthread_handle_sigrestart;
+  if (__pthread_sig_restart >= SIGRTMIN)
+    sa.sa_handler = (__sighandler_t) pthread_handle_sigrestart_rt;
+  else
+    sa.sa_handler = (__sighandler_t) pthread_handle_sigrestart;
 #endif
   sigemptyset(&sa.sa_mask);
   sa.sa_flags = 0;
@@ -568,6 +576,20 @@ static void pthread_handle_sigrestart(int sig, struct sigcontext ctx)
     siglongjmp(*THREAD_GETMEM(self, p_signal_jmp), 1);
 }
 
+#ifdef __i386__
+static void pthread_handle_sigrestart_rt(int sig, struct siginfo *si,
+					 struct ucontext *uc)
+{
+  pthread_descr self;
+  asm volatile ("movw %w0,%%gs" : : "r" (uc->uc_mcontext.gregs[GS]));
+  self = thread_self();
+  THREAD_SETMEM(self, p_signal, sig);
+  if (THREAD_GETMEM(self, p_signal_jmp) != NULL)
+    siglongjmp(*THREAD_GETMEM(self, p_signal_jmp), 1);
+}
+#endif
+
+
 /* The handler for the CANCEL signal checks for cancellation
    (in asynchronous mode), for process-wide exit and exec requests.
    For the thread manager thread, redirect the signal to