From f1f7bf567bb54ef9fb56e06907ab4a2237601115 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 14 Jan 2021 09:39:30 +0100 Subject: LibIPC: Add an expressive way to close an IPC::File after sending it If you don't need a file descriptor after sending it to someone over IPC, construct it with IPC::File(fd, IPC::File::CloseAfterSending) and LibIPC will take care of it for you. :^) --- Userland/Libraries/LibIPC/File.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Userland/Libraries/LibIPC/File.h') diff --git a/Userland/Libraries/LibIPC/File.h b/Userland/Libraries/LibIPC/File.h index f18d6a6f15..51d14633f4 100644 --- a/Userland/Libraries/LibIPC/File.h +++ b/Userland/Libraries/LibIPC/File.h @@ -48,8 +48,10 @@ public: } // Tagged constructor for fd's that should be closed on destruction unless take_fd() is called. + // Note that the tags are the same, this is intentional to allow expressive invocation. enum Tag { ConstructWithReceivedFileDescriptor = 1, + CloseAfterSending = 1, }; File(int fd, Tag) : m_fd(fd) -- cgit v1.2.3