summary refs log tree commit diff
path: root/linuxthreads/ptlongjmp.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-04-10 21:46:48 +0000
committerUlrich Drepper <drepper@redhat.com>2001-04-10 21:46:48 +0000
commit58f46c794a3dc049ae8c53dab76d83ea23408479 (patch)
tree5695211b81ee73dc571857728e377b59a6938d92 /linuxthreads/ptlongjmp.c
parentbf9d1166a06c7181e50d7d5c9a2cde665007ee1d (diff)
downloadglibc-58f46c794a3dc049ae8c53dab76d83ea23408479.tar.gz
glibc-58f46c794a3dc049ae8c53dab76d83ea23408479.tar.xz
glibc-58f46c794a3dc049ae8c53dab76d83ea23408479.zip
Update.
2001-04-10  Martin Schwidefsky  <schwidefsky@de.ibm.com>

	* sysdeps/unix/sysv/linux/s390/s390-32/getcontext.S: Fix return
	value of getcontext.
	* sysdeps/unix/sysv/linux/s390/s390-64/getcontext.S: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/setcontext.S: Fix return
	value of setcontext.
	* sysdeps/unix/sysv/linux/s390/s390-64/setcontext.S: Likewise.
	* sysdeps/unix/sysv/linux/s390/swapcontext.c: Skip setcontext
	call by changing the saved context.
Diffstat (limited to 'linuxthreads/ptlongjmp.c')
-rw-r--r--linuxthreads/ptlongjmp.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/linuxthreads/ptlongjmp.c b/linuxthreads/ptlongjmp.c
index 1c12508101..68b9235cb8 100644
--- a/linuxthreads/ptlongjmp.c
+++ b/linuxthreads/ptlongjmp.c
@@ -18,6 +18,7 @@
 #include <setjmp.h>
 #include "pthread.h"
 #include "internals.h"
+#include <stackinfo.h>
 
 /* These functions are not declared anywhere since they shouldn't be
    used at another place but here.  */
@@ -31,11 +32,29 @@ static void pthread_cleanup_upto(__jmp_buf target)
 {
   pthread_descr self = thread_self();
   struct _pthread_cleanup_buffer * c;
+  char *currentframe = CURRENT_STACK_FRAME;
 
   for (c = THREAD_GETMEM(self, p_cleanup);
        c != NULL && _JMPBUF_UNWINDS(target, c);
        c = c->__prev)
-    c->__routine(c->__arg);
+    {
+#if _STACK_GROWS_DOWN
+      if ((char *) c <= currentframe)
+	{
+	  c = NULL;
+	  break;
+	}
+#elif _STACK_GROWS_UP
+      if ((char *) c >= currentframe)
+	{
+	  c = NULL;
+	  break;
+	}
+#else
+# error "Define either _STACK_GROWS_DOWN or _STACK_GROWS_UP"
+#endif
+      c->__routine(c->__arg);
+    }
   THREAD_SETMEM(self, p_cleanup, c);
   if (THREAD_GETMEM(self, p_in_sighandler)
       && _JMPBUF_UNWINDS(target, THREAD_GETMEM(self, p_in_sighandler)))