mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 00:14:32 +09:00
musl: meson: check existence of renameat2()
musl-1.2.5 does not provide renameat2(). Note, it is added by
05ce67fea9,
hence hopefully it will be provided by musl-1.2.6 or newer.
This commit is contained in:
@@ -579,6 +579,7 @@ assert(long_max > 100000)
|
||||
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
|
||||
|
||||
13
src/include/musl/stdio.h
Normal file
13
src/include/musl/stdio.h
Normal file
@@ -0,0 +1,13 @@
|
||||
/* 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
|
||||
@@ -3,3 +3,7 @@
|
||||
if get_option('libc') != 'musl'
|
||||
subdir_done()
|
||||
endif
|
||||
|
||||
libc_wrapper_sources += files(
|
||||
'stdio.c',
|
||||
)
|
||||
|
||||
11
src/libc/musl/stdio.c
Normal file
11
src/libc/musl/stdio.c
Normal file
@@ -0,0 +1,11 @@
|
||||
/* 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
|
||||
Reference in New Issue
Block a user