summaryrefslogtreecommitdiff
path: root/sysdeps
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2025-11-16 14:09:11 +0000
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2025-11-17 00:38:37 +0000
commit5b6ee0e0ba7321ca37db12a942493e4ea8eead92 (patch)
tree831dc5b6ba00e85e9ecf5a3df8cf4a7ab36c7fd5 /sysdeps
parentf63dd924312919667f8c71f7701523dfdc542067 (diff)
htl: move pthread_create to into libc
This is notably needed for the main thread structure to be always initialized so that some pthread functions can work from the main thread without other threads, e.g. pthread_cancel.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/htl/pthreadP.h7
-rw-r--r--sysdeps/mach/hurd/htl/pt-sysdep.c14
-rw-r--r--sysdeps/mach/hurd/i386/libc.abilist2
-rw-r--r--sysdeps/mach/hurd/i386/libpthread.abilist1
-rw-r--r--sysdeps/mach/hurd/x86_64/libc.abilist2
-rw-r--r--sysdeps/mach/hurd/x86_64/libpthread.abilist1
6 files changed, 11 insertions, 16 deletions
diff --git a/sysdeps/htl/pthreadP.h b/sysdeps/htl/pthreadP.h
index 471a4cfa43..5fb6469714 100644
--- a/sysdeps/htl/pthreadP.h
+++ b/sysdeps/htl/pthreadP.h
@@ -24,7 +24,6 @@
#include <pthread.h>
#include <link.h>
#include <bits/cancelation.h>
-#include <libc-symbols.h>
/* Attribute to indicate thread creation was issued from C11 thrd_create. */
#define ATTR_C11_THREAD ((void*)(uintptr_t)-1)
@@ -170,6 +169,8 @@ libc_hidden_proto (__pthread_setcanceltype);
extern int __pthread_sigmask (int, const sigset_t *, sigset_t *);
libc_hidden_proto (__pthread_sigmask);
+int __libc_pthread_create (pthread_t * thread, const pthread_attr_t * attr,
+ void *(*start_routine) (void *), void *arg);
int __pthread_create (pthread_t *newthread,
const pthread_attr_t *attr,
void *(*start_routine) (void *), void *arg);
@@ -232,9 +233,7 @@ libc_hidden_proto (__pthread_attr_init)
libc_hidden_proto (__pthread_condattr_init)
libc_hidden_proto (__pthread_get_cleanup_stack)
-#if IS_IN (libpthread)
-hidden_proto (__pthread_create)
-#endif
+libc_hidden_proto (__pthread_create)
#define ASSERT_TYPE_SIZE(type, size) \
_Static_assert (sizeof (type) == size, \
diff --git a/sysdeps/mach/hurd/htl/pt-sysdep.c b/sysdeps/mach/hurd/htl/pt-sysdep.c
index 43745095bf..4d6a710ca8 100644
--- a/sysdeps/mach/hurd/htl/pt-sysdep.c
+++ b/sysdeps/mach/hurd/htl/pt-sysdep.c
@@ -26,6 +26,9 @@
#include <pt-internal.h>
#include <pthreadP.h>
#include <stackinfo.h>
+#include <ldsodefs.h>
+#include <register-atfork.h>
+#include <dso_handle.h>
static void
reset_pthread_total (void)
@@ -118,7 +121,7 @@ _init_routine (void *stack)
when we return from here) shouldn't be seen as a user thread. */
__pthread_total--;
- __pthread_atfork (NULL, NULL, reset_pthread_total);
+ __register_atfork (NULL, NULL, reset_pthread_total, __dso_handle);
GL(dl_init_static_tls) = &__pthread_init_static_tls;
@@ -131,12 +134,3 @@ __pthread_initialize_minimal (void)
{
_init_routine (__libc_stack_end);
}
-
-#ifdef SHARED
-__attribute__ ((constructor))
-static void
-dynamic_init_routine (void)
-{
- _init_routine (__libc_stack_end);
-}
-#endif
diff --git a/sysdeps/mach/hurd/i386/libc.abilist b/sysdeps/mach/hurd/i386/libc.abilist
index bbd00ed11a..f7c323c834 100644
--- a/sysdeps/mach/hurd/i386/libc.abilist
+++ b/sysdeps/mach/hurd/i386/libc.abilist
@@ -76,6 +76,7 @@ GLIBC_2.12 pthread_condattr_getpshared F
GLIBC_2.12 pthread_condattr_init F
GLIBC_2.12 pthread_condattr_setclock F
GLIBC_2.12 pthread_condattr_setpshared F
+GLIBC_2.12 pthread_create F
GLIBC_2.12 pthread_detach F
GLIBC_2.12 pthread_equal F
GLIBC_2.12 pthread_exit F
@@ -2670,6 +2671,7 @@ GLIBC_2.43 memalignment F
GLIBC_2.43 memset_explicit F
GLIBC_2.43 pthread_cancel F
GLIBC_2.43 pthread_clockjoin_np F
+GLIBC_2.43 pthread_create F
GLIBC_2.43 pthread_detach F
GLIBC_2.43 pthread_getattr_np F
GLIBC_2.43 pthread_getconcurrency F
diff --git a/sysdeps/mach/hurd/i386/libpthread.abilist b/sysdeps/mach/hurd/i386/libpthread.abilist
index c55b78b01c..e1844a8f5e 100644
--- a/sysdeps/mach/hurd/i386/libpthread.abilist
+++ b/sysdeps/mach/hurd/i386/libpthread.abilist
@@ -5,7 +5,6 @@ GLIBC_2.12 __pthread_spin_trylock F
GLIBC_2.12 __pthread_spin_unlock F
GLIBC_2.12 _pthread_spin_lock F
GLIBC_2.12 pthread_atfork F
-GLIBC_2.12 pthread_create F
GLIBC_2.12 pthread_spin_destroy F
GLIBC_2.12 pthread_spin_init F
GLIBC_2.12 pthread_spin_lock F
diff --git a/sysdeps/mach/hurd/x86_64/libc.abilist b/sysdeps/mach/hurd/x86_64/libc.abilist
index 5fb477342e..b482d2d040 100644
--- a/sysdeps/mach/hurd/x86_64/libc.abilist
+++ b/sysdeps/mach/hurd/x86_64/libc.abilist
@@ -1556,6 +1556,7 @@ GLIBC_2.38 pthread_condattr_getpshared F
GLIBC_2.38 pthread_condattr_init F
GLIBC_2.38 pthread_condattr_setclock F
GLIBC_2.38 pthread_condattr_setpshared F
+GLIBC_2.38 pthread_create F
GLIBC_2.38 pthread_detach F
GLIBC_2.38 pthread_equal F
GLIBC_2.38 pthread_exit F
@@ -2348,6 +2349,7 @@ GLIBC_2.43 memalignment F
GLIBC_2.43 memset_explicit F
GLIBC_2.43 pthread_cancel F
GLIBC_2.43 pthread_clockjoin_np F
+GLIBC_2.43 pthread_create F
GLIBC_2.43 pthread_detach F
GLIBC_2.43 pthread_getattr_np F
GLIBC_2.43 pthread_getconcurrency F
diff --git a/sysdeps/mach/hurd/x86_64/libpthread.abilist b/sysdeps/mach/hurd/x86_64/libpthread.abilist
index 77d9a6601d..d4ae93df53 100644
--- a/sysdeps/mach/hurd/x86_64/libpthread.abilist
+++ b/sysdeps/mach/hurd/x86_64/libpthread.abilist
@@ -17,7 +17,6 @@ GLIBC_2.38 mtx_lock F
GLIBC_2.38 mtx_timedlock F
GLIBC_2.38 mtx_trylock F
GLIBC_2.38 mtx_unlock F
-GLIBC_2.38 pthread_create F
GLIBC_2.38 pthread_hurd_cond_timedwait_np F
GLIBC_2.38 pthread_hurd_cond_wait_np F
GLIBC_2.38 pthread_spin_destroy F