diff options
| author | gfleury <gfleury@disroot.org> | 2025-01-03 12:37:46 +0200 |
|---|---|---|
| committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2025-01-29 02:32:36 +0100 |
| commit | 2ebc2d8e24976ae9779d1d78ba8a1ed9b7b1ded7 (patch) | |
| tree | cc7c81930705da35c289bcf9e8dab504e034918f /sysdeps | |
| parent | e892a930736ba8f3c19a47dc0f46fec87da38313 (diff) | |
| download | glibc-2ebc2d8e24976ae9779d1d78ba8a1ed9b7b1ded7.tar.xz glibc-2ebc2d8e24976ae9779d1d78ba8a1ed9b7b1ded7.zip | |
htl: move pthread_mutex_{lock, unlock, trylock, timedlock, clocklock}
I haven't exposed _pthread_mutex_lock, _pthread_mutex_trylock and
_pthread_mutex_unlock in GLIBC_PRIVATE since there aren't used in any
code in libpthread
Message-ID: <20250103103750.870897-3-gfleury@disroot.org>
Diffstat (limited to 'sysdeps')
| -rw-r--r-- | sysdeps/htl/libc-lockP.h | 6 | ||||
| -rw-r--r-- | sysdeps/htl/pthread-functions.h | 6 | ||||
| -rw-r--r-- | sysdeps/htl/pthreadP.h | 11 | ||||
| -rw-r--r-- | sysdeps/htl/timer_routines.c | 12 | ||||
| -rw-r--r-- | sysdeps/mach/hurd/htl/pt-mutex-lock.c | 11 | ||||
| -rw-r--r-- | sysdeps/mach/hurd/htl/pt-mutex-timedlock.c | 5 | ||||
| -rw-r--r-- | sysdeps/mach/hurd/htl/pt-mutex-trylock.c | 11 | ||||
| -rw-r--r-- | sysdeps/mach/hurd/htl/pt-mutex-unlock.c | 11 | ||||
| -rw-r--r-- | sysdeps/mach/hurd/i386/libc.abilist | 6 | ||||
| -rw-r--r-- | sysdeps/mach/hurd/i386/libpthread.abilist | 5 | ||||
| -rw-r--r-- | sysdeps/mach/hurd/x86_64/libc.abilist | 4 | ||||
| -rw-r--r-- | sysdeps/mach/hurd/x86_64/libpthread.abilist | 5 |
12 files changed, 47 insertions, 46 deletions
diff --git a/sysdeps/htl/libc-lockP.h b/sysdeps/htl/libc-lockP.h index 6c13382a21..3d74cd87e9 100644 --- a/sysdeps/htl/libc-lockP.h +++ b/sysdeps/htl/libc-lockP.h @@ -118,9 +118,6 @@ extern int __pthread_atfork (void (*__prepare) (void), #if !defined(__NO_WEAK_PTHREAD_ALIASES) && !IS_IN (libpthread) # ifdef weak_extern weak_extern (__pthread_mutex_destroy) -weak_extern (__pthread_mutex_lock) -weak_extern (__pthread_mutex_trylock) -weak_extern (__pthread_mutex_unlock) weak_extern (__pthread_rwlock_init) weak_extern (__pthread_rwlock_destroy) weak_extern (__pthread_rwlock_rdlock) @@ -137,9 +134,6 @@ weak_extern (__pthread_atfork) weak_extern (__pthread_setcancelstate) # else # pragma weak __pthread_mutex_destroy -# pragma weak __pthread_mutex_lock -# pragma weak __pthread_mutex_trylock -# pragma weak __pthread_mutex_unlock # pragma weak __pthread_rwlock_destroy # pragma weak __pthread_rwlock_rdlock # pragma weak __pthread_rwlock_tryrdlock diff --git a/sysdeps/htl/pthread-functions.h b/sysdeps/htl/pthread-functions.h index 54b773344d..c44c9038f3 100644 --- a/sysdeps/htl/pthread-functions.h +++ b/sysdeps/htl/pthread-functions.h @@ -23,9 +23,6 @@ void __pthread_exit (void *) __attribute__ ((__noreturn__)); int _pthread_mutex_destroy (pthread_mutex_t *); -int __pthread_mutex_lock (pthread_mutex_t *); -int __pthread_mutex_trylock (pthread_mutex_t *); -int __pthread_mutex_unlock (pthread_mutex_t *); int __pthread_setcancelstate (int, int *); int __pthread_setcanceltype (int, int *); struct __pthread_cancelation_handler **__pthread_get_cleanup_stack (void); @@ -48,9 +45,6 @@ struct pthread_functions { void (*ptr___pthread_exit) (void *) __attribute__ ((__noreturn__)); int (*ptr_pthread_mutex_destroy) (pthread_mutex_t *); - int (*ptr_pthread_mutex_lock) (pthread_mutex_t *); - int (*ptr_pthread_mutex_trylock) (pthread_mutex_t *); - int (*ptr_pthread_mutex_unlock) (pthread_mutex_t *); int (*ptr___pthread_setcancelstate) (int, int *); int (*ptr_pthread_setcanceltype) (int, int *); struct __pthread_cancelation_handler **(*ptr___pthread_get_cleanup_stack) (void); diff --git a/sysdeps/htl/pthreadP.h b/sysdeps/htl/pthreadP.h index bb17391cb3..a2a0a932b7 100644 --- a/sysdeps/htl/pthreadP.h +++ b/sysdeps/htl/pthreadP.h @@ -33,12 +33,19 @@ extern void __pthread_init_static_tls (struct link_map *) attribute_hidden; extern int __pthread_mutex_init (pthread_mutex_t *__mutex, const pthread_mutexattr_t *__attr); libc_hidden_proto (__pthread_mutex_init) +extern int __pthread_mutex_clocklock (pthread_mutex_t *__mutex, clockid_t __clockid, + const struct timespec *__abstime); +libc_hidden_proto (__pthread_mutex_clocklock) extern int __pthread_mutex_destroy (pthread_mutex_t *__mutex); extern int __pthread_mutex_lock (pthread_mutex_t *__mutex); +libc_hidden_proto (__pthread_mutex_lock) extern int __pthread_mutex_trylock (pthread_mutex_t *_mutex); +libc_hidden_proto (__pthread_mutex_trylock) extern int __pthread_mutex_timedlock (pthread_mutex_t *__mutex, const struct timespec *__abstime); +libc_hidden_proto (__pthread_mutex_timedlock) extern int __pthread_mutex_unlock (pthread_mutex_t *__mutex); +libc_hidden_proto (__pthread_mutex_unlock) extern int __pthread_mutexattr_getpshared(const pthread_mutexattr_t *__restrict __attr, int *__restrict __pshared); libc_hidden_proto (__pthread_mutexattr_getpshared) @@ -164,10 +171,6 @@ hidden_proto (__pthread_key_create) hidden_proto (__pthread_getspecific) hidden_proto (__pthread_setspecific) hidden_proto (__pthread_mutex_destroy) -hidden_proto (__pthread_mutex_lock) -hidden_proto (__pthread_mutex_trylock) -hidden_proto (__pthread_mutex_unlock) -hidden_proto (__pthread_mutex_timedlock) hidden_proto (__pthread_get_cleanup_stack) #endif diff --git a/sysdeps/htl/timer_routines.c b/sysdeps/htl/timer_routines.c index 2039e0ba2e..d6ee65d69b 100644 --- a/sysdeps/htl/timer_routines.c +++ b/sysdeps/htl/timer_routines.c @@ -265,7 +265,7 @@ thread_cleanup (void *val) /* How did the signal thread get killed? */ assert (thread != &__timer_signal_thread_rclk); - pthread_mutex_lock (&__timer_mutex); + __pthread_mutex_lock (&__timer_mutex); thread->exists = 0; @@ -277,7 +277,7 @@ thread_cleanup (void *val) else (void) __timer_thread_start (thread); - pthread_mutex_unlock (&__timer_mutex); + __pthread_mutex_unlock (&__timer_mutex); /* Unblock potentially blocked timer_delete(). */ __pthread_cond_broadcast (&thread->cond); @@ -291,7 +291,7 @@ thread_expire_timer (struct thread_node *self, struct timer_node *timer) { self->current_timer = timer; /* Lets timer_delete know timer is running. */ - pthread_mutex_unlock (&__timer_mutex); + __pthread_mutex_unlock (&__timer_mutex); switch (__builtin_expect (timer->event.sigev_notify, SIGEV_SIGNAL)) { @@ -334,7 +334,7 @@ thread_expire_timer (struct thread_node *self, struct timer_node *timer) break; } - pthread_mutex_lock (&__timer_mutex); + __pthread_mutex_lock (&__timer_mutex); self->current_timer = 0; @@ -358,7 +358,7 @@ thread_func (void *arg) pthread_cleanup_push (thread_cleanup, self); - pthread_mutex_lock (&__timer_mutex); + __pthread_mutex_lock (&__timer_mutex); while (1) { @@ -550,5 +550,5 @@ __timer_dealloc (struct timer_node *timer) void __timer_mutex_cancel_handler (void *arg) { - pthread_mutex_unlock (arg); + __pthread_mutex_unlock (arg); } diff --git a/sysdeps/mach/hurd/htl/pt-mutex-lock.c b/sysdeps/mach/hurd/htl/pt-mutex-lock.c index e1e40d8db5..7d93ddd660 100644 --- a/sysdeps/mach/hurd/htl/pt-mutex-lock.c +++ b/sysdeps/mach/hurd/htl/pt-mutex-lock.c @@ -16,13 +16,14 @@ License along with the GNU C Library; if not, see <https://www.gnu.org/licenses/>. */ -#include <pthread.h> +#include <pthreadP.h> #include <stdlib.h> #include <assert.h> #include <pt-internal.h> #include "pt-mutex.h" #include <hurdlock.h> #include <unistd.h> +#include <shlib-compat.h> int __pthread_mutex_lock (pthread_mutex_t *mtxp) @@ -76,7 +77,9 @@ __pthread_mutex_lock (pthread_mutex_t *mtxp) return ret; } +libc_hidden_def (__pthread_mutex_lock) +versioned_symbol (libc, __pthread_mutex_lock, pthread_mutex_lock, GLIBC_2_21); -hidden_def (__pthread_mutex_lock) -strong_alias (__pthread_mutex_lock, _pthread_mutex_lock) -weak_alias (__pthread_mutex_lock, pthread_mutex_lock) +#if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_12, GLIBC_2_21) +compat_symbol (libc, __pthread_mutex_lock, pthread_mutex_lock, GLIBC_2_12); +#endif diff --git a/sysdeps/mach/hurd/htl/pt-mutex-timedlock.c b/sysdeps/mach/hurd/htl/pt-mutex-timedlock.c index 71ce28a319..90fa407e99 100644 --- a/sysdeps/mach/hurd/htl/pt-mutex-timedlock.c +++ b/sysdeps/mach/hurd/htl/pt-mutex-timedlock.c @@ -16,7 +16,7 @@ License along with the GNU C Library; if not, see <https://www.gnu.org/licenses/>. */ -#include <pthread.h> +#include <pthreadP.h> #include <stdlib.h> #include <assert.h> #include <pt-internal.h> @@ -79,6 +79,7 @@ __pthread_mutex_clocklock (pthread_mutex_t *mtxp, return ret; } +libc_hidden_def (__pthread_mutex_clocklock) weak_alias (__pthread_mutex_clocklock, pthread_mutex_clocklock) int @@ -87,5 +88,5 @@ __pthread_mutex_timedlock (pthread_mutex_t *mutex, { return __pthread_mutex_clocklock (mutex, CLOCK_REALTIME, tsp); } +libc_hidden_def (__pthread_mutex_timedlock) weak_alias (__pthread_mutex_timedlock, pthread_mutex_timedlock) -hidden_def (__pthread_mutex_timedlock) diff --git a/sysdeps/mach/hurd/htl/pt-mutex-trylock.c b/sysdeps/mach/hurd/htl/pt-mutex-trylock.c index 5435921231..f1b451e803 100644 --- a/sysdeps/mach/hurd/htl/pt-mutex-trylock.c +++ b/sysdeps/mach/hurd/htl/pt-mutex-trylock.c @@ -16,13 +16,14 @@ License along with the GNU C Library; if not, see <https://www.gnu.org/licenses/>. */ -#include <pthread.h> +#include <pthreadP.h> #include <stdlib.h> #include <assert.h> #include <pt-internal.h> #include "pt-mutex.h" #include <hurdlock.h> #include <unistd.h> +#include <shlib-compat.h> int __pthread_mutex_trylock (pthread_mutex_t *mtxp) @@ -80,7 +81,9 @@ __pthread_mutex_trylock (pthread_mutex_t *mtxp) return ret; } +libc_hidden_def (__pthread_mutex_trylock) +versioned_symbol (libc, __pthread_mutex_trylock, pthread_mutex_trylock, GLIBC_2_42); -hidden_def (__pthread_mutex_trylock) -strong_alias (__pthread_mutex_trylock, _pthread_mutex_trylock) -weak_alias (__pthread_mutex_trylock, pthread_mutex_trylock) +#if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_12, GLIBC_2_42) +compat_symbol (libc, __pthread_mutex_trylock, pthread_mutex_trylock, GLIBC_2_12); +#endif diff --git a/sysdeps/mach/hurd/htl/pt-mutex-unlock.c b/sysdeps/mach/hurd/htl/pt-mutex-unlock.c index b140416163..1732c34136 100644 --- a/sysdeps/mach/hurd/htl/pt-mutex-unlock.c +++ b/sysdeps/mach/hurd/htl/pt-mutex-unlock.c @@ -16,13 +16,14 @@ License along with the GNU C Library; if not, see <https://www.gnu.org/licenses/>. */ -#include <pthread.h> +#include <pthreadP.h> #include <stdlib.h> #include <assert.h> #include <pt-internal.h> #include "pt-mutex.h" #include <hurdlock.h> #include <unistd.h> +#include <shlib-compat.h> int __pthread_mutex_unlock (pthread_mutex_t *mtxp) @@ -87,7 +88,9 @@ __pthread_mutex_unlock (pthread_mutex_t *mtxp) return ret; } +libc_hidden_def (__pthread_mutex_unlock) +versioned_symbol (libc, __pthread_mutex_unlock, pthread_mutex_unlock, GLIBC_2_21); -hidden_def (__pthread_mutex_unlock) -strong_alias (__pthread_mutex_unlock, _pthread_mutex_unlock) -weak_alias (__pthread_mutex_unlock, pthread_mutex_unlock) +#if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_12, GLIBC_2_21) +compat_symbol (libc, __pthread_mutex_unlock, pthread_mutex_unlock, GLIBC_2_12); +#endif diff --git a/sysdeps/mach/hurd/i386/libc.abilist b/sysdeps/mach/hurd/i386/libc.abilist index e9559bd265..aba93a281b 100644 --- a/sysdeps/mach/hurd/i386/libc.abilist +++ b/sysdeps/mach/hurd/i386/libc.abilist @@ -64,6 +64,10 @@ GLIBC_2.12 pthread_condattr_setpshared F GLIBC_2.12 pthread_equal F GLIBC_2.12 pthread_getschedparam F GLIBC_2.12 pthread_mutex_init F +GLIBC_2.12 pthread_mutex_lock F +GLIBC_2.12 pthread_mutex_timedlock F +GLIBC_2.12 pthread_mutex_trylock F +GLIBC_2.12 pthread_mutex_unlock F GLIBC_2.12 pthread_mutexattr_destroy F GLIBC_2.12 pthread_mutexattr_getprioceiling F GLIBC_2.12 pthread_mutexattr_getprotocol F @@ -2264,6 +2268,7 @@ GLIBC_2.32 __libc_single_threaded D 0x1 GLIBC_2.32 mach_print F GLIBC_2.32 mremap F GLIBC_2.32 pthread_cond_clockwait F +GLIBC_2.32 pthread_mutex_clocklock F GLIBC_2.32 pthread_mutexattr_getrobust F GLIBC_2.32 pthread_mutexattr_getrobust_np F GLIBC_2.32 pthread_mutexattr_setrobust F @@ -2549,6 +2554,7 @@ GLIBC_2.41 pthread_mutexattr_setrobust F GLIBC_2.41 pthread_mutexattr_setrobust_np F GLIBC_2.41 pthread_mutexattr_settype F GLIBC_2.41 pthread_sigmask F +GLIBC_2.42 pthread_mutex_trylock F GLIBC_2.5 __readlinkat_chk F GLIBC_2.5 inet6_opt_append F GLIBC_2.5 inet6_opt_find F diff --git a/sysdeps/mach/hurd/i386/libpthread.abilist b/sysdeps/mach/hurd/i386/libpthread.abilist index 6b330744bb..8c53b8d0ee 100644 --- a/sysdeps/mach/hurd/i386/libpthread.abilist +++ b/sysdeps/mach/hurd/i386/libpthread.abilist @@ -43,12 +43,8 @@ GLIBC_2.12 pthread_key_delete F GLIBC_2.12 pthread_kill F GLIBC_2.12 pthread_mutex_destroy F GLIBC_2.12 pthread_mutex_getprioceiling F -GLIBC_2.12 pthread_mutex_lock F GLIBC_2.12 pthread_mutex_setprioceiling F -GLIBC_2.12 pthread_mutex_timedlock F GLIBC_2.12 pthread_mutex_transfer_np F -GLIBC_2.12 pthread_mutex_trylock F -GLIBC_2.12 pthread_mutex_unlock F GLIBC_2.12 pthread_once F GLIBC_2.12 pthread_rwlock_destroy F GLIBC_2.12 pthread_rwlock_init F @@ -106,7 +102,6 @@ GLIBC_2.32 mtx_timedlock F GLIBC_2.32 mtx_trylock F GLIBC_2.32 mtx_unlock F GLIBC_2.32 pthread_clockjoin_np F -GLIBC_2.32 pthread_mutex_clocklock F GLIBC_2.32 pthread_mutex_consistent F GLIBC_2.32 pthread_mutex_consistent_np F GLIBC_2.32 pthread_rwlock_clockrdlock F diff --git a/sysdeps/mach/hurd/x86_64/libc.abilist b/sysdeps/mach/hurd/x86_64/libc.abilist index aaf55cbaf4..2251371451 100644 --- a/sysdeps/mach/hurd/x86_64/libc.abilist +++ b/sysdeps/mach/hurd/x86_64/libc.abilist @@ -1547,9 +1547,12 @@ GLIBC_2.38 pthread_condattr_setpshared F GLIBC_2.38 pthread_equal F GLIBC_2.38 pthread_exit F GLIBC_2.38 pthread_getschedparam F +GLIBC_2.38 pthread_mutex_clocklock F GLIBC_2.38 pthread_mutex_destroy F GLIBC_2.38 pthread_mutex_init F GLIBC_2.38 pthread_mutex_lock F +GLIBC_2.38 pthread_mutex_timedlock F +GLIBC_2.38 pthread_mutex_trylock F GLIBC_2.38 pthread_mutex_unlock F GLIBC_2.38 pthread_mutexattr_destroy F GLIBC_2.38 pthread_mutexattr_getprioceiling F @@ -2237,6 +2240,7 @@ GLIBC_2.41 pthread_mutexattr_setrobust F GLIBC_2.41 pthread_mutexattr_setrobust_np F GLIBC_2.41 pthread_mutexattr_settype F GLIBC_2.41 pthread_sigmask F +GLIBC_2.42 pthread_mutex_trylock F HURD_CTHREADS_0.3 __cthread_getspecific F HURD_CTHREADS_0.3 __cthread_keycreate F HURD_CTHREADS_0.3 __cthread_setspecific F diff --git a/sysdeps/mach/hurd/x86_64/libpthread.abilist b/sysdeps/mach/hurd/x86_64/libpthread.abilist index 047d685a78..bd5e12adcc 100644 --- a/sysdeps/mach/hurd/x86_64/libpthread.abilist +++ b/sysdeps/mach/hurd/x86_64/libpthread.abilist @@ -61,17 +61,12 @@ GLIBC_2.38 pthread_join F GLIBC_2.38 pthread_key_create F GLIBC_2.38 pthread_key_delete F GLIBC_2.38 pthread_kill F -GLIBC_2.38 pthread_mutex_clocklock F GLIBC_2.38 pthread_mutex_consistent F GLIBC_2.38 pthread_mutex_consistent_np F GLIBC_2.38 pthread_mutex_destroy F GLIBC_2.38 pthread_mutex_getprioceiling F -GLIBC_2.38 pthread_mutex_lock F GLIBC_2.38 pthread_mutex_setprioceiling F -GLIBC_2.38 pthread_mutex_timedlock F GLIBC_2.38 pthread_mutex_transfer_np F -GLIBC_2.38 pthread_mutex_trylock F -GLIBC_2.38 pthread_mutex_unlock F GLIBC_2.38 pthread_once F GLIBC_2.38 pthread_rwlock_clockrdlock F GLIBC_2.38 pthread_rwlock_clockwrlock F |
