diff options
author | Peter Elliott <pelliott@ualberta.ca> | 2021-10-07 23:17:37 -0600 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-10-17 22:18:48 +0200 |
commit | f8fb0359ae706aa14e220ac251f6a155de44e9cb (patch) | |
tree | be5ceb59941970783d29a3f417a4ab3a070cab25 /Userland | |
parent | 3ad6d87a4518732c8e181c0cf1edfab35716b92f (diff) | |
download | serenity-f8fb0359ae706aa14e220ac251f6a155de44e9cb.zip |
SystemServer: Add per user mode (--user)
System server running in user mode will form the basis of a "session"
for login purposes in serenity.
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Services/SystemServer/main.cpp | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/Userland/Services/SystemServer/main.cpp b/Userland/Services/SystemServer/main.cpp index 2d6bd2343b..0f4c17b0c1 100644 --- a/Userland/Services/SystemServer/main.cpp +++ b/Userland/Services/SystemServer/main.cpp @@ -1,5 +1,6 @@ /* * Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org> + * Copyright (c) 2021, Peter Elliott <pelliott@serenityos.org> * * SPDX-License-Identifier: BSD-2-Clause */ @@ -8,6 +9,7 @@ #include <AK/Assertions.h> #include <AK/ByteBuffer.h> #include <AK/Debug.h> +#include <LibCore/ArgsParser.h> #include <LibCore/ConfigFile.h> #include <LibCore/DirIterator.h> #include <LibCore/Event.h> @@ -456,18 +458,27 @@ static void create_tmp_coredump_directory() umask(old_umask); } -int main(int, char**) +int main(int argc, char** argv) { - mount_all_filesystems(); - prepare_synthetic_filesystems(); + bool user = false; + Core::ArgsParser args_parser; + args_parser.add_option(user, "Run in user-mode", "user", 'u'); + args_parser.parse(argc, argv); + + 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; } - create_tmp_coredump_directory(); - parse_boot_mode(); + if (!user) { + create_tmp_coredump_directory(); + parse_boot_mode(); + } Core::EventLoop event_loop; @@ -476,7 +487,9 @@ int main(int, char**) // Read our config and instantiate services. // This takes care of setting up sockets. NonnullRefPtrVector<Service> services; - auto config = Core::ConfigFile::open_for_system("SystemServer"); + auto config = (user) + ? Core::ConfigFile::open_for_app("SystemServer") + : Core::ConfigFile::open_for_system("SystemServer"); for (auto name : config->groups()) { auto service = Service::construct(*config, name); if (service->is_enabled()) |