about summary refs log tree commit diff
path: root/nptl/forward.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2002-12-15 20:06:34 +0000
committerUlrich Drepper <drepper@redhat.com>2002-12-15 20:06:34 +0000
commit8454830b083e01a66c3a273fca0d7b46a7e4d0dc (patch)
tree1df090735e226d61048d2dbdddb8486de5992bf0 /nptl/forward.c
parent8361400815265a29038f6833d12fc8e830340d84 (diff)
downloadglibc-8454830b083e01a66c3a273fca0d7b46a7e4d0dc.tar.gz
glibc-8454830b083e01a66c3a273fca0d7b46a7e4d0dc.tar.xz
glibc-8454830b083e01a66c3a273fca0d7b46a7e4d0dc.zip
Update.
	* init.c (pthread_functions): New variable.
	(__pthread_initialize_minimal): Pass pointer to pthread_functions
	(or NULL) to __libc_pthread_init.
	* forward.c: Rewrite to use __libc:pthread_functions array to get
	function addresses.
	* sysdeps/unix/sysv/linux/fork.h: Remove __libc_pthread_init
	prototype.
	* sysdeps/unix/sysv/linux/libc_pthread_init.c (__libc_pthread_init):
	Take new parameter.  Copy content of variable pointed to by it
	to __libc_pthread_init.

	* pthreadP.h (struct pthread_functions): New type.
	(__libc_pthread_init): Declare.

	* pthread_attr_destroy.c: Add namespace protected alias.
	* pthread_attr_getdetachstate.c: Likewise.
	* pthread_attr_getinheritsched.c: Likewise.
	* pthread_attr_getschedparam.c: Likewise.
	* pthread_attr_getschedpolicy.c: Likewise.
	* pthread_attr_getscope.c: Likewise.
	* pthread_attr_setdetachstate.c: Likewise.
	* pthread_attr_setinheritsched.c: Likewise.
	* pthread_attr_setschedparam.c: Likewise.
	* pthread_attr_setschedpolicy.c: Likewise.
	* pthread_attr_setscope.c: Likewise.
	* pthread_cond_broadcast.c: Likewise.
	* pthread_cond_destroy.c: Likewise.
	* pthread_cond_init.c: Likewise.
	* pthread_cond_signal.c: Likewise.
	* pthread_cond_wait.c: Likewise.
	* pthread_condattr_destroy.c: Likewise.
	* pthread_condattr_init.c: Likewise.
	* pthread_equal.c: Likewise.
	* pthread_exit.c: Likewise.
	* pthread_getschedparam.c: Likewise.
	* pthread_self.c: Likewise.
	* pthread_setcancelstate.c: Likewise.
	* pthread_setschedparam.c: Likewise.
	* pthread_mutex_destroy.c: Likewise.
	* pthread_mutex_init.c: Likewise.
	* pthreadP.h: Add prototypes for the aliases.
Diffstat (limited to 'nptl/forward.c')
-rw-r--r--nptl/forward.c36
1 files changed, 9 insertions, 27 deletions
diff --git a/nptl/forward.c b/nptl/forward.c
index 6c278c0690..e178136737 100644
--- a/nptl/forward.c
+++ b/nptl/forward.c
@@ -18,51 +18,33 @@
    02111-1307 USA.  */
 
 #include <dlfcn.h>
-#include <pthread.h>
+#include <pthreadP.h>
 #include <stdlib.h>
 
 #include <shlib-compat.h>
 #include <atomic.h>
 
 
-#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2)
-static void *libpthread_handle;
-
-
-static void
-test_loaded (void)
-{
-  /* While we are getting the result set the handle to (void *) -1 to
-     avoid recursive calls.  */
-  atomic_compare_and_exchange_acq (&libpthread_handle, (void *) -1l, NULL);
-
-  void *h = __libc_dlopen_mode ("libpthread.so.0", RTLD_LAZY | RTLD_NOLOAD);
+/* Pointers to the libc functions.  */
+struct pthread_functions __libc_pthread_functions attribute_hidden;
 
-  libpthread_handle = h ?: (void *) -1l;
-}
 
-
-#define FORWARD3(name, rettype, decl, params, defaction, version) \
+#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2)
+# define FORWARD3(name, rettype, decl, params, defaction, version) \
 rettype									      \
 __noexport_##name decl							      \
 {									      \
-  if (libpthread_handle == NULL)					      \
-    test_loaded ();							      \
-									      \
-  if (libpthread_handle == (void *) -1l)				      \
+  if (__libc_pthread_functions.ptr_##name == NULL)			      \
     defaction;								      \
 									      \
-  static __typeof (name) *p;						      \
-  p = __libc_dlsym (libpthread_handle, #name);				      \
-									      \
-  return p params;							      \
+  return __libc_pthread_functions.ptr_##name params;			      \
 }									      \
 compat_symbol (libc, __noexport_##name, name, version)
 
-#define FORWARD2(name, decl, params, defretval, version) \
+# define FORWARD2(name, decl, params, defretval, version) \
   FORWARD3 (name, int, decl, params, return defretval, version)
 
-#define FORWARD(name, decl, params, defretval) \
+# define FORWARD(name, decl, params, defretval) \
   FORWARD2 (name, decl, params, defretval, GLIBC_2_0)