From b5fbfe9aa60543635a2e3fcb86fdfd63e5781fb7 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 9 Mar 2023 17:59:11 +0100 Subject: [PATCH] io/FileDescriptor: fold CreateEventFD() into the EventFD constructor --- src/io/FileDescriptor.cxx | 7 ------- src/io/FileDescriptor.hxx | 1 - src/system/EventFD.cxx | 3 ++- 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/src/io/FileDescriptor.cxx b/src/io/FileDescriptor.cxx index c694a2281..354829c7b 100644 --- a/src/io/FileDescriptor.cxx +++ b/src/io/FileDescriptor.cxx @@ -238,13 +238,6 @@ FileDescriptor::CheckDuplicate(FileDescriptor new_fd) const noexcept #ifdef __linux__ -bool -FileDescriptor::CreateEventFD(unsigned initval) noexcept -{ - fd = ::eventfd(initval, EFD_NONBLOCK|EFD_CLOEXEC); - return fd >= 0; -} - bool FileDescriptor::CreateSignalFD(const sigset_t *mask) noexcept { diff --git a/src/io/FileDescriptor.hxx b/src/io/FileDescriptor.hxx index 34f1596a7..92f7db15e 100644 --- a/src/io/FileDescriptor.hxx +++ b/src/io/FileDescriptor.hxx @@ -181,7 +181,6 @@ public: #endif #ifdef __linux__ - bool CreateEventFD(unsigned initval=0) noexcept; bool CreateSignalFD(const sigset_t *mask) noexcept; #endif diff --git a/src/system/EventFD.cxx b/src/system/EventFD.cxx index 88b2eac47..d0916d4ab 100644 --- a/src/system/EventFD.cxx +++ b/src/system/EventFD.cxx @@ -9,8 +9,9 @@ #include EventFD::EventFD() + :fd(::eventfd(0, EFD_NONBLOCK|EFD_CLOEXEC)) { - if (!fd.CreateEventFD(0)) + if (!fd.IsDefined()) throw MakeErrno("eventfd() failed"); }