[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[commits] r9374 - in /fsf/trunk/ports: ./ sysdeps/mips/ sysdeps/unix/sysv/linux/mips/mips64/n32/ sysdeps/unix/sysv/linux/mips/mips64/n64/



Author: eglibc
Date: Mon Nov 30 17:32:27 2009
New Revision: 9374

Log:
Import glibc-ports-mainline for 2009-11-30

Added:
    fsf/trunk/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/posix_fadvise.c
    fsf/trunk/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/posix_fadvise.c
    fsf/trunk/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/posix_fadvise64.c
Modified:
    fsf/trunk/ports/ChangeLog.mips
    fsf/trunk/ports/sysdeps/mips/dl-lookup.c
    fsf/trunk/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list

Modified: fsf/trunk/ports/ChangeLog.mips
==============================================================================
--- fsf/trunk/ports/ChangeLog.mips (original)
+++ fsf/trunk/ports/ChangeLog.mips Mon Nov 30 17:32:27 2009
@@ -1,3 +1,15 @@
+2009-12-01  Joseph Myers  <joseph@xxxxxxxxxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list
+	(posix_fadvise): Remove.
+	* sysdeps/unix/sysv/linux/mips/mips64/n32/posix_fadvise.c,
+	sysdeps/unix/sysv/linux/mips/mips64/n64/posix_fadvise.c,
+	sysdeps/unix/sysv/linux/mips/mips64/n64/posix_fadvise64.c: New.
+
+2009-12-01  Joseph Myers  <joseph@xxxxxxxxxxxxxxxx>
+
+	* sysdeps/mips/dl-lookup.c: Update from generic version.
+
 2009-11-23  Joseph Myers  <joseph@xxxxxxxxxxxxxxxx>
 
 	* sysdeps/unix/sysv/linux/mips/bits/stat.h: Use struct timespec

Modified: fsf/trunk/ports/sysdeps/mips/dl-lookup.c
==============================================================================
--- fsf/trunk/ports/sysdeps/mips/dl-lookup.c (original)
+++ fsf/trunk/ports/sysdeps/mips/dl-lookup.c Mon Nov 30 17:32:27 2009
@@ -329,16 +329,16 @@
 		 definition we have to use it.  */
 	      void enter (struct unique_sym *table, size_t size,
 			  unsigned int hash, const char *name,
-			  const ElfW(Sym) *sym, const struct link_map *map)
+			  const ElfW(Sym) *sym, struct link_map *map)
 	      {
 		size_t idx = hash % size;
 		size_t hash2 = 1 + hash % (size - 2);
 		while (1)
 		  {
-		    if (table[idx].hashval == 0)
+		    if (table[idx].name == NULL)
 		      {
 			table[idx].hashval = hash;
-			table[idx].name = strtab + sym->st_name;
+			table[idx].name = name;
 			if ((type_class & ELF_RTYPE_CLASS_COPY) != 0)
 			  {
 			    table[idx].sym = ref;
@@ -348,7 +348,13 @@
 			  {
 			    table[idx].sym = sym;
 			    table[idx].map = map;
+
+			    if (map->l_type == lt_loaded)
+			      /* Make sure we don't unload this object by
+				 setting the appropriate flag.  */
+			      map->l_flags_1 |= DF_1_NODELETE;
 			  }
+
 			return;
 		      }
 
@@ -380,8 +386,7 @@
 			  return 1;
 			}
 
-		      if (entries[idx].hashval == 0
-			  && entries[idx].name == NULL)
+		      if (entries[idx].name == NULL)
 			break;
 
 		      idx += hash2;
@@ -389,10 +394,14 @@
 			idx -= size;
 		    }
 
-		  if (size * 3 <= tab->n_elements)
+		  if (size * 3 <= tab->n_elements * 4)
 		    {
 		      /* Expand the table.  */
-		      size_t newsize = _dl_higher_prime_number (size);
+#ifdef RTLD_CHECK_FOREIGN_CALL
+		      /* This must not happen during runtime relocations.  */
+		      assert (!RTLD_CHECK_FOREIGN_CALL);
+#endif
+		      size_t newsize = _dl_higher_prime_number (size + 1);
 		      struct unique_sym *newentries
 			= calloc (sizeof (struct unique_sym), newsize);
 		      if (newentries == NULL)
@@ -403,19 +412,25 @@
 			}
 
 		      for (idx = 0; idx < size; ++idx)
-			if (entries[idx].hashval != 0)
+			if (entries[idx].name != NULL)
 			  enter (newentries, newsize, entries[idx].hashval,
 				 entries[idx].name, entries[idx].sym,
 				 entries[idx].map);
 
 		      tab->free (entries);
 		      tab->size = newsize;
+		      size = newsize;
 		      entries = tab->entries = newentries;
 		      tab->free = free;
 		    }
 		}
 	      else
 		{
+#ifdef RTLD_CHECK_FOREIGN_CALL
+		  /* This must not happen during runtime relocations.  */
+		  assert (!RTLD_CHECK_FOREIGN_CALL);
+#endif
+
 #define INITIAL_NUNIQUE_SYM_TABLE 31
 		  size = INITIAL_NUNIQUE_SYM_TABLE;
 		  entries = calloc (sizeof (struct unique_sym), size);
@@ -427,7 +442,8 @@
 		  tab->free = free;
 		}
 
