]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Update.
authorUlrich Drepper <drepper@redhat.com>
Fri, 8 Aug 2003 07:43:03 +0000 (07:43 +0000)
committerUlrich Drepper <drepper@redhat.com>
Fri, 8 Aug 2003 07:43:03 +0000 (07:43 +0000)
2003-08-07  Jakub Jelinek  <jakub@redhat.com>

* sysdeps/generic/ldsodefs.h (_rtld_global): Add
_dl_rtld_lock_recursive and _dl_rtld_unlock_recursive.
* elf/rtld.c (rtld_lock_default_lock_recursive,
rtld_lock_default_unlock_recursive): New functions.
(dl_main): Initialize _dl_rtld_lock_recursive and
_dl_rtld_unlock_recursive.

2003-08-05  Jakub Jelinek  <jakub@redhat.com>

* elf/ldconfig.c (main): Append SLIBDIR and LIBDIR to
config_file directories instead of prepending.

14 files changed:
ChangeLog
elf/ldconfig.c
elf/rtld.c
linuxthreads/ChangeLog
linuxthreads/pthread.c
linuxthreads/sysdeps/pthread/bits/libc-lock.h
nptl/ChangeLog
nptl/init.c
nptl/pt-longjmp.c
nptl/pthreadP.h
nptl/sysdeps/pthread/bits/libc-lock.h
sysdeps/generic/ldsodefs.h
sysdeps/unix/sysv/linux/fpathconf.c
sysdeps/unix/sysv/linux/pathconf.c

index 7449cb21374dd8161700f2427fa88491b963e42a..f3dbab4adde5ebc38e031eb1b4f316fb526a201a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2003-08-07  Jakub Jelinek  <jakub@redhat.com>
+
+       * sysdeps/generic/ldsodefs.h (_rtld_global): Add
+       _dl_rtld_lock_recursive and _dl_rtld_unlock_recursive.
+       * elf/rtld.c (rtld_lock_default_lock_recursive,
+       rtld_lock_default_unlock_recursive): New functions.
+       (dl_main): Initialize _dl_rtld_lock_recursive and
+       _dl_rtld_unlock_recursive.
+
+2003-08-05  Jakub Jelinek  <jakub@redhat.com>
+
+       * elf/ldconfig.c (main): Append SLIBDIR and LIBDIR to
+       config_file directories instead of prepending.
+
 2003-08-02  Ulrich Drepper  <drepper@redhat.com>
 
        * sysdeps/unix/sysv/linux/kernel-features.h: Define
index b7ac4882f59ce0cac8f6e31a90c0760c0a30f3f4..2a24a177996191a9322a5e456757f79441b5f10e 100644 (file)
@@ -1117,12 +1117,12 @@ main (int argc, char **argv)
 
   if (!opt_only_cline)
     {
+      parse_conf (config_file);
+
       /* Always add the standard search paths.  */
       add_system_dir (SLIBDIR);
       if (strcmp (SLIBDIR, LIBDIR))
        add_system_dir (LIBDIR);
-
-      parse_conf (config_file);
     }
 
   search_dirs ();
index c52909457d337974a4950cabe04a9862206ac471..8f9fc7c06387bbc28d633d94510ee77dc6626cdf 100644 (file)
@@ -588,6 +588,20 @@ _dl_initial_error_catch_tsd (void)
 }
 #endif
 
+#if defined SHARED && defined _LIBC_REENTRANT \
+    && defined __rtld_lock_default_lock_recursive
+static void rtld_lock_default_lock_recursive (void *lock)
+{
+  __rtld_lock_default_lock_recursive (lock);
+}
+
+static void rtld_lock_default_unlock_recursive (void *lock)
+{
+  __rtld_lock_default_unlock_recursive (lock);
+}
+#endif
+
+
 static const char *library_path;       /* The library search path.  */
 static const char *preloadlist;                /* The list preloaded objects.  */
 static int version_info;               /* Nonzero if information about
@@ -626,6 +640,12 @@ dl_main (const ElfW(Phdr) *phdr,
   GL(dl_init_static_tls) = &_dl_nothread_init_static_tls;
 #endif
 
+#if defined SHARED && defined _LIBC_REENTRANT \
+    && defined __rtld_lock_default_lock_recursive
+  GL(dl_rtld_lock_recursive) = rtld_lock_default_lock_recursive;
+  GL(dl_rtld_unlock_recursive) = rtld_lock_default_unlock_recursive;
+#endif
+
   /* Process the environment variable which control the behaviour.  */
   process_envvars (&mode);
 
index 89568cd7022da87e5dae080b9dd9dca44b28d06e..54d7e425acd7f1a92274fe829a5c76587cfb4b80 100644 (file)
@@ -1,3 +1,16 @@
+2003-08-07  Jakub Jelinek  <jakub@redhat.com>
+
+       * sysdeps/pthread/bits/libc-lock.h [_LIBC && SHARED]
+       (__rtld_lock_default_lock_recursive,
+       __rtld_lock_default_unlock_recursive): Define.
+       [_LIBC && SHARED] (__rtld_lock_lock_recursive,
+       __rtld_lock_unlock_recursive): Define using
+       GL(_dl_rtld_*lock_recursive).
+       * pthread.c (pthread_initialize): Initialize _dl_rtld_lock_recursive
+       and _dl_rtld_unlock_recursive.  Lock GL(_dl_load_lock) the same
+       number of times as GL(_dl_load_lock) using non-mt implementation was
+       nested.
+
 2003-07-31  Jakub Jelinek  <jakub@redhat.com>
 
        * sysdeps/pthread/bits/typesizes.h (__SSIZE_T_TYPE): Define.
index f7081139b2a73b814e4ca329093e7fe0b20a19d5..f261f8e8f478cc31e00bacf2b51e8442a3eebc0c 100644 (file)
@@ -588,6 +588,15 @@ static void pthread_initialize(void)
   /* Transfer the old value from the dynamic linker's internal location.  */
   *__libc_dl_error_tsd () = *(*GL(dl_error_catch_tsd)) ();
   GL(dl_error_catch_tsd) = &__libc_dl_error_tsd;
+
+  /* Make __rtld_lock_{,un}lock_recursive use pthread_mutex_{,un}lock,
+     keep the lock count from the ld.so implementation.  */
+  GL(dl_rtld_lock_recursive) = (void *) __pthread_mutex_lock;
+  GL(dl_rtld_unlock_recursive) = (void *) __pthread_mutex_unlock;
+  unsigned int rtld_lock_count = GL(dl_load_lock).mutex.__m_count;
+  GL(dl_load_lock).mutex.__m_count = 0;
+  while (rtld_lock_count-- > 0)
+    __pthread_mutex_lock (&GL(dl_load_lock).mutex);
 #endif
 
 #ifdef USE_TLS
index 2697a18371a27996e5d3cdf3e60794405a04ab90..c0d0debe14425fbef1476e1649e3689b19a60edf 100644 (file)
@@ -180,7 +180,6 @@ typedef pthread_key_t __libc_key_t;
 
 /* Lock the recursive named lock variable.  */
 #define __libc_lock_lock_recursive(NAME) __libc_lock_lock ((NAME).mutex)
-#define __rtld_lock_lock_recursive(NAME) __libc_lock_lock_recursive (NAME)
 
 /* Try to lock the named lock variable.  */
 #define __libc_lock_trylock(NAME) \
@@ -203,8 +202,23 @@ typedef pthread_key_t __libc_key_t;
 
 /* Unlock the recursive named lock variable.  */
 #define __libc_lock_unlock_recursive(NAME) __libc_lock_unlock ((NAME).mutex)
-#define __rtld_lock_unlock_recursive(NAME) __libc_lock_unlock_recursive (NAME)
 
