1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-28 09:42:07 +00:00

LibIPC: Add File(Core::Stream::File& file, ...)

This commit is contained in:
Lucas CHOLLET 2022-12-17 17:43:36 +01:00 committed by Sam Atkins
parent f0d2a8dd57
commit fe2ab2bd8c

View file

@ -9,6 +9,7 @@
#include <AK/Noncopyable.h> #include <AK/Noncopyable.h>
#include <AK/StdLibExtras.h> #include <AK/StdLibExtras.h>
#include <LibCore/Stream.h>
#include <unistd.h> #include <unistd.h>
namespace IPC { namespace IPC {
@ -39,6 +40,12 @@ public:
{ {
} }
template<typename... Args>
File(Core::Stream::File& file, Args... args)
: File(file.leak_fd(Badge<File> {}), args...)
{
}
File(File&& other) File(File&& other)
: m_fd(exchange(other.m_fd, -1)) : m_fd(exchange(other.m_fd, -1))
, m_close_on_destruction(exchange(other.m_close_on_destruction, false)) , m_close_on_destruction(exchange(other.m_close_on_destruction, false))