summaryrefslogtreecommitdiff
path: root/libc/stdlib/malloc
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-03-19 06:24:20 +0000
committerEric Andersen <andersen@codepoet.org>2001-03-19 06:24:20 +0000
commite2f6ebd3f2969753e4ffc337ce5fb6cdf9d74775 (patch)
treeaa7553e1b76e25ecdaa3aa7a2b8e29d9159f8974 /libc/stdlib/malloc
parent6893f5d8b3fdf6ce65274b90b0b4b0bda9107b17 (diff)
Fix up breakage resulting from flipping the sense of some defines. Change from
defining things to "0" in the disabled case to outright undefining them, lest code that does an "#ifdef FOO" get inadvertantly triggered. Remove now unneeded lines from Rules.mak which makes the command line smaller and avoids redundancy (since this stuff is now pulled in via features.h). -Erik
Diffstat (limited to 'libc/stdlib/malloc')
-rw-r--r--libc/stdlib/malloc/malloc.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/libc/stdlib/malloc/malloc.c b/libc/stdlib/malloc/malloc.c
index b5cfee3f0..95dda3da5 100644
--- a/libc/stdlib/malloc/malloc.c
+++ b/libc/stdlib/malloc/malloc.c
@@ -55,6 +55,7 @@
#define _POSIX_SOURCE
#define _XOPEN_SOURCE
+#include <features.h>
#include <sys/types.h>
#include <unistd.h>
#include <limits.h>
@@ -177,10 +178,10 @@ void *__hunk_alloc(int size)
(p =
(Hunk_t *) mmap(HUNK_MSTART, HUNK_MSIZE,
PROT_READ | PROT_WRITE,
-#ifdef __HAS_NO_MMU__
- MAP_SHARED | MAP_ANONYMOUS
-#else
+#ifdef __UCLIBC_HAS_MMU__
MAP_PRIVATE | MAP_ANONYMOUS
+#else
+ MAP_SHARED | MAP_ANONYMOUS
#endif
, 0, 0)) == (Hunk_t *) MAP_FAILED)
// {
@@ -483,10 +484,10 @@ static Block_t *bl_mapnew(size_t size)
map_size = PAGE_ALIGN(size);
pt = mmap(LARGE_MSTART, map_size, PROT_READ | PROT_WRITE | PROT_EXEC,
-#ifdef __HAS_NO_MMU__
- MAP_SHARED | MAP_ANONYMOUS
-#else
+#ifdef __UCLIBC_HAS_MMU__
MAP_PRIVATE | MAP_ANONYMOUS
+#else
+ MAP_SHARED | MAP_ANONYMOUS
#endif
, 0, 0);
@@ -511,10 +512,10 @@ void __bl_uncommit(Block_t * b)
#if M_DOTRIMMING
mmap(u_start, u_end - u_start, PROT_READ | PROT_WRITE | PROT_EXEC,
-#ifdef __HAS_NO_MMU__
- MAP_SHARED | MAP_ANONYMOUS |MAP_FIXED
-#else
+#ifdef __UCLIBC_HAS_MMU__
MAP_PRIVATE | MAP_ANONYMOUS |MAP_FIXED
+#else
+ MAP_SHARED | MAP_ANONYMOUS |MAP_FIXED
#endif
, 0, 0);
#endif