Serenity Operating System
at master 31 lines 980 B view raw
1/* 2 * Copyright (c) 2021, Dex♪ <dexes.ttp@gmail.com> 3 * 4 * SPDX-License-Identifier: BSD-2-Clause 5 */ 6 7#include <LibCore/EventLoop.h> 8#include <LibCore/LocalServer.h> 9#include <LibCore/System.h> 10#include <LibIPC/SingleServer.h> 11#include <LibMain/Main.h> 12#include <LibTLS/Certificate.h> 13#include <WebSocket/ConnectionFromClient.h> 14 15ErrorOr<int> serenity_main(Main::Arguments) 16{ 17 TRY(Core::System::pledge("stdio inet unix rpath sendfd recvfd")); 18 19 // Ensure the certificates are read out here. 20 [[maybe_unused]] auto& certs = DefaultRootCACertificates::the(); 21 22 Core::EventLoop event_loop; 23 // FIXME: Establish a connection to LookupServer and then drop "unix"? 24 TRY(Core::System::unveil("/tmp/portal/lookup", "rw")); 25 TRY(Core::System::unveil("/etc/timezone", "r")); 26 TRY(Core::System::unveil(nullptr, nullptr)); 27 28 auto client = TRY(IPC::take_over_accepted_client_from_system_server<WebSocket::ConnectionFromClient>()); 29 30 return event_loop.exec(); 31}