From 81cced6ebeb4419a78a8892ec7d7e28f5582d24a Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Thu, 25 Jan 2024 12:02:34 -0500 Subject: add preadv2 and pwritev2 syscall wrappers, flag value macros --- src/linux/pwritev2.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/linux/pwritev2.c (limited to 'src/linux/pwritev2.c') diff --git a/src/linux/pwritev2.c b/src/linux/pwritev2.c new file mode 100644 index 00000000..ece90d7c --- /dev/null +++ b/src/linux/pwritev2.c @@ -0,0 +1,17 @@ +#define _GNU_SOURCE +#include +#include +#include "syscall.h" + +ssize_t pwritev2(int fd, const struct iovec *iov, int count, off_t ofs, int flags) +{ +#ifdef SYS_pwritev + if (!flags) { + if (ofs==-1) return writev(fd, iov, count); + return syscall_cp(SYS_pwritev, fd, iov, count, + (long)(ofs), (long)(ofs>>32)); + } +#endif + return syscall_cp(SYS_pwritev2, fd, iov, count, + (long)(ofs), (long)(ofs>>32), flags); +} -- cgit v1.2.1