Skip to content

Commit

Permalink
system/{Event,Signal}FD: pass std::span to FileDescriptor::Read()
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxKellermann committed Jan 1, 2025
1 parent c5dc368 commit 9877c38
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/system/EventFD.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "EventFD.hxx"
#include "system/Error.hxx"
#include "util/SpanCast.hxx"

#include <cassert>

Expand Down Expand Up @@ -31,5 +32,5 @@ EventFD::Write() noexcept

static constexpr eventfd_t value = 1;
[[maybe_unused]] ssize_t nbytes =
fd.Write(&value, sizeof(value));
fd.Write(ReferenceAsBytes(value));
}
3 changes: 2 additions & 1 deletion src/system/SignalFD.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "SignalFD.hxx"
#include "Error.hxx"
#include "util/SpanCast.hxx"

#include <cassert>

Expand All @@ -28,7 +29,7 @@ SignalFD::Read() noexcept
assert(fd.IsDefined());

signalfd_siginfo info;
return fd.Read(&info, sizeof(info)) > 0
return fd.Read(ReferenceAsWritableBytes(info)) > 0
? info.ssi_signo
: -1;
}

0 comments on commit 9877c38

Please sign in to comment.