7 uintptr_t __brk(uintptr_t);
11 void *__simple_malloc(size_t n)
13 static uintptr_t cur, brk;
18 if (n < SIZE_MAX - ALIGN)
19 while (align<n && align<ALIGN)
21 n = n + align - 1 & -align;
24 if (!cur) cur = brk = __brk(0)+16;
25 if (n > SIZE_MAX - brk) goto fail;
27 base = cur + align-1 & -align;
29 new = base+n + PAGE_SIZE-1 & -PAGE_SIZE;
30 if (__brk(new) != new) goto fail;
44 weak_alias(__simple_malloc, malloc);