+#if defined _LIBC && defined SHARED
+# define __rtld_lock_default_lock_recursive(lock) \
+  ++((pthread_mutex_t *)(lock))->__m_count;
+
+# define __rtld_lock_default_unlock_recursive(lock) \
+  --((pthread_mutex_t *)(lock))->__m_count;
+
+# define __rtld_lock_lock_recursive(NAME) \
+  GL(dl_rtld_lock_recursive) (&(NAME).mutex)
+
+# define __rtld_lock_unlock_recursive(NAME) \
+  GL(dl_rtld_unlock_recursive) (&(NAME).mutex)
+#else
+#define __rtld_lock_lock_recursive(NAME) __libc_lock_lock_recursive (NAME)
+#define __rtld_lock_unlock_recursive(NAME) __libc_lock_unlock_recursive (NAME)
+#endif
 
 /* Define once control variable.  */
 #if PTHREAD_ONCE_INIT == 0
index 3fd2f22f4df14e0ca3cbf869816ad8b943a27f06..dcf3815b028e009877b7db75882abd6530a2fc9f 100644 (file)
@@ -1,3 +1,19 @@
+2003-08-07  Jakub Jelinek  <jakub@redhat.com>
+
+       * sysdeps/pthread/bits/libc-lock.h [_LIBC && SHARED]
+       (__rtld_lock_default_lock_recursive,
+       __rtld_lock_default_unlock_recursive): Define.
+       [_LIBC && SHARED] (__rtld_lock_lock_recursive,
+       __rtld_lock_unlock_recursive): Define using
+       GL(_dl_rtld_*lock_recursive).
+       * init.c (__pthread_initialize_minimal_internal): Initialize
+       _dl_rtld_lock_recursive and _dl_rtld_unlock_recursive.
+       Lock GL(_dl_load_lock) the same number of times as
+       GL(_dl_load_lock) using non-mt implementation was nested.
+
+       * pthreadP.h (__pthread_cleanup_upto): Add hidden_proto.
+       * pt-longjmp.c (__pthread_cleanup_upto): Add hidden_def.
+
 2003-08-06  Jakub Jelinek  <jakub@redhat.com>
 
        * tst-cancel17.c (do_test): Make len2 maximum of page size and
index dae24f1eac59bbdaecbf6b20aa0253466a14edfb..1f60e92aeb1a28a0b40aa477bf217c55bee52b37 100644 (file)
@@ -270,6 +270,15 @@ __pthread_initialize_minimal_internal (void)
   /* Transfer the old value from the dynamic linker's internal location.  */
   *__libc_dl_error_tsd () = *(*GL(dl_error_catch_tsd)) ();
   GL(dl_error_catch_tsd) = &__libc_dl_error_tsd;
+
+  /* Make __rtld_lock_{,un}lock_recursive use pthread_mutex_{,un}lock,
+     keep the lock count from the ld.so implementation.  */
+  GL(dl_rtld_lock_recursive) = (void *) INTUSE (__pthread_mutex_lock);
+  GL(dl_rtld_unlock_recursive) = (void *) INTUSE (__pthread_mutex_unlock);
+  unsigned int rtld_lock_count = GL(dl_load_lock).mutex.__data.__count;
+  GL(dl_load_lock).mutex.__data.__count = 0;
+  while (rtld_lock_count-- > 0)
+    INTUSE (__pthread_mutex_lock) (&GL(dl_load_lock).mutex);
 #endif
 
   GL(dl_init_static_tls) = &__pthread_init_static_tls;
index f333b8dfb08bd241d0f1815dca5ac0f2e103514f..f217e307f95d074a315d22bacbfd61afe9e088f8 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -54,7 +54,7 @@ __pthread_cleanup_upto (__jmp_buf target, char *targetframe)
 
   THREAD_SETMEM (self, cleanup, cbuf);
 }
-
+hidden_def (__pthread_cleanup_upto)
 
 
 void
index b07c6da96140decc7967e202779243e9451b7016..99b344489afc8b12a2d31763411807cf950d043c 100644 (file)
@@ -217,6 +217,9 @@ extern void __reclaim_stacks (void) attribute_hidden;
 
 /* longjmp handling.  */
 extern void __pthread_cleanup_upto (__jmp_buf target, char *targetframe);
+#if defined NOT_IN_libc && defined IS_IN_libpthread
+hidden_proto (__pthread_cleanup_upto)
+#endif
 
 
 /* Functions with versioned interfaces.  */
