diff options
author | Ulrich Drepper <drepper@redhat.com> | 1998-08-28 12:07:26 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1998-08-28 12:07:26 +0000 |
commit | 9fa54c55623f1414fefd761e73016df075461fed (patch) | |
tree | f2d623068a0245da079603764efe650343e27f8a | |
parent | 3e4bb8d3a13962cb24f62af5d89ba769f08c3147 (diff) | |
download | glibc-9fa54c55623f1414fefd761e73016df075461fed.tar.gz |
Move static variable cache and cachesize to toplevel.
-rw-r--r-- | sysdeps/generic/dl-cache.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/sysdeps/generic/dl-cache.c b/sysdeps/generic/dl-cache.c index 16f0da3c5a..7522b3e886 100644 --- a/sysdeps/generic/dl-cache.c +++ b/sysdeps/generic/dl-cache.c @@ -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 |