From 08cac4ac19abd40887afbd9d841cd96a8efbbe98 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Wed, 26 Aug 1998 00:07:26 +0000 Subject: Update. 1998-08-25 Ulrich Drepper * sysdeps/generic/dl-cache.c: Move static variable cache and cachesize to toplevel. (_dl_unload_cache): New function. * elf/Versions [libc GLIBC_2.1]: Add _dl_unload_cache. * elf/dl-open.c (_dl_open): Unload map file before freeing the lock. * elf/rtld (dl_main): Unload map file before jumping to user code. * sysdeps/unix/sysv/linux/alpha/bits/fcntl.h: Define O_DIRECT. Correct comment for O_LARGEFILE. * sysdeps/unix/sysv/linux/bits/fcntl.h: Define O_DIRECT. Change O_LARGEFILE to correct value. 1998-08-25 14:34 Ulrich Drepper * libio/iogetline.c (_IO_getline_info): Don't read anything for N == 0. Patch by HJ Lu. --- sysdeps/generic/dl-cache.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'sysdeps/generic/dl-cache.c') diff --git a/sysdeps/generic/dl-cache.c b/sysdeps/generic/dl-cache.c index da7d2e49dd..f14cf96da1 100644 --- a/sysdeps/generic/dl-cache.c +++ b/sysdeps/generic/dl-cache.c @@ -44,6 +44,10 @@ 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; + /* This is the cache ID we expect. Normally it is 3 for glibc linked binaries. */ int _dl_correct_cache_id = 3; @@ -54,8 +58,6 @@ int _dl_correct_cache_id = 3; const char * _dl_load_cache_lookup (const char *name) { - static struct cache_file *cache; - static size_t cachesize; unsigned int i; const char *best; @@ -114,3 +116,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 -- cgit v1.2.3