io/UniqueFileDescriptor: use AdoptTag in the constructors that adopt ownership

This commit is contained in:
Max Kellermann
2025-01-23 16:47:13 +01:00
committed by Max Kellermann
parent 765a6a2f20
commit 35dc1fc589
9 changed files with 115 additions and 9 deletions

View File

@@ -5,7 +5,7 @@
#include "Error.hxx"
EpollFD::EpollFD()
:fd(::epoll_create1(EPOLL_CLOEXEC))
:fd(AdoptTag{}, ::epoll_create1(EPOLL_CLOEXEC))
{
if (!fd.IsDefined())
throw MakeErrno("epoll_create1() failed");

View File

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

View File

@@ -17,7 +17,7 @@ SignalFD::Create(const sigset_t &mask)
throw MakeErrno("signalfd() failed");
if (!fd.IsDefined()) {
fd = UniqueFileDescriptor{new_fd};
fd = UniqueFileDescriptor{AdoptTag{}, new_fd};
}
assert(new_fd == fd.Get());