diff options
| author | Florian Weimer <fweimer@redhat.com> | 2021-04-21 19:49:50 +0200 |
|---|---|---|
| committer | Florian Weimer <fweimer@redhat.com> | 2021-04-21 19:49:50 +0200 |
| commit | 3fec7f18bfcb7044e813a12e19c3c98eb8387e26 (patch) | |
| tree | 63320bd00d52f0437c4f8676fbff561311dfdb8f /sysdeps | |
| parent | 4647ce82c733d1453611e35236b786ecd7faf598 (diff) | |
| download | glibc-3fec7f18bfcb7044e813a12e19c3c98eb8387e26.tar.xz glibc-3fec7f18bfcb7044e813a12e19c3c98eb8387e26.zip | |
nptl: Move pthread_once and __pthread_once into libc
And also the fork generation counter, __fork_generation. This
eliminates the need for __fork_generation_pointer.
call_once remains in libpthread and calls the exported __pthread_once
symbol.
pthread_once and __pthread_once have been moved using
scripts/move-symbol-to-libc.py.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diffstat (limited to 'sysdeps')
64 files changed, 131 insertions, 72 deletions
diff --git a/sysdeps/nptl/fork.c b/sysdeps/nptl/fork.c index 9737127cd6..ccdda11a7c 100644 --- a/sysdeps/nptl/fork.c +++ b/sysdeps/nptl/fork.c @@ -88,8 +88,7 @@ __libc_fork (void) struct pthread *self = THREAD_SELF; /* See __pthread_once. */ - if (__fork_generation_pointer != NULL) - *__fork_generation_pointer += __PTHREAD_ONCE_FORK_GEN_INCR; + __fork_generation += __PTHREAD_ONCE_FORK_GEN_INCR; /* Initialize the robust mutex list setting in the kernel which has been reset during the fork. We do not check for errors because if diff --git a/sysdeps/nptl/libc-lockP.h b/sysdeps/nptl/libc-lockP.h index 2c928b7a76..ca3edd0af1 100644 --- a/sysdeps/nptl/libc-lockP.h +++ b/sysdeps/nptl/libc-lockP.h @@ -238,15 +238,7 @@ _Static_assert (LLL_LOCK_INITIALIZER == 0, "LLL_LOCK_INITIALIZER != 0"); /* Call handler iff the first call. */ #define __libc_once(ONCE_CONTROL, INIT_FUNCTION) \ - do { \ - if (PTFAVAIL (__pthread_once)) \ - __libc_ptf_call_always (__pthread_once, (&(ONCE_CONTROL), \ - INIT_FUNCTION)); \ - else if ((ONCE_CONTROL) == PTHREAD_ONCE_INIT) { \ - INIT_FUNCTION (); \ - (ONCE_CONTROL) |= 2; \ - } \ - } while (0) + __pthread_once (&(ONCE_CONTROL), INIT_FUNCTION) /* Get once control variable. */ #define __libc_once_get(ONCE_CONTROL) ((ONCE_CONTROL) != PTHREAD_ONCE_INIT) @@ -334,6 +326,7 @@ extern void *__pthread_getspecific (pthread_key_t __key); extern int __pthread_once (pthread_once_t *__once_control, void (*__init_routine) (void)); +libc_hidden_proto (__pthread_once) extern int __pthread_atfork (void (*__prepare) (void), void (*__parent) (void), @@ -364,7 +357,6 @@ weak_extern (__pthread_rwlock_unlock) weak_extern (__pthread_key_create) weak_extern (__pthread_setspecific) weak_extern (__pthread_getspecific) -weak_extern (__pthread_once) weak_extern (__pthread_initialize) weak_extern (__pthread_atfork) weak_extern (__pthread_setcancelstate) @@ -386,7 +378,6 @@ weak_extern (__pthread_setcancelstate) # pragma weak __pthread_key_create # pragma weak __pthread_setspecific # pragma weak __pthread_getspecific -# pragma weak __pthread_once # pragma weak __pthread_initialize # pragma weak __pthread_atfork # pragma weak __pthread_setcancelstate diff --git a/sysdeps/nptl/pthread-functions.h b/sysdeps/nptl/pthread-functions.h index 1bbe609598..6ef7602cb9 100644 --- a/sysdeps/nptl/pthread-functions.h +++ b/sysdeps/nptl/pthread-functions.h @@ -49,7 +49,6 @@ struct pthread_functions int (*ptr_pthread_mutex_unlock) (pthread_mutex_t *); int (*ptr___pthread_setcancelstate) (int, int *); int (*ptr_pthread_setcanceltype) (int, int *); - int (*ptr___pthread_once) (pthread_once_t *, void (*) (void)); int (*ptr___pthread_rwlock_rdlock) (pthread_rwlock_t *); int (*ptr___pthread_rwlock_wrlock) (pthread_rwlock_t *); int (*ptr___pthread_rwlock_unlock) (pthread_rwlock_t *); diff --git a/sysdeps/unix/sysv/linux/aarch64/libc.abilist b/sysdeps/unix/sysv/linux/aarch64/libc.abilist index 12895b08b5..bc77a51673 100644 --- a/sysdeps/unix/sysv/linux/aarch64/libc.abilist +++ b/sysdeps/unix/sysv/linux/aarch64/libc.abilist @@ -339,6 +339,7 @@ GLIBC_2.17 __profile_frequency F GLIBC_2.17 __progname D 0x8 GLIBC_2.17 __progname_full D 0x8 GLIBC_2.17 __pthread_cleanup_routine F +GLIBC_2.17 __pthread_once F GLIBC_2.17 __ptsname_r_chk F GLIBC_2.17 __pwrite64 F GLIBC_2.17 __rawmemchr F @@ -1455,6 +1456,7 @@ GLIBC_2.17 pthread_mutex_destroy F GLIBC_2.17 pthread_mutex_init F GLIBC_2.17 pthread_mutex_lock F GLIBC_2.17 pthread_mutex_unlock F +GLIBC_2.17 pthread_once F GLIBC_2.17 pthread_self F GLIBC_2.17 pthread_setcancelstate F GLIBC_2.17 pthread_setcanceltype F @@ -2182,5 +2184,7 @@ GLIBC_2.33 stat F GLIBC_2.33 stat64 F GLIBC_2.34 __libc_start_main F GLIBC_2.34 __pthread_cleanup_routine F +GLIBC_2.34 __pthread_once F GLIBC_2.34 pthread_kill F GLIBC_2.34 pthread_mutex_consistent F +GLIBC_2.34 pthread_once F diff --git a/sysdeps/unix/sysv/linux/aarch64/libpthread.abilist b/sysdeps/unix/sysv/linux/aarch64/libpthread.abilist index 1af15835d7..d7db479580 100644 --- a/sysdeps/unix/sysv/linux/aarch64/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/aarch64/libpthread.abilist @@ -13,7 +13,6 @@ GLIBC_2.17 __pthread_mutex_unlock F GLIBC_2.17 __pthread_mutexattr_destroy F GLIBC_2.17 __pthread_mutexattr_init F GLIBC_2.17 __pthread_mutexattr_settype F -GLIBC_2.17 __pthread_once F GLIBC_2.17 __pthread_register_cancel F GLIBC_2.17 __pthread_register_cancel_defer F GLIBC_2.17 __pthread_rwlock_destroy F @@ -91,7 +90,6 @@ GLIBC_2.17 pthread_mutexattr_setpshared F GLIBC_2.17 pthread_mutexattr_setrobust F GLIBC_2.17 pthread_mutexattr_setrobust_np F GLIBC_2.17 pthread_mutexattr_settype F -GLIBC_2.17 pthread_once F GLIBC_2.17 pthread_rwlock_destroy F GLIBC_2.17 pthread_rwlock_init F GLIBC_2.17 pthread_rwlock_rdlock F diff --git a/sysdeps/unix/sysv/linux/alpha/libc.abilist b/sysdeps/unix/sysv/linux/alpha/libc.abilist index 732ea877dc..a178ce7f31 100644 --- a/sysdeps/unix/sysv/linux/alpha/libc.abilist +++ b/sysdeps/unix/sysv/linux/alpha/libc.abilist @@ -188,6 +188,7 @@ GLIBC_2.0 __printf_fp F GLIBC_2.0 __profile_frequency F GLIBC_2.0 __progname D 0x8 GLIBC_2.0 __progname_full D 0x8 +GLIBC_2.0 __pthread_once F GLIBC_2.0 __rcmd_errstr D 0x8 GLIBC_2.0 __read F GLIBC_2.0 __realloc_hook D 0x8 @@ -892,6 +893,7 @@ GLIBC_2.0 pthread_mutex_destroy F GLIBC_2.0 pthread_mutex_init F GLIBC_2.0 pthread_mutex_lock F GLIBC_2.0 pthread_mutex_unlock F +GLIBC_2.0 pthread_once F GLIBC_2.0 pthread_self F GLIBC_2.0 pthread_setcancelstate F GLIBC_2.0 pthread_setcanc |
