Explorar el Código

fix ld.so.cache handling on no-mmu setups

Mike Frysinger hace 17 años
padre
commit
338053615c
Se han modificado 3 ficheros con 8 adiciones y 2 borrados
  1. 6 0
      ldso/include/dl-defs.h
  2. 1 1
      ldso/ldso/dl-elf.c
  3. 1 1
      utils/ldconfig.c

+ 6 - 0
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

+ 1 - 1
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",

+ 1 - 1
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);