mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-29 16:21:07 +00:00
Implement posix_memalign for glibc.
This commit is contained in:
parent
12d3e57900
commit
a204dbb2ec
@ -4746,6 +4746,29 @@ free_atfork(mem, caller) Void_t* mem; const Void_t *caller;
|
|||||||
|
|
||||||
|
|
||||||
#ifdef _LIBC
|
#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_calloc, __calloc) weak_alias (__libc_calloc, calloc)
|
||||||
weak_alias (__libc_free, __cfree) weak_alias (__libc_free, cfree)
|
weak_alias (__libc_free, __cfree) weak_alias (__libc_free, cfree)
|
||||||
weak_alias (__libc_free, __free) weak_alias (__libc_free, free)
|
weak_alias (__libc_free, __free) weak_alias (__libc_free, free)
|
||||||
|
Loading…
Reference in New Issue
Block a user