diff options
-rw-r--r-- | ldso/include/dl-defs.h | 6 | ||||
-rw-r--r-- | ldso/ldso/dl-elf.c | 2 | ||||
-rw-r--r-- | utils/ldconfig.c | 2 |
3 files changed, 8 insertions, 2 deletions
diff --git a/ldso/include/dl-defs.h b/ldso/include/dl-defs.h index eb59ca28b..6a94ee9d9 100644 --- a/ldso/include/dl-defs.h +++ b/ldso/include/dl-defs.h @@ -62,6 +62,12 @@ typedef struct { int sooffset; int liboffset; } libentry_t; + +#ifdef __ARCH_USE_MMU__ +#define LDSO_CACHE_MMAP_FLAGS (MAP_SHARED) +#else +#define LDSO_CACHE_MMAP_FLAGS (MAP_PRIVATE) +#endif #endif /* __LDSO_CACHE_SUPPORT__ */ #endif diff --git a/ldso/ldso/dl-elf.c b/ldso/ldso/dl-elf.c index e67257e18..a6ed8f6b5 100644 --- a/ldso/ldso/dl-elf.c +++ b/ldso/ldso/dl-elf.c @@ -57,7 +57,7 @@ int _dl_map_cache(void) } _dl_cache_size = st.st_size; - _dl_cache_addr = (caddr_t) _dl_mmap(0, _dl_cache_size, PROT_READ, MAP_SHARED, fd, 0); + _dl_cache_addr = _dl_mmap(0, _dl_cache_size, PROT_READ, LDSO_CACHE_MMAP_FLAGS, fd, 0); _dl_close(fd); if (_dl_mmap_check_error(_dl_cache_addr)) { _dl_dprintf(2, "%s:%i: can't map '%s'\n", diff --git a/utils/ldconfig.c b/utils/ldconfig.c index 30e5fdb7c..671561238 100644 --- a/utils/ldconfig.c +++ b/utils/ldconfig.c @@ -813,7 +813,7 @@ void cache_print(void) if (stat(realcachefile, &st) || (fd = open(realcachefile, O_RDONLY))<0) err(EXIT_FATAL,"can't read %s (%s)", cachefile, strerror(errno)); - if ((c = mmap(0,st.st_size, PROT_READ, MAP_SHARED ,fd, 0)) == (caddr_t)-1) + if ((c = mmap(0,st.st_size, PROT_READ, LDSO_CACHE_MMAP_FLAGS, fd, 0)) == (caddr_t)-1) err(EXIT_FATAL,"can't map %s (%s)", cachefile, strerror(errno)); close(fd); |