impose barrier between thread pointer setup and use for static linking
[musl.git] / src / malloc / posix_memalign.c
blob2ea8bd8a434a22f555e2ed9482299f0029870c73
1 #include <stdlib.h>
2 #include <errno.h>
3 #include "malloc_impl.h"
5 int posix_memalign(void **res, size_t align, size_t len)
7 if (align < sizeof(void *)) return EINVAL;
8 void *mem = __memalign(align, len);
9 if (!mem) return errno;
10 *res = mem;
11 return 0;