io/FileDescriptor: fold CreateEventFD() into the EventFD constructor

This commit is contained in:
Max Kellermann 2023-03-09 17:59:11 +01:00
parent 598894211f
commit b5fbfe9aa6
3 changed files with 2 additions and 9 deletions

View File

@ -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
{

View File

@ -181,7 +181,6 @@ public:
#endif
#ifdef __linux__
bool CreateEventFD(unsigned initval=0) noexcept;
bool CreateSignalFD(const sigset_t *mask) noexcept;
#endif

View File

@ -9,8 +9,9 @@
#include <sys/eventfd.h>
EventFD::EventFD()
:fd(::eventfd(0, EFD_NONBLOCK|EFD_CLOEXEC))
{
if (!fd.CreateEventFD(0))
if (!fd.IsDefined())
throw MakeErrno("eventfd() failed");
}