summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2003-03-04 10:47:50 +0000
committerEric Andersen <andersen@codepoet.org>2003-03-04 10:47:50 +0000
commit4afd53acf1f42b233c613ca43cca28dd3c676cf0 (patch)
tree9a5c63bd92712741bec8e2ddfde7318de985f6da
parent7f566954fc897041daa3813b57c3843bc76e7f53 (diff)
Patch from Stefan Allius adding the function 'thread_self_stack'
from glibc 2.3 that is needed for pthreads to compile for SuperH.
-rw-r--r--libpthread/linuxthreads/pthread.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/libpthread/linuxthreads/pthread.c b/libpthread/linuxthreads/pthread.c
index 61f6b582a..9987c8249 100644
--- a/libpthread/linuxthreads/pthread.c
+++ b/libpthread/linuxthreads/pthread.c
@@ -104,7 +104,7 @@ struct _pthread_descr_struct __pthread_initial_thread = {
/* Descriptor of the manager thread; none of this is used but the error
variables, the p_pid and p_priority fields,
and the address for identification. */
-
+#define manager_thread (&__pthread_manager_thread)
struct _pthread_descr_struct __pthread_manager_thread = {
NULL, /* pthread_descr p_nextlive */
NULL, /* pthread_descr p_prevlive */
@@ -554,6 +554,26 @@ pthread_descr __pthread_find_self()
return h->h_descr;
}
+#else
+
+static pthread_descr thread_self_stack(void)
+{
+ char *sp = CURRENT_STACK_FRAME;
+ pthread_handle h;
+
+ if (sp >= __pthread_manager_thread_bos && sp < __pthread_manager_thread_tos)
+ return manager_thread;
+ h = __pthread_handles + 2;
+# ifdef USE_TLS
+ while (h->h_descr == NULL
+ || ! (sp <= (char *) h->h_descr->p_stackaddr && sp >= h->h_bottom))
+ h++;
+# else
+ while (! (sp <= (char *) h->h_descr && sp >= h->h_bottom))
+ h++;
+# endif
+ return h->h_descr;
+}
#endif