index 35bc21b95abe73470637a366ff34c9ba3f95bcff..f7ed88dae63211f8ccf94212d4c12dc426e6dacf 100644 (file)
@@ -248,9 +248,6 @@ typedef pthread_key_t __libc_key_t;
   __libc_maybe_call (__pthread_mutex_lock, (&(NAME).mutex), 0)
 #endif
 
-#define __rtld_lock_lock_recursive(NAME) \
-  __libc_maybe_call (__pthread_mutex_lock, (&(NAME).mutex), 0)
-
 /* Try to lock the named lock variable.  */
 #if defined _LIBC && (!defined NOT_IN_libc || defined IS_IN_libpthread)
 # define __libc_lock_trylock(NAME) \
@@ -319,8 +316,25 @@ typedef pthread_key_t __libc_key_t;
   __libc_maybe_call (__pthread_mutex_unlock, (&(NAME)), 0)
 #endif
 
-#define __rtld_lock_unlock_recursive(NAME) \
+#if defined _LIBC && defined SHARED
+# define __rtld_lock_default_lock_recursive(lock) \
+  ++((pthread_mutex_t *)(lock))->__data.__count;
+
+# define __rtld_lock_default_unlock_recursive(lock) \
+  --((pthread_mutex_t *)(lock))->__data.__count;
+
+# define __rtld_lock_lock_recursive(NAME) \
+  GL(dl_rtld_lock_recursive) (&(NAME).mutex)
+
+# define __rtld_lock_unlock_recursive(NAME) \
+  GL(dl_rtld_unlock_recursive) (&(NAME).mutex)
+#else
+# define __rtld_lock_lock_recursive(NAME) \
+  __libc_maybe_call (__pthread_mutex_lock, (&(NAME).mutex), 0)
+
+# define __rtld_lock_unlock_recursive(NAME) \
   __libc_maybe_call (__pthread_mutex_unlock, (&(NAME).mutex), 0)
+#endif
 
 /* Define once control variable.  */
 #if PTHREAD_ONCE_INIT == 0
index b647ea45e73c976f4f55e054ff8940a7cf8c8e34..58dfc15ca3902d03bf563f198a49c4bdbefe0155 100644 (file)
@@ -349,6 +349,12 @@ struct rtld_global
   /* Structure describing the dynamic linker itself.  */
   EXTERN struct link_map _dl_rtld_map;
 
+#if defined SHARED && defined _LIBC_REENTRANT \
+    && defined __rtld_lock_default_lock_recursive
+  EXTERN void (*_dl_rtld_lock_recursive) (void *);
+  EXTERN void (*_dl_rtld_unlock_recursive) (void *);
+#endif
+
   /* Keep the conditional TLS members at the end so the layout of the
      structure used by !USE_TLS code matches the prefix of the layout in
      the USE_TLS rtld.  Note that `struct link_map' is conditionally
index 8b6fbebbf0aa9c7316340285e78d9feb856e4991..c1cdb1b8996e0bea0e30714b20bcbf58762d6335 100644 (file)
@@ -45,13 +45,6 @@ __fpathconf (fd, name)
     case _PC_2_SYMLINKS:
       return __statfs_symlinks (__fstatfs (fd, &fsbuf), &fsbuf);
 
-    case _PC_PIPE_BUF:
-#ifdef  PIPE_BUF
-      return PIPE_BUF;
-#else
-      return __getpagesize ();
-#endif
-
     default:
       return posix_fpathconf (fd, name);
     }
index 1e0679343f8ce3f429c7d01c6d6c4512aa3dee55..d4159753a6262f85d2a18ac9d45bdebee27b5cd0 100644 (file)
@@ -46,13 +46,6 @@ __pathconf (const char *file, int name)
     case _PC_2_SYMLINKS:
       return __statfs_symlinks (__statfs (file, &fsbuf), &fsbuf);
 
-    case _PC_PIPE_BUF:
-#ifdef  PIPE_BUF
-      return PIPE_BUF;
-#else
-      return __getpagesize ();
-#endif
-
     default:
       return posix_pathconf (file, name);
     }