about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog24
-rw-r--r--dlfcn/dlinfo.c12
-rw-r--r--include/errno.h6
-rw-r--r--linuxthreads/ChangeLog5
-rw-r--r--linuxthreads/sysdeps/pthread/errno-loc.c4
-rw-r--r--nscd/connections.c5
-rw-r--r--sysdeps/generic/errno-loc.c4
-rw-r--r--sysdeps/mips/dl-machine.h9
-rw-r--r--sysdeps/powerpc/powerpc32/dl-machine.c56
-rw-r--r--sysdeps/sparc/fpu/bits/mathinline.h24
-rw-r--r--sysdeps/unix/sysv/linux/i386/setresgid.c4
-rw-r--r--sysdeps/unix/sysv/linux/i386/setresuid.c4
12 files changed, 97 insertions, 60 deletions
diff --git a/ChangeLog b/ChangeLog
index e71e752bfb..fa15952df0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,29 @@
+2004-10-14  Ulrich Drepper  <drepper@redhat.com>
+
+	* nscd/connections.c (nscd_init): Remove file if not persistent
+	and not shared.  Patch by Jerome Borsboom <j.borsboom@erasmusmc.nl>.
+
 2004-10-14  Jakub Jelinek  <jakub@redhat.com>
 
+	* sysdeps/unix/sysv/linux/i386/setresuid.c: Handle
+	defined __NR_setresuid32 && !defined __NR_setresuid.
+	* sysdeps/unix/sysv/linux/i386/setresgid.c: Handle
+	defined __NR_setresgid32 && !defined __NR_setresgid.
+
+	* sysdeps/sparc/fpu/bits/mathinline.h (__signbitf, __signbit,
+	__signbitl, sqrtf, sqrt, sqrtl, fdim, fdimf): Use __NTH macro.
+
+	* sysdeps/generic/errno-loc.c: Don't undef #errno
+	if RTLD_PRIVATE_ERRNO.
+	* include/errno.h (__errno_location): If RTLD_PRIVATE_ERRNO,
+	add attribute_hidden.
+
+	* dlfcn/dlinfo.c (dlinfo_doit): Replace iteration over GL(dl_loaded)
+	chain with iteration over all namespaces' _ns_loaded chains.
+	* sysdeps/powerpc/powerpc32/dl-machine.c (__elf_preferred_address):
+	Likewise.
+	* sysdeps/mips/dl-machine.h (elf_machine_runtime_link_map): Likewise.
+
 	* elf/rtld.c (_dl_start): Fix one last dl_loaded.
 	* elf/dl-load.c (_dl_map_object_from_fd): Avoid definition of
 	label when it is not needed.
