diff options
Diffstat (limited to 'libgo/runtime/mem_posix_memalign.c')
-rw-r--r-- | libgo/runtime/mem_posix_memalign.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/libgo/runtime/mem_posix_memalign.c b/libgo/runtime/mem_posix_memalign.c new file mode 100644 index 000000000..3855dfcf1 --- /dev/null +++ b/libgo/runtime/mem_posix_memalign.c @@ -0,0 +1,38 @@ +#include <errno.h> + +#include "runtime.h" +#include "malloc.h" + +void* +runtime_SysAlloc(uintptr n) +{ + void *p; + + mstats.sys += n; + errno = posix_memalign(&p, PageSize, n); + if (errno > 0) { + perror("posix_memalign"); + exit(2); + } + return p; +} + +void +runtime_SysUnused(void *v, uintptr n) +{ + USED(v); + USED(n); + // TODO(rsc): call madvise MADV_DONTNEED +} + +void +runtime_SysFree(void *v, uintptr n) +{ + mstats.sys -= n; + free(v); +} + +void +runtime_SysMemInit(void) +{ +} |