From c310aa40efd3b2d954354e0550b1bbb6a8e7e349 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sat, 21 Apr 2012 23:15:55 +0000 Subject: Add glibc build support * Makeconfig, Versions, configure.in, forward.c, libc_pthread_init.c, pthread/pthread-functions.h, shlib-versions, sysdeps/i386/Implies, sysdeps/mach/hurd/Implies, sysdeps/mach/hurd/i386/Implies: New files. * Makefile: Add glibc rules, enabled when IN_GLIBC is defined to yes, when $(..) is defined. * pthread/pt-initialize.c [IS_IN_libpthread] (pthread_functions): New variable. [IS_IN_libpthread] (__pthread_initialize): Call __libc_pthread_init. --- pthread/pt-initialize.c | 50 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) (limited to 'pthread/pt-initialize.c') diff --git a/pthread/pt-initialize.c b/pthread/pt-initialize.c index cf32b8b..f0ef8f8 100644 --- a/pthread/pt-initialize.c +++ b/pthread/pt-initialize.c @@ -23,11 +23,61 @@ #include #include +#include +#include + DEFINE_HOOK (__pthread_init, (void)); +#ifdef IS_IN_libpthread +#ifdef SHARED +static const struct pthread_functions pthread_functions = + { + .ptr_pthread_attr_destroy = __pthread_attr_destroy, + .ptr_pthread_attr_init = __pthread_attr_init, + .ptr_pthread_attr_getdetachstate = __pthread_attr_getdetachstate, + .ptr_pthread_attr_setdetachstate = __pthread_attr_setdetachstate, + .ptr_pthread_attr_getinheritsched = __pthread_attr_getinheritsched, + .ptr_pthread_attr_setinheritsched = __pthread_attr_setinheritsched, + .ptr_pthread_attr_getschedparam = __pthread_attr_getschedparam, + .ptr_pthread_attr_setschedparam = __pthread_attr_setschedparam, + .ptr_pthread_attr_getschedpolicy = __pthread_attr_getschedpolicy, + .ptr_pthread_attr_setschedpolicy = __pthread_attr_setschedpolicy, + .ptr_pthread_attr_getscope = __pthread_attr_getscope, + .ptr_pthread_attr_setscope = __pthread_attr_setscope, + .ptr_pthread_condattr_destroy = __pthread_condattr_destroy, + .ptr_pthread_condattr_init = __pthread_condattr_init, + .ptr_pthread_cond_broadcast = __pthread_cond_broadcast, + .ptr_pthread_cond_destroy = __pthread_cond_destroy, + .ptr_pthread_cond_init = __pthread_cond_init, + .ptr_pthread_cond_signal = __pthread_cond_signal, + .ptr_pthread_cond_wait = __pthread_cond_wait, + .ptr_pthread_cond_timedwait = __pthread_cond_timedwait, + .ptr_pthread_equal = __pthread_equal, + .ptr_pthread_exit = __pthread_exit, + .ptr_pthread_getschedparam = __pthread_getschedparam, + .ptr_pthread_setschedparam = __pthread_setschedparam, + .ptr_pthread_mutex_destroy = _pthread_mutex_destroy, + .ptr_pthread_mutex_init = _pthread_mutex_init, + .ptr_pthread_mutex_lock = __pthread_mutex_lock, + .ptr_pthread_mutex_trylock = __pthread_mutex_trylock, + .ptr_pthread_mutex_unlock = __pthread_mutex_unlock, + .ptr_pthread_self = __pthread_self, + .ptr_pthread_setcancelstate = __pthread_setcancelstate, + .ptr_pthread_setcanceltype = __pthread_setcanceltype, + .ptr___pthread_get_cleanup_stack = __pthread_get_cleanup_stack, + }; +# define ptr_pthread_functions &pthread_functions +#else +# define ptr_pthread_functions NULL +#endif +#endif /* IS_IN_libpthread */ + /* Initialize the pthreads library. */ void __pthread_initialize (void) { +#ifdef IS_IN_libpthread + __libc_pthread_init(ptr_pthread_functions); +#endif RUN_HOOK (__pthread_init, ()); } -- cgit v1.2.3 From 71dcdb6d0189761ecc27691932502eacdf7e6b2c Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Mon, 23 Apr 2012 18:00:21 +0000 Subject: Rename __pthread_initialize into __pthread_init The former conflicts with usage in glibc. * pthread/pt-initialize.c (__pthread_initialize): Rename into __pthread_init. * pthread/pt-internal.h (__pthread_initialize): Likewise. * sysdeps/l4/hurd/pt-sysdep.c (init_routine): Likewise. * sysdeps/mach/hurd/pt-sysdep.c (init_routine): Likewise. --- pthread/pt-initialize.c | 2 +- pthread/pt-internal.h | 2 +- sysdeps/l4/hurd/pt-sysdep.c | 2 +- sysdeps/mach/hurd/pt-sysdep.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'pthread/pt-initialize.c') diff --git a/pthread/pt-initialize.c b/pthread/pt-initialize.c index f0ef8f8..39f1aed 100644 --- a/pthread/pt-initialize.c +++ b/pthread/pt-initialize.c @@ -74,7 +74,7 @@ static const struct pthread_functions pthread_functions = /* Initialize the pthreads library. */ void -__pthread_initialize (void) +__pthread_init (void) { #ifdef IS_IN_libpthread __libc_pthread_init(ptr_pthread_functions); diff --git a/pthread/pt-internal.h b/pthread/pt-internal.h index a1e90aa..a1da377 100644 --- a/pthread/pt-internal.h +++ b/pthread/pt-internal.h @@ -188,7 +188,7 @@ extern struct __pthread *_pthread_self (void); /* Initialize the pthreads library. */ -extern void __pthread_initialize (void); +extern void __pthread_init (void); /* Internal version of pthread_create. Rather than return the new tid, we return the whole __pthread structure in *PTHREAD. */ diff --git a/sysdeps/l4/hurd/pt-sysdep.c b/sysdeps/l4/hurd/pt-sysdep.c index c23364c..1df6c2e 100644 --- a/sysdeps/l4/hurd/pt-sysdep.c +++ b/sysdeps/l4/hurd/pt-sysdep.c @@ -45,7 +45,7 @@ static void init_routine (void (*entry) (void *), void *arg) { /* Initialize the library. */ - __pthread_initialize (); + __pthread_init(); struct __pthread *thread; int err; diff --git a/sysdeps/mach/hurd/pt-sysdep.c b/sysdeps/mach/hurd/pt-sysdep.c index 5e07006..95a4d36 100644 --- a/sysdeps/mach/hurd/pt-sysdep.c +++ b/sysdeps/mach/hurd/pt-sysdep.c @@ -45,7 +45,7 @@ init_routine (void) int err; /* Initialize the library. */ - __pthread_initialize (); + __pthread_init (); /* Create the pthread structure for the main thread (i.e. us). */ err = __pthread_create_internal (&thread, 0, 0, 0); -- cgit v1.2.3 From e84c82a43e671c7506401936ac097b55d0fb47bf Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Fri, 27 Apr 2012 01:28:16 +0000 Subject: Always pass the pthread_functions structure * pthread/pt-initialize.c (pthread_functions): Always define. (__pthread_init): Always pass address of pthread_functions. --- pthread/pt-initialize.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'pthread/pt-initialize.c') diff --git a/pthread/pt-initialize.c b/pthread/pt-initialize.c index 39f1aed..831a63d 100644 --- a/pthread/pt-initialize.c +++ b/pthread/pt-initialize.c @@ -29,7 +29,6 @@ DEFINE_HOOK (__pthread_init, (void)); #ifdef IS_IN_libpthread -#ifdef SHARED static const struct pthread_functions pthread_functions = { .ptr_pthread_attr_destroy = __pthread_attr_destroy, @@ -66,10 +65,6 @@ static const struct pthread_functions pthread_functions = .ptr_pthread_setcanceltype = __pthread_setcanceltype, .ptr___pthread_get_cleanup_stack = __pthread_get_cleanup_stack, }; -# define ptr_pthread_functions &pthread_functions -#else -# define ptr_pthread_functions NULL -#endif #endif /* IS_IN_libpthread */ /* Initialize the pthreads library. */ @@ -77,7 +72,7 @@ void __pthread_init (void) { #ifdef IS_IN_libpthread - __libc_pthread_init(ptr_pthread_functions); + __libc_pthread_init(&pthread_functions); #endif RUN_HOOK (__pthread_init, ()); } -- cgit v1.2.3