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

SystemServer: Implement keepalive

When reaping a child, SystemServer will now match up child's pid with its own
record of the services, and respawn the service if keepalive is enabled for it.

For example, we want to restart the WindowServer if it crashes, but we wouldn't
want to restart the Terminal if it gets closed.
This commit is contained in:
Sergey Bugaev 2019-11-26 19:19:59 +03:00 committed by Andreas Kling
parent b93065359e
commit 396ad4d6b2
4 changed files with 64 additions and 4 deletions

View file

@ -15,6 +15,9 @@ class Service final : public CObject {
public:
void spawn();
void did_exit(int exit_code);
static Service* find_by_pid(pid_t);
void save_to(AK::JsonObject&) override;
@ -28,6 +31,8 @@ private:
// File path to open as stdio fds.
String m_stdio_file_path;
int m_priority { 1 };
// Whether we should re-launch it if it exits.
bool m_keep_alive { false };
// The name of the user we should run this service as.
String m_user;
uid_t m_uid { 0 };