conf.set_quoted('LONG_MAX_STR', f'@long_max@')
foreach ident : [
+ ['renameat2', '''#include <stdio.h>'''], # since musl-1.2.6
['set_mempolicy', '''#include <sys/syscall.h>'''], # declared at numaif.h provided by libnuma, which we do not use
['get_mempolicy', '''#include <sys/syscall.h>'''], # declared at numaif.h provided by libnuma, which we do not use
['strerrorname_np', '''#include <string.h>'''], # since glibc-2.32
--- /dev/null
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#pragma once
+
+#include_next <stdio.h>
+
+#if !HAVE_RENAMEAT2
+# define RENAME_NOREPLACE (1 << 0)
+# define RENAME_EXCHANGE (1 << 1)
+# define RENAME_WHITEOUT (1 << 2)
+
+int missing_renameat2(int __oldfd, const char *__old, int __newfd, const char *__new, unsigned __flags);
+# define renameat2 missing_renameat2
+#endif
if get_option('libc') != 'musl'
subdir_done()
endif
+
+libc_wrapper_sources += files(
+ 'stdio.c',
+)
--- /dev/null
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+#include <stdio.h>
+#include <sys/syscall.h>
+#include <unistd.h>
+
+#if !HAVE_RENAMEAT2
+int missing_renameat2(int __oldfd, const char *__old, int __newfd, const char *__new, unsigned __flags) {
+ return syscall(__NR_renameat2, __oldfd, __old, __newfd, __new, __flags);
+}
+#endif