From f829bca41f50a90a9f894b799b85386a7ef97deb Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Thu, 13 Aug 2020 12:02:31 -0400 Subject: always implement in terms of mmap() --- src/stdlib/realloc.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src') 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 -#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; } -- cgit v1.2.1