1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 08:07:34 +00:00

SystemServer: Make decision on whether to enable a service more readable

This change ensures that code in the Service class doesn't try to check
the g_system_mode variable, but instead is asked on whether it supports
a given system mode string value.

Also, don't assume that we should create sockets for any new Service
instance, but instead do that only if the Service should run in the
current system mode.
This commit is contained in:
Liav A 2023-06-25 13:45:56 +03:00 committed by Andrew Kaster
parent 41db527369
commit 9dbd22b555
3 changed files with 72 additions and 27 deletions

View file

@ -20,11 +20,13 @@ public:
static ErrorOr<NonnullRefPtr<Service>> try_create(Core::ConfigFile const& config, StringView name);
~Service();
bool is_enabled() const;
bool is_enabled_for_system_mode(StringView) const;
ErrorOr<void> activate();
// Note: This is a `status` as in POSIX's wait syscall, not an exit-code.
ErrorOr<void> did_exit(int status);
ErrorOr<void> setup_sockets();
static Service* find_by_pid(pid_t);
private:
@ -90,7 +92,6 @@ private:
int m_restart_attempts { 0 };
ErrorOr<void> setup_socket(SocketDescriptor&);
ErrorOr<void> setup_sockets();
void setup_notifier();
ErrorOr<void> handle_socket_connection();
};