1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-30 03:15:12 +00:00
serenity/Userland/Services/SpiceAgent/main.cpp
sin-ack 3f3f45580a Everywhere: Add sv suffix to strings relying on StringView(char const*)
Each of these strings would previously rely on StringView's char const*
constructor overload, which would call __builtin_strlen on the string.
Since we now have operator ""sv, we can replace these with much simpler
versions. This opens the door to being able to remove
StringView(char const*).

No functional changes.
2022-07-12 23:11:35 +02:00

30 lines
831 B
C++

/*
* Copyright (c) 2021, Kyle Pereira <kyle@xylepereira.me>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include "SpiceAgent.h"
#include <LibC/fcntl.h>
#include <LibCore/System.h>
#include <LibIPC/ConnectionToServer.h>
#include <LibMain/Main.h>
static constexpr auto SPICE_DEVICE = "/dev/hvc0p1"sv;
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));
TRY(Core::System::unveil("/tmp/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);
return loop.exec();
}