1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 20:07:36 +00:00

SystemServer: Port to LibMain :^)

This commit is contained in:
Andreas Kling 2021-12-16 20:04:50 +01:00
parent e5a5091b6f
commit e923762afc
2 changed files with 6 additions and 7 deletions

View file

@ -10,4 +10,4 @@ set(SOURCES
) )
serenity_bin(SystemServer) serenity_bin(SystemServer)
target_link_libraries(SystemServer LibCore) target_link_libraries(SystemServer LibCore LibMain)

View file

@ -15,6 +15,8 @@
#include <LibCore/Event.h> #include <LibCore/Event.h>
#include <LibCore/EventLoop.h> #include <LibCore/EventLoop.h>
#include <LibCore/File.h> #include <LibCore/File.h>
#include <LibCore/System.h>
#include <LibMain/Main.h>
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <grp.h> #include <grp.h>
@ -462,22 +464,19 @@ static void create_tmp_coredump_directory()
umask(old_umask); umask(old_umask);
} }
int main(int argc, char** argv) ErrorOr<int> serenity_main(Main::Arguments arguments)
{ {
bool user = false; bool user = false;
Core::ArgsParser args_parser; Core::ArgsParser args_parser;
args_parser.add_option(user, "Run in user-mode", "user", 'u'); args_parser.add_option(user, "Run in user-mode", "user", 'u');
args_parser.parse(argc, argv); args_parser.parse(arguments);
if (!user) { if (!user) {
mount_all_filesystems(); mount_all_filesystems();
prepare_synthetic_filesystems(); prepare_synthetic_filesystems();
} }
if (pledge("stdio proc exec tty accept unix rpath wpath cpath chown fattr id sigaction", nullptr) < 0) { TRY(Core::System::pledge("stdio proc exec tty accept unix rpath wpath cpath chown fattr id sigaction"));
perror("pledge");
return 1;
}
if (!user) { if (!user) {
create_tmp_coredump_directory(); create_tmp_coredump_directory();