diff options
author | Peter Elliott <pelliott@ualberta.ca> | 2022-05-04 23:08:57 -0600 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-05-20 22:18:54 +0200 |
commit | 4e0adb638dfe51916cbb708eb4cf6c4dee4e39d9 (patch) | |
tree | aeade67ced6aa93294bbc5fadc715682176db467 /Userland/Libraries/LibC/stdlib.cpp | |
parent | 830f5c610d63adaed331525f03700964f86bfcbe (diff) | |
download | serenity-4e0adb638dfe51916cbb708eb4cf6c4dee4e39d9.zip |
LibC: Implement posix_memalign(3) and aligned_alloc(3)
Some ports linked against posix_memalign, but didn't use it, and others
used it if it was Available. So I decided to implement posix_memalign.
My implementation adds almost no overhead to regular mallocs. However,
if an alignment is specified, it will use the smallest ChunkedBlock, for
which aligned chunks exist, and simply use one of the chunks that is
aligned. If it cannot use a ChunkedBlock, for size or alignment reasons,
it will use a BigAllocationBlock, and return a pointer to the first
aligned address past the start of the block. This implementation
supports alignments up to 32768, due to the limitations of the
BigAllocationBlock technique.
Diffstat (limited to 'Userland/Libraries/LibC/stdlib.cpp')
-rw-r--r-- | Userland/Libraries/LibC/stdlib.cpp | 11 |
1 files changed, 0 insertions, 11 deletions
diff --git a/Userland/Libraries/LibC/stdlib.cpp b/Userland/Libraries/LibC/stdlib.cpp index bd21c87fa7..695c9c35e8 100644 --- a/Userland/Libraries/LibC/stdlib.cpp +++ b/Userland/Libraries/LibC/stdlib.cpp @@ -1335,14 +1335,3 @@ void _Exit(int status) { _exit(status); } - -#ifdef SERENITY_LIBC_SHOW_POSIX_MEMALIGN -// https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_memalign.html -int posix_memalign(void** memptr, size_t alignment, size_t size) -{ - (void)memptr; - (void)alignment; - (void)size; - TODO(); -} -#endif |