summaryrefslogtreecommitdiff
path: root/libc/stdlib/malloc/malloc.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2004-07-15 08:06:25 +0000
committerEric Andersen <andersen@codepoet.org>2004-07-15 08:06:25 +0000
commit921fde55c32eecb4087ca59b41982b7e5c4731d1 (patch)
treef3a4add7cdcb203f128eab7cb66360443823bb2f /libc/stdlib/malloc/malloc.c
parent288a56c4a2ddb87a61fe11a3c1d3a95a01b70878 (diff)
Use MAP_PRIVATE whenever __ARCH_HAS_MMU__ is set.
Only use MAP_SHARED when mmu-less.
Diffstat (limited to 'libc/stdlib/malloc/malloc.c')
-rw-r--r--libc/stdlib/malloc/malloc.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libc/stdlib/malloc/malloc.c b/libc/stdlib/malloc/malloc.c
index 5ba552d25..e4523adb2 100644
--- a/libc/stdlib/malloc/malloc.c
+++ b/libc/stdlib/malloc/malloc.c
@@ -103,8 +103,13 @@ malloc_from_heap (size_t size, struct heap *heap)
#else /* !MALLOC_USE_SBRK */
/* Otherwise, use mmap. */
- block = mmap (0, block_size, PROT_READ | PROT_WRITE,
+#ifdef __ARCH_HAS_MMU__
+ block = mmap ((void *)0, block_size, PROT_READ | PROT_WRITE,
+ MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
+#else
+ block = mmap ((void *)0, block_size, PROT_READ | PROT_WRITE,
MAP_SHARED | MAP_ANONYMOUS, 0, 0);
+#endif
#endif /* MALLOC_USE_SBRK */