From 1b0d48517f816e98f19111df82f32bfc1608ecec Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Wed, 8 May 2024 08:50:03 -0400 Subject: implement posix_getdents adopted for next issue of POSIX this interface was added as the outcome of Austin Group tracker issue 697. no error is specified for unsupported flags, which is probably an oversight. for now, EOPNOTSUPP is used so as not to overload EINVAL. --- src/dirent/posix_getdents.c | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 src/dirent/posix_getdents.c (limited to 'src') diff --git a/src/dirent/posix_getdents.c b/src/dirent/posix_getdents.c new file mode 100644 index 00000000..b19e8127 --- /dev/null +++ b/src/dirent/posix_getdents.c @@ -0,0 +1,11 @@ +#include +#include +#include +#include "syscall.h" + +int posix_getdents(int fd, void *buf, size_t len, int flags) +{ + if (flags) return __syscall_ret(-EOPNOTSUPP); + if (len>INT_MAX) len = INT_MAX; + return syscall(SYS_getdents, fd, buf, len); +} -- cgit v1.2.1