From 69596106d3ce25b5c7cdf45ba7f7108212434fb7 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 31 Aug 2022 16:05:37 +0200 Subject: [PATCH] io/FileDescriptor: add pread() wrapper --- src/io/FileDescriptor.hxx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/io/FileDescriptor.hxx b/src/io/FileDescriptor.hxx index 43267d1b0..e94cc3e9d 100644 --- a/src/io/FileDescriptor.hxx +++ b/src/io/FileDescriptor.hxx @@ -244,6 +244,12 @@ public: [[gnu::pure]] off_t GetSize() const noexcept; +#ifndef _WIN32 + ssize_t ReadAt(off_t offset, void *buffer, std::size_t length) noexcept { + return ::pread(fd, buffer, length, offset); + } +#endif + ssize_t Read(void *buffer, std::size_t length) noexcept { return ::read(fd, buffer, length); }