1#include <errno.h>2#include <stddef.h>34#include "../../syscall.h"56static char heap[16384];78/*9 * TODO: Temporary solution until we implement mmap in Darwin10 * because it does not support any form of brk().11 */12void *13_getheap(void)14{15 return heap;16}1718int19_brk(void *addr)20{21 static char *cur = heap;22 char *p = addr;2324 if (p < heap || p > &heap[sizeof(heap) - 1]) {25 errno = ENOMEM;26 return -1;27 }28 cur = p;2930 return 0;31}