diff --git a/dlfcn/dlinfo.c b/dlfcn/dlinfo.c
index 4e755ad044..d54a13259a 100644
--- a/dlfcn/dlinfo.c
+++ b/dlfcn/dlinfo.c
@@ -39,13 +39,15 @@ dlinfo_doit (void *argsblock)
 #if 0
   if (args->handle == RTLD_SELF)
     {
+      Lmid_t nsid;
 
       /* Find the highest-addressed object that CALLER is not below.  */
-      for (l = GL(dl_loaded); l != NULL; l = l->l_next)
-	if (caller >= l->l_map_start && caller < l->l_map_end)
-	  /* There must be exactly one DSO for the range of the virtual
-	     memory.  Otherwise something is really broken.  */
-	  break;
+      for (nsid = 0; nsid < DL_NNS; ++nsid)
+	for (l = GL(dl_ns)[nsid]._ns_loaded; l != NULL; l = l->l_next)
+	  if (caller >= l->l_map_start && caller < l->l_map_end)
+	    /* There must be exactly one DSO for the range of the virtual
+	       memory.  Otherwise something is really broken.  */
+	    break;
 
       if (l == NULL)
 	GLRO(dl_signal_error) (0, NULL, NULL, N_("\
diff --git a/include/errno.h b/include/errno.h
index 13d17f9c0e..9865903b86 100644
--- a/include/errno.h
+++ b/include/errno.h
@@ -36,7 +36,11 @@ extern __thread int errno attribute_tls_model_ie;
 # define __set_errno(val) (errno = (val))
 
 # ifndef __ASSEMBLER__
-extern int *__errno_location (void) __THROW __attribute__ ((__const__));
+extern int *__errno_location (void) __THROW __attribute__ ((__const__))
+#  if RTLD_PRIVATE_ERRNO
+     attribute_hidden
+#  endif
+;
 libc_hidden_proto (__errno_location)
 # endif
 
diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog
index 56b412b5c6..421b6c8aad 100644
--- a/linuxthreads/ChangeLog
+++ b/linuxthreads/ChangeLog
@@ -1,3 +1,8 @@
+2004-10-14  Jakub Jelinek  <jakub@redhat.com>
+
+	* sysdeps/pthread/errno-loc.c: Don't undef #errno
+	if RTLD_PRIVATE_ERRNO.
+
 2004-10-05  Dwayne Grant McConnell  <dgm69@us.ibm.com>
 
 	* pthread.c: Mask restart signal during cancel signal handler.
diff --git a/linuxthreads/sysdeps/pthread/errno-loc.c b/linuxthreads/sysdeps/pthread/errno-loc.c
index d3e49b7211..0a8f0f9076 100644
--- a/linuxthreads/sysdeps/pthread/errno-loc.c
+++ b/linuxthreads/sysdeps/pthread/errno-loc.c
@@ -1,6 +1,6 @@
 /* MT support function to get address of `errno' variable, linuxthreads
    version.
-   Copyright (C) 1996, 1998, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1998, 2002, 2003, 2004 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -23,7 +23,7 @@
 #include <linuxthreads/internals.h>
 #include <sysdep-cancel.h>
 
-#if ! USE___THREAD
+#if ! USE___THREAD && !RTLD_PRIVATE_ERRNO
 #undef errno
 extern int errno;
 #endif
diff --git a/nscd/connections.c b/nscd/connections.c
index 594a5b8950..f616dd0508 100644
--- a/nscd/connections.c
+++ b/nscd/connections.c
@@ -327,9 +327,10 @@ cannot create read-only descriptor for \"%s\"; no mmap"),
 
 		/* We do not need the file name anymore after we
 		   opened another file descriptor in read-only mode.  */
-		if (fd != -1 && dbs[cnt].shared)
+		if (fd != -1)
 		  {
-		    ro_fd = open (fname, O_RDONLY);
+		    if (dbs[cnt].shared)
+		      ro_fd = open (fname, O_RDONLY);
 
 		    unlink (fname);
 		  }
diff --git a/sysdeps/generic/errno-loc.c b/sysdeps/generic/errno-loc.c
index fd16103b11..633590f4f9 100644
--- a/sysdeps/generic/errno-loc.c
+++ b/sysdeps/generic/errno-loc.c
@@ -1,6 +1,6 @@
 /* MT support function to get address of `errno' variable, non-threaded
    version.
-   Copyright (C) 1996, 1998, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1998, 2002, 2004 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -21,7 +21,7 @@
 #include <errno.h>
 #include <tls.h>
 
-#if ! USE___THREAD
+#if ! USE___THREAD && !RTLD_PRIVATE_ERRNO
 #undef errno
 extern int errno;
 #endif
diff --git a/sysdeps/mips/dl-machine.h b/sysdeps/mips/dl-machine.h
index 944f3c10a5..49fdffb93d 100644
--- a/sysdeps/mips/dl-machine.h
+++ b/sysdeps/mips/dl-machine.h
@@ -231,10 +231,11 @@ elf_machine_runtime_link_map (ElfW(Addr) gpreg, ElfW(Addr) stub_pc)
 	}
     }
 
-    {
-      struct link_map *l = GL(dl_loaded);
+    struct link_map *l;
+    Lmid_t nsid;
 
-      while (l)
+    for (nsid = 0; nsid < DL_NNS; ++nsid)
+      for (l = GL(dl_ns)[nsid]._ns_loaded; l != NULL; l = l->l_next)
 	{
 	  ElfW(Addr) base, limit;
 	  const ElfW(Phdr) *p = l->l_phdr;
@@ -250,9 +251,7 @@ elf_machine_runtime_link_map (ElfW(Addr) gpreg, ElfW(Addr) stub_pc)
 		    return l;
 		}
 	    }
-	  l = l->l_next;
 	}
-    }
 
   _dl_signal_error (0, NULL, NULL, "cannot find runtime link map");
   return NULL;
diff --git a/sysdeps/powerpc/powerpc32/dl-machine.c b/sysdeps/powerpc/powerpc32/dl-machine.c
index 0dce04088b..06960716b9 100644
--- a/sysdeps/powerpc/powerpc32/dl-machine.c
+++ b/sysdeps/powerpc/powerpc32/dl-machine.c
@@ -101,11 +101,12 @@ weak_extern (__cache_line_size)
    mapped somewhere else.  */
 
 ElfW(Addr)
-__elf_preferred_address(struct link_map *loader, size_t maplength,
-			ElfW(Addr) mapstartpref)
+__elf_preferred_address (struct link_map *loader, size_t maplength,
+			 ElfW(Addr) mapstartpref)
 {
   ElfW(Addr) low, high;
   struct link_map *l;
+  Lmid_t nsid;
 
   /* If the object has a preference, load it there!  */
   if (mapstartpref != 0)
@@ -117,29 +118,30 @@ __elf_preferred_address(struct link_map *loader, size_t maplength,
      be superceded by the program's load address).  */
   low =  0x0003FFFF;
   high = 0x70000000;
-  for (l = GL(dl_loaded); l; l = l->l_next)
-    {
-      ElfW(Addr) mapstart, mapend;
-      mapstart = l->l_map_start & ~(GLRO(dl_pagesize) - 1);
-      mapend = l->l_map_end | (GLRO(dl_pagesize) - 1);
-      assert (mapend > mapstart);
-
-      /* Prefer gaps below the main executable, note that l ==
-	 _dl_loaded does not work for static binaries loading
-	 e.g. libnss_*.so.  */
-      if ((mapend >= high || l->l_type == lt_executable)
-	  && high >= mapstart)
-	high = mapstart;
-      else if (mapend >= low && low >= mapstart)
-	low = mapend;
-      else if (high >= mapend && mapstart >= low)
-	{
-	  if (high - mapend >= mapstart - low)
-	    low = mapend;
-	  else
-	    high = mapstart;
-	}
-    }
+  for (nsid = 0; nsid < DL_NNS; ++nsid)
+    for (l = GL(dl_ns)[nsid]._ns_loaded; l; l = l->l_next)
+      {
+	ElfW(Addr) mapstart, mapend;
+	mapstart = l->l_map_start & ~(GLRO(dl_pagesize) - 1);
+	mapend = l->l_map_end | (GLRO(dl_pagesize) - 1);
+	assert (mapend > mapstart);
+
+	/* Prefer gaps below the main executable, note that l ==
+	   _dl_loaded does not work for static binaries loading
+	   e.g. libnss_*.so.  */
+	if ((mapend >= high || l->l_type == lt_executable)
+  	    && high >= mapstart)
+	  high = mapstart;
+	else if (mapend >= low && low >= mapstart)
+	  low = mapend;
+	else if (high >= mapend && mapstart >= low)
+	  {
+	    if (high - mapend >= mapstart - low)
+	      low = mapend;
+	    else
+	      high = mapstart;
+	  }
+      }
 
   high -= 0x10000; /* Allow some room between objects.  */
   maplength = (maplength | (GLRO(dl_pagesize) - 1)) + 1;
@@ -341,8 +343,8 @@ __elf_machine_runtime_setup (struct link_map *map, int lazy, int profile)
 }
 
 Elf32_Addr
-__elf_machine_fixup_plt(struct link_map *map, const Elf32_Rela *reloc,
-			Elf32_Addr *reloc_addr, Elf32_Addr finaladdr)
+__elf_machine_fixup_plt (struct link_map *map, const Elf32_Rela *reloc,
+			 Elf32_Addr *reloc_addr, Elf32_Addr finaladdr)
 {
   Elf32_Sword delta = finaladdr - (Elf32_Word) reloc_addr;
   if (delta << 6 >> 6 == delta)
diff --git a/sysdeps/sparc/fpu/bits/mathinline.h b/sysdeps/sparc/fpu/bits/mathinline.h
index 2b578d04cd..7add493660 100644
--- a/sysdeps/sparc/fpu/bits/mathinline.h
+++ b/sysdeps/sparc/fpu/bits/mathinline.h
@@ -112,7 +112,7 @@
 
 /* Test for negative number.  Used in the signbit() macro.  */
 __MATH_INLINE int
-__signbitf (float __x) __THROW
+__NTH (__signbitf (float __x))
 {
   __extension__ union { float __f; int __i; } __u = { __f: __x };
   return __u.__i < 0;
@@ -121,14 +121,14 @@ __signbitf (float __x) __THROW
 #   if __WORDSIZE == 32
 
 __MATH_INLINE int
-__signbit (double __x) __THROW
+__NTH (__signbit (double __x))
 {
   __extension__ union { double __d; int __i[2]; } __u = { __d: __x };
   return __u.__i[0] < 0;
 }
 
 __MATH_INLINE int
-__signbitl (long double __x) __THROW
+__NTH (__signbitl (long double __x))
 {
   return __signbit ((double)__x);
 }
@@ -136,14 +136,14 @@ __signbitl (long double __x) __THROW
 #   else /* sparc64 */
 
 __MATH_INLINE int
-__signbit (double __x) __THROW
+__NTH (__signbit (double __x))
 {
   __extension__ union { double __d; long int __i; } __u = { __d: __x };
   return __u.__i < 0;
 }
 
 __MATH_INLINE int
-__signbitl (long double __x) __THROW
+__NTH (__signbitl (long double __x))
 {
   __extension__ union { long double __l; long int __i[2]; } __u = { __l: __x };
   return __u.__i[0] < 0;
@@ -156,7 +156,7 @@ __signbitl (long double __x) __THROW
 #  if !defined __NO_MATH_INLINES && !__GNUC_PREREQ (3, 2)
 
 __MATH_INLINE double
-sqrt (double __x) __THROW
+__NTH (sqrt (double __x))
 {
   register double __r;
   __asm ("fsqrtd %1,%0" : "=f" (__r) : "f" (__x));
@@ -164,7 +164,7 @@ sqrt (double __x) __THROW
 }
 
 __MATH_INLINE float
-sqrtf (float __x) __THROW
+__NTH (sqrtf (float __x))
 {
   register float __r;
   __asm ("fsqrts %1,%0" : "=f" (__r) : "f" (__x));
@@ -173,7 +173,7 @@ sqrtf (float __x) __THROW
 
 #   if __WORDSIZE == 64
 __MATH_INLINE long double
-sqrtl (long double __x) __THROW
+__NTH (sqrtl (long double __x))
 {
   long double __r;
   extern void _Qp_sqrt (long double *, __const__ long double *);
@@ -219,16 +219,16 @@ __ieee754_sqrtl (long double __x)
 
 #  ifndef __NO_MATH_INLINES
 
-__MATH_INLINE double fdim (double __x, double __y) __THROW;
+__MATH_INLINE double __NTH (fdim (double __x, double __y));
 __MATH_INLINE double
-fdim (double __x, double __y) __THROW
+__NTH (fdim (double __x, double __y))
 {
   return __x <= __y ? 0 : __x - __y;
 }
 
-__MATH_INLINE float fdimf (float __x, float __y) __THROW;
+__MATH_INLINE float __NTH (fdimf (float __x, float __y));
 __MATH_INLINE float
-fdimf (float __x, float __y) __THROW
+__NTH (fdimf (float __x, float __y))
 {
   return __x <= __y ? 0 : __x - __y;
 }
diff --git a/sysdeps/unix/sysv/linux/i386/setresgid.c b/sysdeps/unix/sysv/linux/i386/setresgid.c
index ee782e49f3..614e2c256d 100644
--- a/sysdeps/unix/sysv/linux/i386/setresgid.c
+++ b/sysdeps/unix/sysv/linux/i386/setresgid.c
@@ -28,7 +28,7 @@
 #include <pthread-functions.h>
 
 
-#ifdef __NR_setresgid
+#if defined __NR_setresgid || defined __NR_setresgid32
 
 # ifdef __NR_setresgid32
 #  if __ASSUME_32BITUIDS == 0
@@ -43,7 +43,7 @@ __setresgid (gid_t rgid, gid_t egid, gid_t sgid)
 {
   int result;
 
-# if __ASSUME_32BITUIDS > 0
+# if __ASSUME_32BITUIDS > 0 || !defined __NR_setresgid
   result = INLINE_SYSCALL (setresgid32, 3, rgid, egid, sgid);
 # else
 #  ifdef __NR_setresgid32
diff --git a/sysdeps/unix/sysv/linux/i386/setresuid.c b/sysdeps/unix/sysv/linux/i386/setresuid.c
index 66e5a1c0c1..4d735ca0f9 100644
--- a/sysdeps/unix/sysv/linux/i386/setresuid.c
+++ b/sysdeps/unix/sysv/linux/i386/setresuid.c
@@ -28,7 +28,7 @@
 #include <pthread-functions.h>
 
 
-#ifdef __NR_setresuid
+#if defined __NR_setresuid || defined __NR_setresuid32
 
 # ifdef __NR_setresuid32
 #  if __ASSUME_32BITUIDS == 0
@@ -43,7 +43,7 @@ __setresuid (uid_t ruid, uid_t euid, uid_t suid)
 {
   int result;
 
-# if __ASSUME_32BITUIDS > 0
+# if __ASSUME_32BITUIDS > 0 || !defined __NR_setresuid
   result = INLINE_SYSCALL (setresuid32, 3, ruid, euid, suid);
 # else
 #  ifdef __NR_setresuid32