]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Move static variable cache and cachesize to toplevel.
authorUlrich Drepper <drepper@redhat.com>
Fri, 28 Aug 1998 12:07:26 +0000 (12:07 +0000)
committerUlrich Drepper <drepper@redhat.com>
Fri, 28 Aug 1998 12:07:26 +0000 (12:07 +0000)
sysdeps/generic/dl-cache.c

index 16f0da3c5a2e117e9320d307b90e7d78db722af5..7522b3e886b68cbb815dd209894d733a78265f64 100644 (file)
@@ -44,14 +44,16 @@ struct cache_file
       } libs[0];
   };
 
+/* This is the starting address and the size of the mmap()ed file.  */
+static struct cache_file *cache;
+static size_t cachesize;
+
 /* Look up NAME in ld.so.cache and return the file name stored there,
    or null if none is found.  */
 
 const char *
 _dl_load_cache_lookup (const char *name)
 {
-  static struct cache_file *cache;
-  static size_t cachesize;
   unsigned int i;
   const char *best;
 
@@ -101,3 +103,19 @@ _dl_load_cache_lookup (const char *name)
       }
   return best;
 }
+
+#ifndef MAP_COPY
+/* If the system does not support MAP_COPY we cannot leave the file open
+   all the time since this would create problems when the file is replaced.
+   Therefore we provide this function to close the file and open it again
+   once needed.  */
+void
+_dl_unload_cache (void)
+{
+  if (cache != NULL && cache != (struct cache_file *) -1)
+    {
+      __munmap (cache, cachesize);
+      cache = NULL;
+    }
+}
+#endif