io/FileDescriptor: add Read()/Write() overloads with std::span

This commit is contained in:
Max Kellermann
2023-09-27 10:46:43 +02:00
committed by Max Kellermann
parent 5fbe5951ab
commit cad35a83fb
7 changed files with 14 additions and 7 deletions

View File

@@ -64,8 +64,7 @@ try {
static_assert(sizeof(buffer) >= sizeof(struct inotify_event) + NAME_MAX + 1,
"inotify buffer too small");
ssize_t nbytes = event.GetFileDescriptor().Read(buffer.data(),
buffer.size());
ssize_t nbytes = event.GetFileDescriptor().Read(buffer);
if (nbytes <= 0) [[unlikely]] {
if (nbytes == 0)
throw std::runtime_error{"EOF from inotify"};