summaryrefslogtreecommitdiff
path: root/src/stdlib
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2020-08-13 12:02:31 -0400
committerJakob Kaivo <jkk@ung.org>2020-08-13 12:02:31 -0400
commitf829bca41f50a90a9f894b799b85386a7ef97deb (patch)
treee53859160408413103e0f0a98c0ccc664b2dbfb8 /src/stdlib
parente60d499c51d033447f21bb110c899cd2e578d065 (diff)
always implement in terms of mmap()
Diffstat (limited to 'src/stdlib')
-rw-r--r--src/stdlib/realloc.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/stdlib/realloc.c b/src/stdlib/realloc.c
index f16ba8a5..a7220acc 100644
--- a/src/stdlib/realloc.c
+++ b/src/stdlib/realloc.c
@@ -1,15 +1,20 @@
#include <stdlib.h>
-#if defined _POSIX_C_SOURCE && 199305L <= _POSIX_C_SOURCE
#include "sys/types.h"
#include "fcntl.h"
#include "sys/mman.h"
+#if defined _POSIX_C_SOURCE && 199305L <= _POSIX_C_SOURCE
+/* mu */
+#else
+#include "../sys/mman/mmap.c"
+#define PROT_READ 0x1
+#define PROT_WRITE 0x2
+#define MAP_PRIVATE 0x2
#endif
/** change the amount of memory allocated **/
void * realloc(void * ptr, size_t size)
{
-#if defined _POSIX_C_SOURCE && 199305L <= _POSIX_C_SOURCE
/* FIXME: forward dependency on POSIX.1b-1993, non-std /dev/zero */
static int backing = -1;
@@ -26,9 +31,6 @@ void * realloc(void * ptr, size_t size)
}
/* TODO: reallocate */
-#else
- (void)size;
-#endif
return ptr;
}