PR debug/47106
[official-gcc.git] / libgo / runtime / mem_posix_memalign.c
blob3855dfcf185d16b27de9176f0e6d958b76e8c298
1 #include <errno.h>
3 #include "runtime.h"
4 #include "malloc.h"
6 void*
7 runtime_SysAlloc(uintptr n)
9 void *p;
11 mstats.sys += n;
12 errno = posix_memalign(&p, PageSize, n);
13 if (errno > 0) {
14 perror("posix_memalign");
15 exit(2);
17 return p;
20 void
21 runtime_SysUnused(void *v, uintptr n)
23 USED(v);
24 USED(n);
25 // TODO(rsc): call madvise MADV_DONTNEED
28 void
29 runtime_SysFree(void *v, uintptr n)
31 mstats.sys -= n;
32 free(v);
35 void
36 runtime_SysMemInit(void)