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:
parent
b93065359e
commit
396ad4d6b2
4 changed files with 64 additions and 4 deletions
|
@ -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 };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue