From e923762afc835b3d9b1e3226f74a17e7d164a23b Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 16 Dec 2021 20:04:50 +0100 Subject: [PATCH] SystemServer: Port to LibMain :^) --- Userland/Services/SystemServer/CMakeLists.txt | 2 +- Userland/Services/SystemServer/main.cpp | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Userland/Services/SystemServer/CMakeLists.txt b/Userland/Services/SystemServer/CMakeLists.txt index c648051333..2abf9bc40e 100644 --- a/Userland/Services/SystemServer/CMakeLists.txt +++ b/Userland/Services/SystemServer/CMakeLists.txt @@ -10,4 +10,4 @@ set(SOURCES ) serenity_bin(SystemServer) -target_link_libraries(SystemServer LibCore) +target_link_libraries(SystemServer LibCore LibMain) diff --git a/Userland/Services/SystemServer/main.cpp b/Userland/Services/SystemServer/main.cpp index 1b020eea60..66d14b6bf8 100644 --- a/Userland/Services/SystemServer/main.cpp +++ b/Userland/Services/SystemServer/main.cpp @@ -15,6 +15,8 @@ #include #include #include +#include +#include #include #include #include @@ -462,22 +464,19 @@ static void create_tmp_coredump_directory() umask(old_umask); } -int main(int argc, char** argv) +ErrorOr serenity_main(Main::Arguments arguments) { bool user = false; Core::ArgsParser args_parser; args_parser.add_option(user, "Run in user-mode", "user", 'u'); - args_parser.parse(argc, argv); + args_parser.parse(arguments); if (!user) { mount_all_filesystems(); prepare_synthetic_filesystems(); } - if (pledge("stdio proc exec tty accept unix rpath wpath cpath chown fattr id sigaction", nullptr) < 0) { - perror("pledge"); - return 1; - } + TRY(Core::System::pledge("stdio proc exec tty accept unix rpath wpath cpath chown fattr id sigaction")); if (!user) { create_tmp_coredump_directory();