-	      enter (entries, size, new_hash, strtab + sym->st_name, sym, map);
+	      enter (entries, size, new_hash, strtab + sym->st_name, sym,
+		     (struct link_map *) map);
 	      ++tab->n_elements;
 
 	      __rtld_lock_unlock_recursive (tab->lock);
@@ -609,6 +625,10 @@
 	  struct link_map_reldeps *newp;
 	  unsigned int max
 	    = undef_map->l_reldepsmax ? undef_map->l_reldepsmax * 2 : 10;
+
+#ifdef RTLD_PREPARE_FOREIGN_CALL
+	  RTLD_PREPARE_FOREIGN_CALL;
+#endif
 
 	  newp = malloc (sizeof (*newp) + max * sizeof (struct link_map *));
 	  if (newp == NULL)

Added: fsf/trunk/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/posix_fadvise.c
==============================================================================
--- fsf/trunk/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/posix_fadvise.c (added)
+++ fsf/trunk/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/posix_fadvise.c Mon Nov 30 17:32:27 2009
@@ -1,0 +1,38 @@
+/* Copyright (C) 2003, 2004, 2009 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
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <sysdep.h>
+
+/* Advice the system about the expected behaviour of the application with
+   respect to the file associated with FD.  */
+
+int
+posix_fadvise (int fd, off_t offset, off_t len, int advise)
+{
+#ifdef __NR_fadvise64
+  INTERNAL_SYSCALL_DECL (err);
+  int ret = INTERNAL_SYSCALL (fadvise64, err, 4, fd, offset, len, advise);
+  if (INTERNAL_SYSCALL_ERROR_P (ret, err))
+    return INTERNAL_SYSCALL_ERRNO (ret, err);
+  return 0;
+#else
+  return ENOSYS;
+#endif
+}

Modified: fsf/trunk/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list
==============================================================================
--- fsf/trunk/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list (original)
+++ fsf/trunk/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list Mon Nov 30 17:32:27 2009
@@ -2,6 +2,5 @@
 
 readahead	-	readahead	i:iii	__readahead	readahead
 sync_file_range	-	sync_file_range	i:iiii	sync_file_range
-posix_fadvise	-	fadvise64	i:iiii	posix_fadvise
 ftruncate	-	ftruncate	i:ii	__ftruncate	ftruncate ftruncate64 __ftruncate64
 truncate	-	truncate	i:si	truncate	truncate64

Added: fsf/trunk/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/posix_fadvise.c
==============================================================================
--- fsf/trunk/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/posix_fadvise.c (added)
+++ fsf/trunk/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/posix_fadvise.c Mon Nov 30 17:32:27 2009
@@ -1,0 +1,1 @@
+#include <sysdeps/unix/sysv/linux/wordsize-64/posix_fadvise.c>

Added: fsf/trunk/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/posix_fadvise64.c
==============================================================================
--- fsf/trunk/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/posix_fadvise64.c (added)
+++ fsf/trunk/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/posix_fadvise64.c Mon Nov 30 17:32:27 2009
@@ -1,0 +1,1 @@
+/* posix_fadvise64 is in posix_fadvise.c */