mirror of
https://github.com/systemd/systemd.git
synced 2024-12-22 17:35:35 +03:00
missing: add getdents64() syscall wrapper
glibc 2.30 (Aug 2019) added a wrapper for getdents64(). For older versions let's define our own. (This syscall exists since Linux 2.4, hence should be safe to use for us)
This commit is contained in:
parent
b1967fb83a
commit
aab35b1e59
@ -546,6 +546,7 @@ foreach ident : [
|
||||
['mount_setattr', '''#include <sys/mount.h>'''],
|
||||
['move_mount', '''#include <sys/mount.h>'''],
|
||||
['open_tree', '''#include <sys/mount.h>'''],
|
||||
['getdents64', '''#include <dirent.h>'''],
|
||||
]
|
||||
|
||||
have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE')
|
||||
|
@ -540,3 +540,19 @@ static inline int missing_move_mount(
|
||||
|
||||
# define move_mount missing_move_mount
|
||||
#endif
|
||||
|
||||
/* ======================================================================= */
|
||||
|
||||
#if !HAVE_GETDENTS64
|
||||
|
||||
static inline ssize_t missing_getdents64(int fd, void *buffer, size_t length) {
|
||||
# if defined __NR_getdents64 && __NR_getdents64 >= 0
|
||||
return syscall(__NR_getdents64, fd, buffer, length);
|
||||
# else
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
# endif
|
||||
}
|
||||
|
||||
# define getdents64 missing_getdents64
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user