mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-07 13:50:00 +00:00
LibIPC: Add missing include and impl on win32
This commit adds a missing include to MessageWindows after header cleanup. It also implement IPC::File which had its implementation moved out of the header, without the matching change to the windows implementation.
This commit is contained in:
parent
dca80ad5eb
commit
b9f1c7084b
Notes:
github-actions[bot]
2025-12-05 12:08:54 +00:00
Author: https://github.com/R-Goc
Commit: b9f1c7084b
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/7026
2 changed files with 50 additions and 0 deletions
|
|
@ -4,6 +4,8 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibIPC/Decoder.h>
|
||||
#include <LibIPC/File.h>
|
||||
#include <LibIPC/HandleType.h>
|
||||
|
|
@ -12,6 +14,53 @@
|
|||
|
||||
namespace IPC {
|
||||
|
||||
File File::adopt_file(NonnullOwnPtr<Core::File> file)
|
||||
{
|
||||
return File(file->leak_fd());
|
||||
}
|
||||
|
||||
File File::adopt_fd(int fd)
|
||||
{
|
||||
return File(fd);
|
||||
}
|
||||
|
||||
ErrorOr<File> File::clone_fd(int fd)
|
||||
{
|
||||
int new_fd = TRY(Core::System::dup(fd));
|
||||
return File(new_fd);
|
||||
}
|
||||
|
||||
File::File(int fd)
|
||||
: m_fd(fd)
|
||||
{
|
||||
}
|
||||
|
||||
File::File(File&& other)
|
||||
: m_fd(exchange(other.m_fd, -1))
|
||||
{
|
||||
}
|
||||
|
||||
File& File::operator=(File&& other)
|
||||
{
|
||||
if (this != &other) {
|
||||
m_fd = exchange(other.m_fd, -1);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
File::~File()
|
||||
{
|
||||
if (m_fd != -1)
|
||||
(void)Core::System::close(m_fd);
|
||||
}
|
||||
|
||||
// FIXME: IPC::Files transferred over the wire always set O_CLOEXEC during decoding. Perhaps we should add an option to
|
||||
// allow the receiver to decide whether to make it O_CLOEXEC or not. Or an attribute in the .ipc file?
|
||||
ErrorOr<void> File::clear_close_on_exec()
|
||||
{
|
||||
return Core::System::set_close_on_exec(m_fd, false);
|
||||
}
|
||||
|
||||
template<>
|
||||
ErrorOr<File> decode(Decoder& decoder)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
*/
|
||||
|
||||
#include <AK/ByteReader.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibIPC/HandleType.h>
|
||||
#include <LibIPC/Message.h>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue