diff --git a/headers/private/kernel/string.h b/headers/private/kernel/string.h new file mode 100644 index 0000000000..9af4e94157 --- /dev/null +++ b/headers/private/kernel/string.h @@ -0,0 +1,18 @@ +/* + * Copyright 2026, Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. + */ +#ifndef KERNEL_STRING_H +#define KERNEL_STRING_H + + +#include_next + + +#define memset(DEST, V, LEN) __builtin_memset((DEST), (V), (LEN)) +#define memcpy(DEST, SRC, LEN) __builtin_memcpy((DEST), (SRC), (LEN)) +#define memmove(DEST, SRC, LEN) __builtin_memmove((DEST), (SRC), (LEN)) +#define memcmp(B1, B2, LEN) __builtin_memcmp((B1), (B2), (LEN)) + + +#endif /* KERNEL_STRING_H */ diff --git a/src/system/libroot/posix/musl/string/memmove.c b/src/system/libroot/posix/musl/string/memmove.c index 5e025fd9a2..636b4dc859 100644 --- a/src/system/libroot/posix/musl/string/memmove.c +++ b/src/system/libroot/posix/musl/string/memmove.c @@ -1,5 +1,6 @@ #include #include +#undef memmove #if defined(__GNUC__) && __GNUC__ >= 4 typedef __attribute__((__may_alias__)) size_t WT; diff --git a/src/system/libroot/posix/string/arch/generic/generic_memcpy.c b/src/system/libroot/posix/string/arch/generic/generic_memcpy.c index 61d8fabddc..5ef7977b0d 100644 --- a/src/system/libroot/posix/string/arch/generic/generic_memcpy.c +++ b/src/system/libroot/posix/string/arch/generic/generic_memcpy.c @@ -6,6 +6,7 @@ #include #include +#undef memcpy #define MISALIGNMENT(PTR, TYPE) ((addr_t)(PTR) & (sizeof(TYPE) - 1)) diff --git a/src/system/libroot/posix/string/arch/generic/generic_memset.c b/src/system/libroot/posix/string/arch/generic/generic_memset.c index 57874003d9..9896c2ce1c 100644 --- a/src/system/libroot/posix/string/arch/generic/generic_memset.c +++ b/src/system/libroot/posix/string/arch/generic/generic_memset.c @@ -6,6 +6,7 @@ #include #include +#undef memset #define MISALIGNMENT(PTR, TYPE) ((addr_t)(PTR) & (sizeof(TYPE) - 1)) diff --git a/src/system/libroot/posix/string/memcmp.c b/src/system/libroot/posix/string/memcmp.c index 71d0cf98e4..f732d3482b 100644 --- a/src/system/libroot/posix/string/memcmp.c +++ b/src/system/libroot/posix/string/memcmp.c @@ -7,6 +7,7 @@ #include #include +#undef memcmp #define MISALIGNMENT(PTR, TYPE) ((addr_t)(PTR) & (sizeof(TYPE) - 1))