mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 08:47:44 +00:00
LibCore+LibSystem: Move syscall wrappers from LibSystem to LibCore
With this change, System::foo() becomes Core::System::foo(). Since LibCore builds on other systems than SerenityOS, we now have to make sure that wrappers work with just a standard C library underneath.
This commit is contained in:
parent
acc2eccede
commit
21a5fb0fa2
32 changed files with 165 additions and 173 deletions
|
@ -6,14 +6,14 @@
|
|||
|
||||
#include <FileSystemAccessServer/ClientConnection.h>
|
||||
#include <LibCore/LocalServer.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibGUI/Application.h>
|
||||
#include <LibIPC/ClientConnection.h>
|
||||
#include <LibMain/Main.h>
|
||||
#include <LibSystem/Wrappers.h>
|
||||
|
||||
ErrorOr<int> serenity_main(Main::Arguments)
|
||||
{
|
||||
TRY(System::pledge("stdio recvfd sendfd rpath cpath wpath unix thread", nullptr));
|
||||
TRY(Core::System::pledge("stdio recvfd sendfd rpath cpath wpath unix thread", nullptr));
|
||||
|
||||
auto app = GUI::Application::construct(0, nullptr);
|
||||
app->set_quit_when_last_window_deleted(false);
|
||||
|
|
|
@ -7,18 +7,18 @@
|
|||
#include <ImageDecoder/ClientConnection.h>
|
||||
#include <LibCore/EventLoop.h>
|
||||
#include <LibCore/LocalServer.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibIPC/ClientConnection.h>
|
||||
#include <LibMain/Main.h>
|
||||
#include <LibSystem/Wrappers.h>
|
||||
|
||||
ErrorOr<int> serenity_main(Main::Arguments)
|
||||
{
|
||||
Core::EventLoop event_loop;
|
||||
TRY(System::pledge("stdio recvfd sendfd unix", nullptr));
|
||||
TRY(System::unveil(nullptr, nullptr));
|
||||
TRY(Core::System::pledge("stdio recvfd sendfd unix", nullptr));
|
||||
TRY(Core::System::unveil(nullptr, nullptr));
|
||||
|
||||
auto socket = Core::LocalSocket::take_over_accepted_socket_from_system_server();
|
||||
IPC::new_client_connection<ImageDecoder::ClientConnection>(socket.release_nonnull(), 1);
|
||||
TRY(System::pledge("stdio recvfd sendfd", nullptr));
|
||||
TRY(Core::System::pledge("stdio recvfd sendfd", nullptr));
|
||||
return event_loop.exec();
|
||||
}
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
#include <AK/OwnPtr.h>
|
||||
#include <LibCore/EventLoop.h>
|
||||
#include <LibCore/LocalServer.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibIPC/ClientConnection.h>
|
||||
#include <LibMain/Main.h>
|
||||
#include <LibSystem/Wrappers.h>
|
||||
#include <LibTLS/Certificate.h>
|
||||
#include <RequestServer/ClientConnection.h>
|
||||
#include <RequestServer/GeminiProtocol.h>
|
||||
|
@ -19,7 +19,7 @@
|
|||
|
||||
ErrorOr<int> serenity_main(Main::Arguments)
|
||||
{
|
||||
TRY(System::pledge("stdio inet accept unix rpath sendfd recvfd sigaction", nullptr));
|
||||
TRY(Core::System::pledge("stdio inet accept unix rpath sendfd recvfd sigaction", nullptr));
|
||||
|
||||
signal(SIGINFO, [](int) { RequestServer::ConnectionCache::dump_jobs(); });
|
||||
|
||||
|
@ -28,9 +28,9 @@ ErrorOr<int> serenity_main(Main::Arguments)
|
|||
|
||||
Core::EventLoop event_loop;
|
||||
// FIXME: Establish a connection to LookupServer and then drop "unix"?
|
||||
TRY(System::pledge("stdio inet accept unix sendfd recvfd", nullptr));
|
||||
TRY(System::unveil("/tmp/portal/lookup", "rw"));
|
||||
TRY(System::unveil(nullptr, nullptr));
|
||||
TRY(Core::System::pledge("stdio inet accept unix sendfd recvfd", nullptr));
|
||||
TRY(Core::System::unveil("/tmp/portal/lookup", "rw"));
|
||||
TRY(Core::System::unveil(nullptr, nullptr));
|
||||
|
||||
[[maybe_unused]] auto gemini = make<RequestServer::GeminiProtocol>();
|
||||
[[maybe_unused]] auto http = make<RequestServer::HttpProtocol>();
|
||||
|
|
|
@ -6,20 +6,20 @@
|
|||
|
||||
#include <LibCore/EventLoop.h>
|
||||
#include <LibCore/LocalServer.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibIPC/ClientConnection.h>
|
||||
#include <LibMain/Main.h>
|
||||
#include <LibSystem/Wrappers.h>
|
||||
#include <WebContent/ClientConnection.h>
|
||||
|
||||
ErrorOr<int> serenity_main(Main::Arguments)
|
||||
{
|
||||
Core::EventLoop event_loop;
|
||||
TRY(System::pledge("stdio recvfd sendfd accept unix rpath", nullptr));
|
||||
TRY(System::unveil("/res", "r"));
|
||||
TRY(System::unveil("/tmp/portal/request", "rw"));
|
||||
TRY(System::unveil("/tmp/portal/image", "rw"));
|
||||
TRY(System::unveil("/tmp/portal/websocket", "rw"));
|
||||
TRY(System::unveil(nullptr, nullptr));
|
||||
TRY(Core::System::pledge("stdio recvfd sendfd accept unix rpath", nullptr));
|
||||
TRY(Core::System::unveil("/res", "r"));
|
||||
TRY(Core::System::unveil("/tmp/portal/request", "rw"));
|
||||
TRY(Core::System::unveil("/tmp/portal/image", "rw"));
|
||||
TRY(Core::System::unveil("/tmp/portal/websocket", "rw"));
|
||||
TRY(Core::System::unveil(nullptr, nullptr));
|
||||
|
||||
auto socket = Core::LocalSocket::take_over_accepted_socket_from_system_server();
|
||||
VERIFY(socket);
|
||||
|
|
|
@ -6,24 +6,24 @@
|
|||
|
||||
#include <LibCore/EventLoop.h>
|
||||
#include <LibCore/LocalServer.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibIPC/ClientConnection.h>
|
||||
#include <LibMain/Main.h>
|
||||
#include <LibSystem/Wrappers.h>
|
||||
#include <LibTLS/Certificate.h>
|
||||
#include <WebSocket/ClientConnection.h>
|
||||
|
||||
ErrorOr<int> serenity_main(Main::Arguments)
|
||||
{
|
||||
TRY(System::pledge("stdio inet unix rpath sendfd recvfd", nullptr));
|
||||
TRY(Core::System::pledge("stdio inet unix rpath sendfd recvfd", nullptr));
|
||||
|
||||
// Ensure the certificates are read out here.
|
||||
[[maybe_unused]] auto& certs = DefaultRootCACertificates::the();
|
||||
|
||||
Core::EventLoop event_loop;
|
||||
// FIXME: Establish a connection to LookupServer and then drop "unix"?
|
||||
TRY(System::pledge("stdio inet unix sendfd recvfd", nullptr));
|
||||
TRY(System::unveil("/tmp/portal/lookup", "rw"));
|
||||
TRY(System::unveil(nullptr, nullptr));
|
||||
TRY(Core::System::pledge("stdio inet unix sendfd recvfd", nullptr));
|
||||
TRY(Core::System::unveil("/tmp/portal/lookup", "rw"));
|
||||
TRY(Core::System::unveil(nullptr, nullptr));
|
||||
|
||||
auto socket = Core::LocalSocket::take_over_accepted_socket_from_system_server();
|
||||
VERIFY(socket);
|
||||
|
|
|
@ -12,25 +12,25 @@
|
|||
#include <LibCore/ConfigFile.h>
|
||||
#include <LibCore/DirIterator.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibGfx/Palette.h>
|
||||
#include <LibGfx/SystemTheme.h>
|
||||
#include <LibMain/Main.h>
|
||||
#include <LibSystem/Wrappers.h>
|
||||
#include <signal.h>
|
||||
#include <string.h>
|
||||
|
||||
ErrorOr<int> serenity_main(Main::Arguments)
|
||||
{
|
||||
TRY(System::pledge("stdio video thread sendfd recvfd accept rpath wpath cpath unix proc sigaction", nullptr));
|
||||
TRY(System::unveil("/res", "r"));
|
||||
TRY(System::unveil("/tmp", "cw"));
|
||||
TRY(System::unveil("/etc/WindowServer.ini", "rwc"));
|
||||
TRY(System::unveil("/dev", "rw"));
|
||||
TRY(Core::System::pledge("stdio video thread sendfd recvfd accept rpath wpath cpath unix proc sigaction", nullptr));
|
||||
TRY(Core::System::unveil("/res", "r"));
|
||||
TRY(Core::System::unveil("/tmp", "cw"));
|
||||
TRY(Core::System::unveil("/etc/WindowServer.ini", "rwc"));
|
||||
TRY(Core::System::unveil("/dev", "rw"));
|
||||
|
||||
struct sigaction act = {};
|
||||
act.sa_flags = SA_NOCLDWAIT;
|
||||
act.sa_handler = SIG_IGN;
|
||||
TRY(System::sigaction(SIGCHLD, &act, nullptr));
|
||||
TRY(Core::System::sigaction(SIGCHLD, &act, nullptr));
|
||||
|
||||
auto wm_config = Core::ConfigFile::open("/etc/WindowServer.ini");
|
||||
auto theme_name = wm_config->read_entry("Theme", "Name", "Default");
|
||||
|
@ -48,7 +48,7 @@ ErrorOr<int> serenity_main(Main::Arguments)
|
|||
|
||||
WindowServer::EventLoop loop;
|
||||
|
||||
TRY(System::pledge("stdio video thread sendfd recvfd accept rpath wpath cpath proc", nullptr));
|
||||
TRY(Core::System::pledge("stdio video thread sendfd recvfd accept rpath wpath cpath proc", nullptr));
|
||||
|
||||
// First check which screens are explicitly configured
|
||||
{
|
||||
|
@ -114,13 +114,13 @@ ErrorOr<int> serenity_main(Main::Arguments)
|
|||
auto am = WindowServer::AppletManager::construct();
|
||||
auto mm = WindowServer::MenuManager::construct();
|
||||
|
||||
TRY(System::unveil("/tmp", ""));
|
||||
TRY(Core::System::unveil("/tmp", ""));
|
||||
|
||||
// NOTE: Because we dynamically need to be able to open new /dev/fb*
|
||||
// devices we can't really unveil all of /dev unless we have some
|
||||
// other mechanism that can hand us file descriptors for these.
|
||||
|
||||
TRY(System::unveil(nullptr, nullptr));
|
||||
TRY(Core::System::unveil(nullptr, nullptr));
|
||||
|
||||
dbgln("Entering WindowServer main loop");
|
||||
loop.exec();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue