]> git.ipfire.org Git - thirdparty/gcc.git/blob - libgo/runtime/mem_posix_memalign.c
Add Go frontend, libgo library, and Go testsuite.
[thirdparty/gcc.git] / libgo / runtime / mem_posix_memalign.c
1 #include <errno.h>
2
3 #include "runtime.h"
4 #include "malloc.h"
5
6 void*
7 runtime_SysAlloc(uintptr n)
8 {
9 void *p;
10
11 mstats.sys += n;
12 errno = posix_memalign(&p, PageSize, n);
13 if (errno > 0) {
14 perror("posix_memalign");
15 exit(2);
16 }
17 return p;
18 }
19
20 void
21 runtime_SysUnused(void *v, uintptr n)
22 {
23 USED(v);
24 USED(n);
25 // TODO(rsc): call madvise MADV_DONTNEED
26 }
27
28 void
29 runtime_SysFree(void *v, uintptr n)
30 {
31 mstats.sys -= n;
32 free(v);
33 }
34
35 void
36 runtime_SysMemInit(void)
37 {
38 }