diff options
-rw-r--r-- | malloc/malloc.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/malloc/malloc.c b/malloc/malloc.c index f674f4ebfe..7f33ebf252 100644 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@ -4746,6 +4746,29 @@ free_atfork(mem, caller) Void_t* mem; const Void_t *caller; #ifdef _LIBC +/* We need a wrapper function for one of the additions of POSIX. */ +int +__posix_memalign (void **memptr, size_t alignment, size_t size) +{ + void *mem; + + /* Test whether the SIZE argument is valid. It must be a power of + two multiple of sizeof (void *). */ + if (size % sizeof (void *) != 0 || (size & (size - 1)) != 0) + return EINVAL; + + mem = __libc_memalign (alignment, size); + + if (mem != NULL) + { + *memptr = mem; + return 0; + } + + return ENOMEM; +} +weak_alias (__posix_memalign, posix_memalign) + weak_alias (__libc_calloc, __calloc) weak_alias (__libc_calloc, calloc) weak_alias (__libc_free, __cfree) weak_alias (__libc_free, cfree) weak_alias (__libc_free, __free) weak_alias (__libc_free, free) |