1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2026-01-13 01:31:00 +00:00
serenity/Userland/Libraries/LibC
Peter Elliott 4e0adb638d 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.
2022-05-20 22:18:54 +02:00
..
arch LibC: Implement a faster memset routine for x86-64 in assembly 2022-05-01 12:42:01 +02:00
arpa Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
bits LibC: Implement __fseterr 2022-04-03 19:15:14 +02:00
net LibC+LibDl: Declare functions taking no arguments as taking void 2022-01-08 19:22:00 +01:00
netinet LibC: Add IN6_IS_ADDR_MULTICAST 2022-05-05 20:47:38 +02:00
sys Everywhere: Purge all support and usage of framebuffer devices 2022-05-05 20:55:57 +02:00
alloca.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
assert.cpp Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
assert.h Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
byteswap.h Everywhere: Use "the SerenityOS developers." in copyright headers 2021-04-29 00:59:26 +02:00
CMakeLists.txt LibC: Implement posix_memalign(3) and aligned_alloc(3) 2022-05-20 22:18:54 +02:00
crt0.cpp LibCore+LibC: Enforce the global event loop ban in code 2022-01-23 15:21:10 +01:00
crt0_shared.cpp Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
ctype.cpp Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
ctype.h Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
cxxabi.cpp LibC: Avoid unnecessary mprotect during program finalization 2021-11-11 09:20:35 +01:00
dirent.cpp Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
dirent.h Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
dlfcn.cpp LibC+LibELF: Implement dladdr() 2021-06-06 22:16:11 +02:00
elf.h LibELF: Add support for IFUNCs 2022-05-01 12:42:01 +02:00
endian.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
errno.h LibC: Implement errno via a __errno_location() function 2022-04-21 11:49:48 +02:00
errno_codes.h LibC: Add missing macro definitions for errno codes 2022-05-08 13:04:32 -07:00
fcntl.cpp LibC: Implement posix_fadvise() (as a harmless no-op) 2022-04-29 22:01:30 +02:00
fcntl.h LibC: Add all the POSIX_FADV_* constants 2022-04-30 16:22:40 +02:00
fd_set.h LibC: Remove semicolon in definition of FD_ZERO 2022-03-06 13:00:42 +01:00
fenv.cpp LibC: Actually set the FPU environment instead of its pointer 2022-04-29 22:01:06 +02:00
fenv.h Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
float.h LibC+LibDl: Declare functions taking no arguments as taking void 2022-01-08 19:22:00 +01:00
fnmatch.cpp Everywhere: Fix more Copyright header inconsistencies 2021-10-04 11:10:09 +01:00
fnmatch.h Everywhere: Fix more Copyright header inconsistencies 2021-10-04 11:10:09 +01:00
getopt.cpp Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
getopt.h Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
grp.cpp Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
grp.h Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
iconv.h Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
ifaddrs.cpp Kernel+LibC: Stub out getifaddrs() and freeifaddrs() 2021-12-22 00:02:36 -08:00
ifaddrs.h Kernel+LibC: Stub out getifaddrs() and freeifaddrs() 2021-12-22 00:02:36 -08:00
inttypes.cpp Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
inttypes.h LibC: Use correct inttypes.h format strings on Aarch64 2022-04-23 10:43:32 -07:00
ioctl.cpp LibC: Don't truncate arguments for ioctl() on x86_64 2021-07-22 04:18:39 +04:30
langinfo.cpp Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
langinfo.h Everywhere: Fix more Copyright header inconsistencies 2021-10-04 11:10:09 +01:00
libcinit.cpp LibC: Implement errno via a __errno_location() function 2022-04-21 11:49:48 +02:00
libgen.cpp Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
libgen.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
limits.h LibC: Unconditionally include bits/posix1_lim.h from limits.h 2022-04-23 10:43:32 -07:00
link.cpp Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
link.h Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
locale.cpp Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
locale.h Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
malloc.cpp LibC: Implement posix_memalign(3) and aligned_alloc(3) 2022-05-20 22:18:54 +02:00
mallocdefs.h LibC: Increase alignment for malloc() BigAllocationBlocks to 16 bytes 2022-03-02 11:40:37 +01:00
memory.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
mntent.cpp LibC: Remove TODO() macros to not break mc port 2022-01-13 18:46:22 +01:00
mntent.h LibC: Add mntent stub functions 2022-01-07 18:38:32 +01:00
net.cpp Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
netdb.cpp LibC: Add herror() and hstrerror() 2022-05-12 15:01:32 +02:00
netdb.h LibC: Add herror() and hstrerror() 2022-05-12 15:01:32 +02:00
nl_types.h Everywhere: Fix more Copyright header inconsistencies 2021-10-04 11:10:09 +01:00
paths.h Everywhere: Use "the SerenityOS developers." in copyright headers 2021-04-29 00:59:26 +02:00
poll.cpp Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
poll.h Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
priority.cpp LibC: Add getpriority() and setpriority() stubs 2021-09-23 18:51:21 +02:00
pthread_forward.cpp Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
pthread_integration.cpp Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
pthread_tls.cpp Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
pty.cpp LibC: Remove debug spam from openpty() 2021-10-26 08:47:06 +02:00
pty.h LibC: Remove 'int* aslave' parameter from forkpty() 2021-05-06 13:52:46 +01:00
pwd.cpp Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
pwd.h Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
qsort.cpp Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
regex.cpp Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
regex.h Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
resolv.cpp Everywhere: Fix more Copyright header inconsistencies 2021-10-04 11:10:09 +01:00
resolv.h Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
scanf.cpp Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
sched.cpp LibC: Add POSIX spec comments for sched APIs 2021-12-21 18:16:48 -08:00
sched.h LibC+LibDl: Declare functions taking no arguments as taking void 2022-01-08 19:22:00 +01:00
search.cpp Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
search.h Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
serenity.cpp Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
serenity.h Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
setjmp.h LibC: Implement _setjmp and _longjmp 2021-12-24 05:26:21 -08:00
shadow.cpp Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
shadow.h Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
signal.cpp Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
signal.h Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
signal_numbers.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
spawn.cpp Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
spawn.h Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
ssp.cpp Everywhere: Make some symbols __attribute__((used)) for LTO 2021-10-17 17:09:58 +01:00
stat.cpp Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
stdarg.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
stddef.h LibC: Define offsetof in stddef.h instead of sys/cdefs.h 2022-02-28 20:28:01 -08:00
stdint.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
stdio.cpp LibC: Implement __fseterr 2022-04-03 19:15:14 +02:00
stdio.h Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
stdio_ext.h LibC: Implement __fseterr 2022-04-03 19:15:14 +02:00
stdlib.cpp LibC: Implement posix_memalign(3) and aligned_alloc(3) 2022-05-20 22:18:54 +02:00
stdlib.h LibC: Implement posix_memalign(3) and aligned_alloc(3) 2022-05-20 22:18:54 +02:00
string.cpp LibC: Implement a faster memset routine for x86-64 in assembly 2022-05-01 12:42:01 +02:00
string.h Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
strings.cpp Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
strings.h Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
stubs.cpp Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
sysexits.h LibC: Use EX_IOERR instead of EX_IOER 2021-06-10 20:21:08 +01:00
syslog.cpp Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
syslog.h Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
termcap.cpp Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
termcap.h Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
termios.cpp LibC: Stub out tcsendbreak(..) and tcdrain(..) 2021-12-29 03:17:41 -08:00
termios.h LibC: Stub out tcsendbreak(..) and tcdrain(..) 2021-12-29 03:17:41 -08:00
time.cpp LibC: Return early in time_to_tm for large time_t 2022-04-19 10:06:23 -04:00
time.h Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
times.cpp Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
ulimit.cpp LibC: Add a wrapper for the getrusage syscall 2022-02-28 20:09:37 +01:00
ulimit.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
unistd.cpp Kernel+LibC+LibCore: Implement the unlinkat(2) syscall 2022-04-23 10:43:32 -07:00
unistd.h LibC: Add more _POSIX_FOO constants to unistd.h 2022-04-29 22:01:27 +02:00
utime.cpp Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
utime.h Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
utmp.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
utsname.cpp Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
wchar.cpp LibC: Add POSIX spec links to all applicable wide character functions 2021-12-21 21:24:36 +03:30
wchar.h Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
wctype.cpp Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
wctype.h Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
wstdio.cpp LibC: Automatically append null terminator in vswprintf 2022-03-20 08:40:36 -04:00