diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2018-04-02 18:08:37 +0000 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2018-04-02 18:08:37 +0000 |
commit | f6fb29d22eefb208c0c7da463c31229d50ccbe01 (patch) | |
tree | 3db5f5950b7fb2ae65d2fc09f33fab2646687c94 | |
parent | fa9e15558d711c098183be531043eae465b81036 (diff) | |
download | glibc-f6fb29d22eefb208c0c7da463c31229d50ccbe01.zip glibc-f6fb29d22eefb208c0c7da463c31229d50ccbe01.tar.gz glibc-f6fb29d22eefb208c0c7da463c31229d50ccbe01.tar.bz2 |
hurd: Avoid local PLTs in libpthread.
* htl/cthreads-compat.c (__cthread_detach): Call __pthread_detach
instead of pthread_detach.
(__cthread_fork): Call __pthread_create instead of pthread_create.
(__cthread_keycreate): Call __pthread_key_create instead of
pthread_key_create.
(__cthread_getspecific): Call __pthread_getspecific instead of
pthread_getspecific.
(__cthread_setspecific): Call __pthread_setspecific instead of
pthread_setspecific.
* htl/pt-alloc.c (__pthread_alloc): Call __pthread_mutex_lock and
__pthread_mutex_unlock instead of pthread_mutex_lock and
pthread_mutex_unlock.
* htl/pt-cleanup.c (__pthread_get_cleanup_stack): Rename to
___pthread_get_cleanup_stack.
(__pthread_get_cleanup_stack): New strong alias.
* htl/pt-create.c: Include <pthreadP.h>.
(entry_point): Call __pthread_exit instead of pthread_exit.
(pthread_create): Rename to __pthread_create.
(pthread_create): New strong alias.
* htl/pt-detach.c (pthread_detach): Rename to __pthread_detach.
(pthread_detach): New strong alias.
(__pthread_detach): Call __pthread_cond_broadcast instead of
pthread_cond_broadcast.
* htl/pt-exit.c (__pthread_exit): Call __pthread_setcancelstate
instead of pthread_setcancelstate.
* htl/pt-testcancel.c: Include <pthreadP.h>.
(pthread_testcancel): Call __pthread_exit instead of pthread_exit.
* sysdeps/htl/pt-attr-getstack.c: Include <pthreadP.h>
(__pthread_attr_getstack): Call __pthread_attr_getstackaddr and
__pthread_attr_getstacksize instead of pthread_attr_getstackaddr and
pthread_attr_getstacksize.
* sysdeps/htl/pt-attr-getstackaddr.c (pthread_attr_getstackaddr):
Rename to __pthread_attr_getstackaddr.
(pthread_attr_getstackaddr): New strong alias.
* sysdeps/htl/pt-attr-getstacksize.c (pthread_attr_getstacksize):
Rename to __pthread_attr_getstacksize.
(pthread_attr_getstacksize): New strong alias.
* sysdeps/htl/pt-attr-setstack.c: Include <pthreadP.h>.
(pthread_attr_setstack): Rename to __pthread_attr_setstack.
(pthread_attr_setstack): New strong alias.
(__pthread_attr_setstack): Call __pthread_attr_getstacksize,
__pthread_attr_setstacksize and __pthread_attr_setstackaddr instead of
pthread_attr_getstacksize, pthread_attr_setstacksize and
pthread_attr_setstackaddr.
* sysdeps/htl/pt-attr-setstackaddr.c (pthread_attr_setstackaddr):
Rename to __pthread_attr_setstackaddr.
(pthread_attr_setstackaddr): New strong alias.
* sysdeps/htl/pt-attr-setstacksize.c (pthread_attr_setstacksize):
Rename to __pthread_attr_setstacksize.
(pthread_attr_setstacksize): New strong alias.
* sysdeps/htl/pt-cond-timedwait.c: Include <pthreadP.h>.
(__pthread_cond_timedwait_internal): Use __pthread_exit instead of
pthread_exit.
* sysdeps/htl/pt-key-create.c: Include <pthreadP.h>.
(__pthread_key_create): New hidden def.
* sysdeps/htl/pt-key.h: Include <pthreadP.h>.
* sysdeps/htl/pthreadP.h (_pthread_mutex_init,
__pthread_cond_broadcast, __pthread_create, __pthread_detach,
__pthread_exit, __pthread_key_create, __pthread_getspecific,
__pthread_setspecific, __pthread_setcancelstate,
__pthread_attr_getstackaddr, __pthread_attr_setstackaddr,
__pthread_attr_getstacksize, __pthread_attr_setstacksize,
__pthread_attr_setstack, ___pthread_get_cleanup_stack): New
declarations.
(__pthread_key_create, _pthread_mutex_init): New hidden declarations.
* sysdeps/mach/hurd/htl/pt-attr-setstackaddr.c
(pthread_attr_setstackaddr): Rename to __pthread_attr_setstackaddr.
(pthread_attr_setstackaddr): New strong alias.
* sysdeps/mach/hurd/htl/pt-attr-setstacksize.c
(pthread_attr_setstacksize): Rename to __pthread_attr_setstacksize.
(pthread_attr_setstacksize): New strong alias.
* sysdeps/mach/hurd/htl/pt-docancel.c: Include <pthreadP.h>.
(call_exit): Call __pthread_exit instead of pthread_exit.
* sysdeps/mach/hurd/htl/pt-mutex-init.c: Include <pthreadP.h>.
(_pthread_mutex_init): New hidden definition.
* sysdeps/mach/hurd/htl/pt-sysdep.c: Include <pthreadP.h>.
(_init_routine): Call __pthread_attr_init and __pthread_attr_setstack
instead of pthread_attr_init and pthread_attr_setstack.
-rw-r--r-- | ChangeLog | 79 | ||||
-rw-r--r-- | htl/cthreads-compat.c | 10 | ||||
-rw-r--r-- | htl/pt-alloc.c | 4 | ||||
-rw-r--r-- | htl/pt-cleanup.c | 3 | ||||
-rw-r--r-- | htl/pt-create.c | 8 | ||||
-rw-r--r-- | htl/pt-detach.c | 5 | ||||
-rw-r--r-- | htl/pt-exit.c | 4 | ||||
-rw-r--r-- | htl/pt-testcancel.c | 3 | ||||
-rw-r--r-- | sysdeps/htl/pt-attr-getstack.c | 5 | ||||
-rw-r--r-- | sysdeps/htl/pt-attr-getstackaddr.c | 3 | ||||
-rw-r--r-- | sysdeps/htl/pt-attr-getstacksize.c | 3 | ||||
-rw-r--r-- | sysdeps/htl/pt-attr-setstack.c | 12 | ||||
-rw-r--r-- | sysdeps/htl/pt-attr-setstackaddr.c | 3 | ||||
-rw-r--r-- | sysdeps/htl/pt-attr-setstacksize.c | 4 | ||||
-rw-r--r-- | sysdeps/htl/pt-cond-timedwait.c | 5 | ||||
-rw-r--r-- | sysdeps/htl/pt-key-create.c | 2 | ||||
-rw-r--r-- | sysdeps/htl/pt-key.h | 1 | ||||
-rw-r--r-- | sysdeps/htl/pthreadP.h | 28 | ||||
-rw-r--r-- | sysdeps/mach/hurd/htl/pt-attr-setstackaddr.c | 3 | ||||
-rw-r--r-- | sysdeps/mach/hurd/htl/pt-attr-setstacksize.c | 3 | ||||
-rw-r--r-- | sysdeps/mach/hurd/htl/pt-docancel.c | 3 | ||||
-rw-r--r-- | sysdeps/mach/hurd/htl/pt-mutex-init.c | 2 | ||||
-rw-r--r-- | sysdeps/mach/hurd/htl/pt-sysdep.c | 5 |
23 files changed, 163 insertions, 35 deletions
@@ -226,6 +226,85 @@ * sysdeps/mach/hurd/bits/stat.h [!__USE_MISC && __USE_ATFILE] (UTIME_NOW, UTIME_OMIT): Define macros. + * htl/cthreads-compat.c (__cthread_detach): Call __pthread_detach + instead of pthread_detach. + (__cthread_fork): Call __pthread_create instead of pthread_create. + (__cthread_keycreate): Call __pthread_key_create instead of + pthread_key_create. + (__cthread_getspecific): Call __pthread_getspecific instead of + pthread_getspecific. + (__cthread_setspecific): Call __pthread_setspecific instead of + pthread_setspecific. + * htl/pt-alloc.c (__pthread_alloc): Call __pthread_mutex_lock and + __pthread_mutex_unlock instead of pthread_mutex_lock and + pthread_mutex_unlock. + * htl/pt-cleanup.c (__pthread_get_cleanup_stack): Rename to + ___pthread_get_cleanup_stack. + (__pthread_get_cleanup_stack): New strong alias. + * htl/pt-create.c: Include <pthreadP.h>. + (entry_point): Call __pthread_exit instead of pthread_exit. + (pthread_create): Rename to __pthread_create. + (pthread_create): New strong alias. + * htl/pt-detach.c (pthread_detach): Rename to __pthread_detach. + (pthread_detach): New strong alias. + (__pthread_detach): Call __pthread_cond_broadcast instead of + pthread_cond_broadcast. + * htl/pt-exit.c (__pthread_exit): Call __pthread_setcancelstate + instead of pthread_setcancelstate. + * htl/pt-testcancel.c: Include <pthreadP.h>. + (pthread_testcancel): Call __pthread_exit instead of pthread_exit. + * sysdeps/htl/pt-attr-getstack.c: Include <pthreadP.h> + (__pthread_attr_getstack): Call __pthread_attr_getstackaddr and + __pthread_attr_getstacksize instead of pthread_attr_getstackaddr and + pthread_attr_getstacksize. + * sysdeps/htl/pt-attr-getstackaddr.c (pthread_attr_getstackaddr): + Rename to __pthread_attr_getstackaddr. + (pthread_attr_getstackaddr): New strong alias. + * sysdeps/htl/pt-attr-getstacksize.c (pthread_attr_getstacksize): + Rename to __pthread_attr_getstacksize. + (pthread_attr_getstacksize): New strong alias. + * sysdeps/htl/pt-attr-setstack.c: Include <pthreadP.h>. + (pthread_attr_setstack): Rename to __pthread_attr_setstack. + (pthread_attr_setstack): New strong alias. + (__pthread_attr_setstack): Call __pthread_attr_getstacksize, + __pthread_attr_setstacksize and __pthread_attr_setstackaddr instead of + pthread_attr_getstacksize, pthread_attr_setstacksize and + pthread_attr_setstackaddr. + * sysdeps/htl/pt-attr-setstackaddr.c (pthread_attr_setstackaddr): + Rename to __pthread_attr_setstackaddr. + (pthread_attr_setstackaddr): New strong alias. + * sysdeps/htl/pt-attr-setstacksize.c (pthread_attr_setstacksize): + Rename to __pthread_attr_setstacksize. + (pthread_attr_setstacksize): New strong alias. + * sysdeps/htl/pt-cond-timedwait.c: Include <pthreadP.h>. + (__pthread_cond_timedwait_internal): Use __pthread_exit instead of + pthread_exit. + * sysdeps/htl/pt-key-create.c: Include <pthreadP.h>. + (__pthread_key_create): New hidden def. + * sysdeps/htl/pt-key.h: Include <pthreadP.h>. + * sysdeps/htl/pthreadP.h (_pthread_mutex_init, + __pthread_cond_broadcast, __pthread_create, __pthread_detach, + __pthread_exit, __pthread_key_create, __pthread_getspecific, + __pthread_setspecific, __pthread_setcancelstate, + __pthread_attr_getstackaddr, __pthread_attr_setstackaddr, + __pthread_attr_getstacksize, __pthread_attr_setstacksize, + __pthread_attr_setstack, ___pthread_get_cleanup_stack): New + declarations. + (__pthread_key_create, _pthread_mutex_init): New hidden declarations. + * sysdeps/mach/hurd/htl/pt-attr-setstackaddr.c + (pthread_attr_setstackaddr): Rename to __pthread_attr_setstackaddr. + (pthread_attr_setstackaddr): New strong alias. + * sysdeps/mach/hurd/htl/pt-attr-setstacksize.c + (pthread_attr_setstacksize): Rename to __pthread_attr_setstacksize. + (pthread_attr_setstacksize): New strong alias. + * sysdeps/mach/hurd/htl/pt-docancel.c: Include <pthreadP.h>. + (call_exit): Call __pthread_exit instead of pthread_exit. + * sysdeps/mach/hurd/htl/pt-mutex-init.c: Include <pthreadP.h>. + (_pthread_mutex_init): New hidden definition. + * sysdeps/mach/hurd/htl/pt-sysdep.c: Include <pthreadP.h>. + (_init_routine): Call __pthread_attr_init and __pthread_attr_setstack + instead of pthread_attr_init and pthread_attr_setstack. + 2018-04-02 Agustina Arzille <avarzille@riseup.net> Amos Jeffries <squid3@treenet.co.nz> David Michael <fedora.dm0@gmail.com> diff --git a/htl/cthreads-compat.c b/htl/cthreads-compat.c index 7ae013b..6b2db64 100644 --- a/htl/cthreads-compat.c +++ b/htl/cthreads-compat.c @@ -26,7 +26,7 @@ __cthread_detach (__cthread_t thread) { int err; - err = pthread_detach ((pthread_t) thread); + err = __pthread_detach ((pthread_t) thread); assert_perror (err); } weak_alias (__cthread_detach, cthread_detach) @@ -37,7 +37,7 @@ __cthread_fork (__cthread_fn_t func, void *arg) pthread_t thread; int err; - err = pthread_create (&thread, NULL, func, arg); + err = __pthread_create (&thread, NULL, func, arg); assert_perror (err); return (__cthread_t) thread; @@ -49,7 +49,7 @@ __cthread_keycreate (__cthread_key_t *key) { error_t err; - err = pthread_key_create (key, 0); + err = __pthread_key_create (key, 0); if (err) { errno = err; @@ -64,7 +64,7 @@ weak_alias (__cthread_keycreate, cthread_keycreate) int __cthread_getspecific (__cthread_key_t key, void **val) { - *val = pthread_getspecific (key); + *val = __pthread_getspecific (key); return 0; } weak_alias (__cthread_getspecific, cthread_getspecific) @@ -74,7 +74,7 @@ __cthread_setspecific (__cthread_key_t key, void *val) { error_t err; - err = pthread_setspecific (key, (const void *) val); + err = __pthread_setspecific (key, (const void *) val); if (err) { errno = err; diff --git a/htl/pt-alloc.c b/htl/pt-alloc.c index aa3721d..f87829f 100644 --- a/htl/pt-alloc.c +++ b/htl/pt-alloc.c @@ -91,7 +91,7 @@ __pthread_alloc (struct __pthread **pthread) int max_threads; int new_max_threads; - pthread_mutex_lock (&__pthread_free_threads_lock); + __pthread_mutex_lock (&__pthread_free_threads_lock); for (new = __pthread_free_threads; new; new = new->next) { /* There is no need to take NEW->STATE_LOCK: if NEW is on this @@ -105,7 +105,7 @@ __pthread_alloc (struct __pthread **pthread) break; } } - pthread_mutex_unlock (&__pthread_free_threads_lock); + __pthread_mutex_unlock (&__pthread_free_threads_lock); if (new) { diff --git a/htl/pt-cleanup.c b/htl/pt-cleanup.c index 3c2d83a..05c1873 100644 --- a/htl/pt-cleanup.c +++ b/htl/pt-cleanup.c @@ -21,7 +21,8 @@ #include <pt-internal.h> struct __pthread_cancelation_handler ** -__pthread_get_cleanup_stack (void) +___pthread_get_cleanup_stack (void) { return &_pthread_self ()->cancelation_handlers; } +strong_alias (___pthread_get_cleanup_stack, __pthread_cleanup_stack) diff --git a/htl/pt-create.c b/htl/pt-create.c index 2b53658..a555c2f 100644 --- a/htl/pt-create.c +++ b/htl/pt-create.c @@ -26,6 +26,7 @@ #include <hurd/resource.h> #include <pt-internal.h> +#include <pthreadP.h> #if IS_IN (libpthread) # include <ctype.h> @@ -58,14 +59,14 @@ entry_point (struct __pthread *self, void *(*start_routine) (void *), void *arg) __pthread_startup (); - pthread_exit (start_routine (arg)); + __pthread_exit (start_routine (arg)); } /* Create a thread with attributes given by ATTR, executing START_ROUTINE with argument ARG. */ int -pthread_create (pthread_t * thread, const pthread_attr_t * attr, - void *(*start_routine) (void *), void *arg) +__pthread_create (pthread_t * thread, const pthread_attr_t * attr, + void *(*start_routine) (void *), void *arg) { int err; struct __pthread *pthread; @@ -78,6 +79,7 @@ pthread_create (pthread_t * thread, const pthread_attr_t * attr, return err; } +strong_alias (__pthread_create, pthread_create) /* Internal version of pthread_create. See comment in pt-internal.h. */ diff --git a/htl/pt-detach.c b/htl/pt-detach.c index 25f23ea..40082c5 100644 --- a/htl/pt-detach.c +++ b/htl/pt-detach.c @@ -25,7 +25,7 @@ /* Indicate that the storage for THREAD can be reclaimed when it terminates. */ int -pthread_detach (pthread_t thread) +__pthread_detach (pthread_t thread) { struct __pthread *pthread; int err = 0; @@ -47,7 +47,7 @@ pthread_detach (pthread_t thread) /* Broadcast the condition. This will make threads that are waiting to join THREAD continue with hopefully disastrous consequences instead of blocking indefinitely. */ - pthread_cond_broadcast (&pthread->state_cond); + __pthread_cond_broadcast (&pthread->state_cond); __pthread_mutex_unlock (&pthread->state_lock); __pthread_dealloc (pthread); @@ -77,3 +77,4 @@ pthread_detach (pthread_t thread) return err; } +strong_alias (__pthread_detach, pthread_detach) diff --git a/htl/pt-exit.c b/htl/pt-exit.c index 6cde558..0815dbc 100644 --- a/htl/pt-exit.c +++ b/htl/pt-exit.c @@ -38,14 +38,14 @@ __pthread_exit (void *status) /* Run any cancelation handlers. According to POSIX, the cancellation cleanup handlers should be called with cancellation disabled. */ - pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, &oldstate); + __pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, &oldstate); for (handlers = __pthread_get_cleanup_stack (); *handlers != NULL; *handlers = (*handlers)->__next) (*handlers)->__handler ((*handlers)->__arg); - pthread_setcancelstate (oldstate, &oldstate); + __pthread_setcancelstate (oldstate, &oldstate); /* Decrease the number of threads. We use an atomic operation to make sure that only the last thread calls `exit'. */ diff --git a/htl/pt-testcancel.c b/htl/pt-testcancel.c index b15eb6b..116a307 100644 --- a/htl/pt-testcancel.c +++ b/htl/pt-testcancel.c @@ -19,6 +19,7 @@ #include <pthread.h> #include <pt-internal.h> +#include <pthreadP.h> void pthread_testcancel (void) @@ -31,5 +32,5 @@ pthread_testcancel (void) __pthread_mutex_unlock (&p->cancel_lock); if (cancelled) - pthread_exit (PTHREAD_CANCELED); + __pthread_exit (PTHREAD_CANCELED); } diff --git a/sysdeps/htl/pt-attr-getstack.c b/sysdeps/htl/pt-attr-getstack.c index db04665..6d8b286 100644 --- a/sysdeps/htl/pt-attr-getstack.c +++ b/sysdeps/htl/pt-attr-getstack.c @@ -18,13 +18,14 @@ #include <pthread.h> #include <pt-internal.h> +#include <pthreadP.h> int __pthread_attr_getstack (const pthread_attr_t *attr, void **stackaddr, size_t * stacksize) { - pthread_attr_getstackaddr (attr, stackaddr); - pthread_attr_getstacksize (attr, stacksize); + __pthread_attr_getstackaddr (attr, stackaddr); + __pthread_attr_getstacksize (attr, stacksize); return 0; } weak_alias (__pthread_attr_getstack, pthread_attr_getstack) diff --git a/sysdeps/htl/pt-attr-getstackaddr.c b/sysdeps/htl/pt-attr-getstackaddr.c index 63661c2..6f2507a 100644 --- a/sysdeps/htl/pt-attr-getstackaddr.c +++ b/sysdeps/htl/pt-attr-getstackaddr.c @@ -20,8 +20,9 @@ #include <pt-internal.h> int -pthread_attr_getstackaddr (const pthread_attr_t *attr, void **stackaddr) +__pthread_attr_getstackaddr (const pthread_attr_t *attr, void **stackaddr) { *stackaddr = attr->__stackaddr; return 0; } +strong_alias (__pthread_attr_getstackaddr, pthread_attr_getstackaddr) diff --git a/sysdeps/htl/pt-attr-getstacksize.c b/sysdeps/htl/pt-attr-getstacksize.c index f3f33b4..824d363 100644 --- a/sysdeps/htl/pt-attr-getstacksize.c +++ b/sysdeps/htl/pt-attr-getstacksize.c @@ -20,8 +20,9 @@ #include <pt-internal.h> int -pthread_attr_getstacksize (const pthread_attr_t *attr, size_t * stacksize) +__pthread_attr_getstacksize (const pthread_attr_t *attr, size_t * stacksize) { *stacksize = attr->__stacksize; return 0; } +strong_alias (__pthread_attr_getstacksize, pthread_attr_getstacksize) diff --git a/sysdeps/htl/pt-attr-setstack.c b/sysdeps/htl/pt-attr-setstack.c index 70d6d09..f18025b 100644 --- a/sysdeps/htl/pt-attr-setstack.c +++ b/sysdeps/htl/pt-attr-setstack.c @@ -20,25 +20,26 @@ #include <assert.h> #include <pt-internal.h> +#include <pthreadP.h> int -pthread_attr_setstack (pthread_attr_t *attr, void *stackaddr, size_t stacksize) +__pthread_attr_setstack (pthread_attr_t *attr, void *stackaddr, size_t stacksize) { int err; size_t s; /* pthread_attr_setstack should always succeed, thus we set the size first as it is more discriminating. */ - pthread_attr_getstacksize (attr, &s); + __pthread_attr_getstacksize (attr, &s); - err = pthread_attr_setstacksize (attr, stacksize); + err = __pthread_attr_setstacksize (attr, stacksize); if (err) return err; - err = pthread_attr_setstackaddr (attr, stackaddr); + err = __pthread_attr_setstackaddr (attr, stackaddr); if (err) { - int e = pthread_attr_setstacksize (attr, s); + int e = __pthread_attr_setstacksize (attr, s); assert_perror (e); return err; @@ -46,3 +47,4 @@ pthread_attr_setstack (pthread_attr_t *attr, void *stackaddr, size_t stacksize) return 0; } +strong_alias (__pthread_attr_setstack, pthread_attr_setstack) diff --git a/sysdeps/htl/pt-attr-setstackaddr.c b/sysdeps/htl/pt-attr-setstackaddr.c index d15f5d7..491005b 100644 --- a/sysdeps/htl/pt-attr-setstackaddr.c +++ b/sysdeps/htl/pt-attr-setstackaddr.c @@ -20,8 +20,9 @@ #include <pt-internal.h> int -pthread_attr_setstackaddr (pthread_attr_t *attr, void *stackaddr) +__pthread_attr_setstackaddr (pthread_attr_t *attr, void *stackaddr) { attr->__stackaddr = stackaddr; return 0; } +strong_alias (__pthread_attr_setstackaddr, pthread_attr_setstackaddr) diff --git a/sysdeps/htl/pt-attr-setstacksize.c b/sysdeps/htl/pt-attr-setstacksize.c index aa3e800..38bec3f 100644 --- a/sysdeps/htl/pt-attr-setstacksize.c +++ b/sysdeps/htl/pt-attr-setstacksize.c @@ -20,9 +20,9 @@ #include <pt-internal.h> int -pthread_attr_setstacksize (pthread_attr_t *attr, size_t stacksize) +__pthread_attr_setstacksize (pthread_attr_t *attr, size_t stacksize) { attr->__stacksize = stacksize; - return 0; } +strong_alias (__pthread_attr_setstacksize, pthread_attr_setstacksize) diff --git a/sysdeps/htl/pt-cond-timedwait.c b/sysdeps/htl/pt-cond-timedwait.c index 7784a4a..66051af 100644 --- a/sysdeps/htl/pt-cond-timedwait.c +++ b/sysdeps/htl/pt-cond-timedwait.c @@ -19,6 +19,7 @@ #include <pthread.h> #include <pt-internal.h> +#include <pthreadP.h> extern int __pthread_cond_timedwait_internal (pthread_cond_t *cond, pthread_mutex_t *mutex, @@ -115,7 +116,7 @@ __pthread_cond_timedwait_internal (pthread_cond_t *cond, __pthread_mutex_unlock (&self->cancel_lock); if (cancelled) - pthread_exit (PTHREAD_CANCELED); + __pthread_exit (PTHREAD_CANCELED); /* Release MUTEX before blocking. */ __pthread_mutex_unlock (mutex); @@ -171,7 +172,7 @@ __pthread_cond_timedwait_internal (pthread_cond_t *cond, __pthread_mutex_lock (mutex); if (cancelled) - pthread_exit (PTHREAD_CANCELED); + __pthread_exit (PTHREAD_CANCELED); return err; } diff --git a/sysdeps/htl/pt-key-create.c b/sysdeps/htl/pt-key-create.c index 430dd23..a295bc7 100644 --- a/sysdeps/htl/pt-key-create.c +++ b/sysdeps/htl/pt-key-create.c @@ -21,6 +21,7 @@ #include <assert.h> #include <pt-internal.h> +#include <pthreadP.h> pthread_mutex_t __pthread_key_lock; @@ -106,3 +107,4 @@ do_search: return 0; } strong_alias (__pthread_key_create, pthread_key_create) +hidden_def (__pthread_key_create) diff --git a/sysdeps/htl/pt-key.h b/sysdeps/htl/pt-key.h index 09aa35c..893adcc 100644 --- a/sysdeps/htl/pt-key.h +++ b/sysdeps/htl/pt-key.h @@ -18,6 +18,7 @@ #include <pthread.h> #include <libc-lockP.h> +#include <pthreadP.h> #define PTHREAD_KEY_MEMBERS \ void **thread_specifics; /* This is only resized by the thread, and always growing */ \ diff --git a/sysdeps/htl/pthreadP.h b/sysdeps/htl/pthreadP.h index c379749..6c9aa6c 100644 --- a/sysdeps/htl/pthreadP.h +++ b/sysdeps/htl/pthreadP.h @@ -27,20 +27,48 @@ extern pthread_t __pthread_self (void); extern int __pthread_kill (pthread_t threadid, int signo); extern struct __pthread **__pthread_threads; +extern int _pthread_mutex_init (pthread_mutex_t *mutex, const pthread_mutexattr_t *attr); extern int __pthread_mutex_lock (pthread_mutex_t *__mutex); extern int __pthread_mutex_unlock (pthread_mutex_t *__mutex); +extern int __pthread_cond_broadcast (pthread_cond_t *cond); + typedef struct __cthread *__cthread_t; typedef int __cthread_key_t; typedef void * (*__cthread_fn_t)(void *__arg); __cthread_t __cthread_fork (__cthread_fn_t, void *); +int __pthread_create (pthread_t *newthread, + const pthread_attr_t *attr, + void *(*start_routine) (void *), void *arg); + void __cthread_detach (__cthread_t); +int __pthread_detach (pthread_t __threadp); +void __pthread_exit (void *value) __attribute__ ((__noreturn__)); int __cthread_keycreate (__cthread_key_t *); int __cthread_getspecific (__cthread_key_t, void **); int __cthread_setspecific (__cthread_key_t, void *); +int __pthread_key_create (pthread_key_t *key, void (*destr) (void *)); +void *__pthread_getspecific (pthread_key_t key); +int __pthread_setspecific (pthread_key_t key, const void *value); + +int __pthread_setcancelstate (int state, int *oldstate); int __pthread_getattr_np (pthread_t, pthread_attr_t *); +int __pthread_attr_getstackaddr (const pthread_attr_t *__restrict __attr, + void **__restrict __stackaddr); +int __pthread_attr_setstackaddr (pthread_attr_t *__attr, void *__stackaddr); +int __pthread_attr_getstacksize (const pthread_attr_t *__restrict __attr, + size_t *__restrict __stacksize); +int __pthread_attr_setstacksize (pthread_attr_t *__attr, size_t __stacksize); +int __pthread_attr_setstack (pthread_attr_t *__attr, void *__stackaddr, + size_t __stacksize); int __pthread_attr_getstack (const pthread_attr_t *, void **, size_t *); +struct __pthread_cancelation_handler **___pthread_get_cleanup_stack (void); + +#if IS_IN (libpthread) +hidden_proto (__pthread_key_create) +hidden_proto (_pthread_mutex_init) +#endif #endif /* pthreadP.h */ diff --git a/sysdeps/mach/hurd/htl/pt-attr-setstackaddr.c b/sysdeps/mach/hurd/htl/pt-attr-setstackaddr.c index 3c0d73d..ff6bee8 100644 --- a/sysdeps/mach/hurd/htl/pt-attr-setstackaddr.c +++ b/sysdeps/mach/hurd/htl/pt-attr-setstackaddr.c @@ -20,8 +20,9 @@ #include <pt-internal.h> int -pthread_attr_setstackaddr (pthread_attr_t *attr, void *stackaddr) +__pthread_attr_setstackaddr (pthread_attr_t *attr, void *stackaddr) { attr->__stackaddr = stackaddr; return 0; } +strong_alias (__pthread_attr_setstackaddr, pthread_attr_setstackaddr) diff --git a/sysdeps/mach/hurd/htl/pt-attr-setstacksize.c b/sysdeps/mach/hurd/htl/pt-attr-setstacksize.c index 9aff6ba..e5c59d1 100644 --- a/sysdeps/mach/hurd/htl/pt-attr-setstacksize.c +++ b/sysdeps/mach/hurd/htl/pt-attr-setstacksize.c @@ -20,8 +20,9 @@ #include <pt-internal.h> int -pthread_attr_setstacksize (pthread_attr_t *attr, size_t stacksize) +__pthread_attr_setstacksize (pthread_attr_t *attr, size_t stacksize) { attr->__stacksize = stacksize; return 0; } +strong_alias (__pthread_attr_setstacksize, pthread_attr_setstacksize) diff --git a/sysdeps/mach/hurd/htl/pt-docancel.c b/sysdeps/mach/hurd/htl/pt-docancel.c index 839529c..6e9428c 100644 --- a/sysdeps/mach/hurd/htl/pt-docancel.c +++ b/sysdeps/mach/hurd/htl/pt-docancel.c @@ -19,11 +19,12 @@ #include <pthread.h> #include <pt-internal.h> +#include <pthreadP.h> static void call_exit (void) { - pthread_exit (0); + __pthread_exit (0); } int diff --git a/sysdeps/mach/hurd/htl/pt-mutex-init.c b/sysdeps/mach/hurd/htl/pt-mutex-init.c index c90fc35..687a4c0 100644 --- a/sysdeps/mach/hurd/htl/pt-mutex-init.c +++ b/sysdeps/mach/hurd/htl/pt-mutex-init.c @@ -20,6 +20,7 @@ #include <stdlib.h> #include <assert.h> #include <pt-internal.h> +#include <pthreadP.h> #include "pt-mutex.h" #include <hurdlock.h> @@ -53,3 +54,4 @@ _pthread_mutex_init (pthread_mutex_t *mtxp, const pthread_mutexattr_t *attrp) } strong_alias (_pthread_mutex_init, pthread_mutex_init) +hidden_def (_pthread_mutex_init) diff --git a/sysdeps/mach/hurd/htl/pt-sysdep.c b/sysdeps/mach/hurd/htl/pt-sysdep.c index 4342d6d..673f048 100644 --- a/sysdeps/mach/hurd/htl/pt-sysdep.c +++ b/sysdeps/mach/hurd/htl/pt-sysdep.c @@ -24,6 +24,7 @@ #include <mach/mig_support.h> #include <pt-internal.h> +#include <pthreadP.h> __thread struct __pthread *___pthread_self; @@ -57,8 +58,8 @@ _init_routine (void *stack) while the main program was not linked against libpthread. */ /* Avoid allocating another stack */ attrp = &attr; - pthread_attr_init (attrp); - pthread_attr_setstack (attrp, stack, __vm_page_size); + __pthread_attr_init (attrp); + __pthread_attr_setstack (attrp, stack, __vm_page_size); } /* Create the pthread structure for the main thread (i.e. us). */ |