github.com/afumu/libc@v0.0.6/musl/src/malloc/posix_memalign.c (about)

     1  #include <stdlib.h>
     2  #include <errno.h>
     3  
     4  int posix_memalign(void **res, size_t align, size_t len)
     5  {
     6  	if (align < sizeof(void *)) return EINVAL;
     7  	void *mem = aligned_alloc(align, len);
     8  	if (!mem) return errno;
     9  	*res = mem;
    10  	return 0;
    11  }