io/FileDescriptor: add pread() wrapper

This commit is contained in:
Max Kellermann 2022-08-31 16:05:37 +02:00 committed by Max Kellermann
parent 6913148d99
commit 69596106d3
1 changed files with 6 additions and 0 deletions

View File

@ -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);
}