diff options
| author | Jakob Kaivo <jkk@ung.org> | 2020-08-13 12:02:31 -0400 |
|---|---|---|
| committer | Jakob Kaivo <jkk@ung.org> | 2020-08-13 12:02:31 -0400 |
| commit | f829bca41f50a90a9f894b799b85386a7ef97deb (patch) | |
| tree | e53859160408413103e0f0a98c0ccc664b2dbfb8 /src/stdlib | |
| parent | e60d499c51d033447f21bb110c899cd2e578d065 (diff) | |
always implement in terms of mmap()
Diffstat (limited to 'src/stdlib')
| -rw-r--r-- | src/stdlib/realloc.c | 12 |
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; } |
