summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndreas Jaeger <aj@suse.de>2000-09-24 18:35:20 +0000
committerAndreas Jaeger <aj@suse.de>2000-09-24 18:35:20 +0000
commita8fd59b06931e3b606ffbbad741688ba7f5bbda2 (patch)
tree16e5e0fa18dbbd8918234ecd9a7e1a3eee7a03d2
parentfaa78e96be79af0594b44f935e34a67416b7f6bb (diff)
downloadglibc-a8fd59b06931e3b606ffbbad741688ba7f5bbda2.tar.gz
glibc-a8fd59b06931e3b606ffbbad741688ba7f5bbda2.tar.xz
glibc-a8fd59b06931e3b606ffbbad741688ba7f5bbda2.zip
Update.
	* elf/ldconfig.c (add_dir): Move logic to add entry to list to new
	function add_single_dir.
	(add_single_dir): New function. 
	(search_dir): Use add_single_dir instead of recursing.
-rw-r--r--ChangeLog5
-rw-r--r--elf/ldconfig.c70
-rw-r--r--sysdeps/generic/dl-cache.h20
3 files changed, 58 insertions, 37 deletions
diff --git a/ChangeLog b/ChangeLog
index 3c7d5b5afe..2cd773e25f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2000-09-24  Andreas Jaeger  <aj@suse.de>
 
+	* elf/ldconfig.c (add_dir): Move logic to add entry to list to new
+	function add_single_dir.
+	(add_single_dir): New function. 
+	(search_dir): Use add_single_dir instead of recursing.
+
 	* sysdeps/generic/dl-cache.h: Include stdint.h.
 	(struct file_entry_new): Use fixed sizes for interoperability
 	between 32bit and 64bit systems, add __unused to make alignment
diff --git a/elf/ldconfig.c b/elf/ldconfig.c
index 50b6a261f9..2730ad579e 100644
--- a/elf/ldconfig.c
+++ b/elf/ldconfig.c
@@ -258,12 +258,42 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
 	   "Andreas Jaeger");
 }
 
+/* Add a single directory entry.  */
+static void
+add_single_dir (struct dir_entry *entry, int verbose)
+{
+  struct dir_entry *ptr, *prev;
+
+  ptr = dir_entries;
+  prev = ptr;
+  while (ptr != NULL)
+    {
+      /* Check for duplicates.  */
+      if (strcmp (ptr->path, entry->path) == 0)
+	{
+	  if (opt_verbose && verbose)
+	    error (0, 0, _("Path `%s' given more than once"), entry->path);
+	  /* Use the newer information.  */
+	  ptr->flag = entry->flag;
+	  free (entry);
+	  break;
+	}
+      prev = ptr;
+      ptr = ptr->next;
+    }
+  /* Is this the first entry?  */
+  if (ptr == NULL && dir_entries == NULL)
+    dir_entries = entry;
+  else if (ptr == NULL)
+    prev->next = entry;
+}
+
 /* Add one directory to the list of directories to process.  */
 static void
 add_dir (const char *line)
 {
   char *equal_sign;
-  struct dir_entry *entry, *ptr, *prev;
+  struct dir_entry *entry;
   unsigned int i;
 
   entry = xmalloc (sizeof (struct dir_entry));
@@ -299,28 +329,7 @@ add_dir (const char *line)
       --i;
     }
 
-  ptr = dir_entries;
-  prev = ptr;
-  while (ptr != NULL)
-    {
-      /* Check for duplicates.  */
-      if (strcmp (ptr->path, entry->path) == 0)
-	{
-	  if (opt_verbose)
-	    error (0, 0, _("Path `%s' given more than once"), entry->path);
-	  /* Use the newer information.  */
-	  ptr->flag = entry->flag;
-	  free (entry);
-	  break;
-	}
-      prev = ptr;
-      ptr = ptr->next;
-    }
-  /* Is this the first entry?  */
-  if (ptr == NULL && dir_entries == NULL)
-    dir_entries = entry;
-  else if (ptr == NULL)
-    prev->next = entry;
+  add_single_dir (entry, 1);
 }
 
 
@@ -571,12 +580,15 @@ search_dir (const struct dir_entry *entry)
 
       if (S_ISDIR (stat_buf.st_mode) && is_hwcap (direntry->d_name))
 	{
-	  /* Handle subdirectory also, make a recursive call.  */
-	  struct dir_entry new_entry;
-	  new_entry.path = buf;
-	  new_entry.flag = entry->flag;
-	  new_entry.next = NULL;
-	  search_dir (&new_entry);
+	  /* Handle subdirectory later.  */
+	  struct dir_entry *new_entry;
+
+	  new_entry = xmalloc (sizeof (struct dir_entry));
+
+	  new_entry->path = buf;
+	  new_entry->flag = entry->flag;
+	  new_entry->next = NULL;
+	  add_single_dir (new_entry, 0);
 	  continue;
 	}
       else if (!S_ISREG (stat_buf.st_mode) && !S_ISLNK (stat_buf.st_mode))
diff --git a/sysdeps/generic/dl-cache.h b/sysdeps/generic/dl-cache.h
index fdf38785e1..894b28ee7b 100644
--- a/sysdeps/generic/dl-cache.h
+++ b/sysdeps/generic/dl-cache.h
@@ -17,6 +17,8 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#include <stdint.h>
+
 #ifndef _DL_CACHE_DEFAULT_ID
 # define _DL_CACHE_DEFAULT_ID	3
 #endif
@@ -66,25 +68,27 @@ struct cache_file
 };
 
 #define CACHEMAGIC_NEW "glibc-ld.so.cache"
-#define CACHE_VERSION "1.0"
+#define CACHE_VERSION "1.1"
 
 
 struct file_entry_new
 {
-  int flags;			/* This is 1 for an ELF library.  */
-  unsigned int key, value;	/* String table indices.  */
-  unsigned long hwcap;		/* Hwcap entry.  */
+  int32_t flags;		/* This is 1 for an ELF library.  */
+  uint32_t key, value;		/* String table indices.  */
+  uint32_t __unused;		/* Align next field always on 8 byte boundary.	*/
+  uint64_t hwcap;		/* Hwcap entry.	 */
 };
 
 struct cache_file_new
 {
   char magic[sizeof CACHEMAGIC_NEW - 1];
   char version[sizeof CACHE_VERSION - 1];
-  unsigned int nlibs;		/* Number of entries.  */
-  unsigned int len_strings;	/* Size of string table. */
-  unsigned int unused[4];	/* Leave space for future extensions.  */
+  uint32_t nlibs;		/* Number of entries.  */
+  uint32_t len_strings;		/* Size of string table. */
+  uint32_t unused[5];		/* Leave space for future extensions
+				   and align to 8 byte boundary.  */
   struct file_entry_new libs[0]; /* Entries describing libraries.  */
-  /* After this the string table of size len_strings is found.  */
+  /* After this the string table of size len_strings is found.	*/
 };
 
 /* Used to align cache_file_new.  */