mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 05:47:34 +00:00
SpiceAgent: Let's start rewriting the messaging system :^)
The old message system was very dependent on syscalls, and the overall structure made it hard to implement new features. The new message system is pretty expandible, where each message has its own dedicated class. As well as this, we now use Core::File and AK::Stream for reading and writing messages. Using AK::Stream also allows us to change the actual data source (in this case, Core::File) without having to update a whole lot of code in the future.
This commit is contained in:
parent
fd4f00ee91
commit
79c73dd260
7 changed files with 320 additions and 370 deletions
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2021, Kyle Pereira <kyle@xylepereira.me>
|
||||
* Copyright (c) 2023, Caoimhe Byrne <caoimhebyrne06@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -16,15 +17,16 @@ ErrorOr<int> serenity_main(Main::Arguments)
|
|||
{
|
||||
Core::EventLoop loop;
|
||||
|
||||
TRY(Core::System::pledge("unix rpath wpath stdio sendfd recvfd"));
|
||||
TRY(Core::System::unveil(SPICE_DEVICE, "rw"sv));
|
||||
// FIXME: Make Core::File support reading and writing, but without creating:
|
||||
// By default, Core::File opens the file descriptor with O_CREAT when using OpenMode::Write (and subsequently, OpenMode::ReadWrite).
|
||||
// To minimise confusion for people that have already used Core::File, we can probably just do `OpenMode::ReadWrite | OpenMode::DontCreate`.
|
||||
TRY(Core::System::pledge("unix rpath wpath stdio sendfd recvfd cpath"));
|
||||
TRY(Core::System::unveil(SPICE_DEVICE, "rwc"sv));
|
||||
TRY(Core::System::unveil("/tmp/session/%sid/portal/clipboard", "rw"));
|
||||
TRY(Core::System::unveil(nullptr, nullptr));
|
||||
|
||||
int serial_port_fd = TRY(Core::System::open(SPICE_DEVICE, O_RDWR));
|
||||
|
||||
auto conn = TRY(ConnectionToClipboardServer::try_create());
|
||||
auto agent = SpiceAgent(serial_port_fd, conn);
|
||||
auto agent = TRY(SpiceAgent::SpiceAgent::create(SPICE_DEVICE));
|
||||
TRY(agent->start());
|
||||
|
||||
return loop.exec();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue