From 669b941256fbf4c5acaf4d7a2f3ce07c66e0496c Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sat, 3 Dec 2022 19:31:59 +0100 Subject: mach-defpager: Mark as essential So we get to know why the system gets stuck if mach-defpager happens to die. --- mach-defpager/main.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'mach-defpager/main.c') diff --git a/mach-defpager/main.c b/mach-defpager/main.c index 0e42040b..69f83a58 100644 --- a/mach-defpager/main.c +++ b/mach-defpager/main.c @@ -42,6 +42,7 @@ #include #include #include +#include /* XXX */ #include "default_pager.h" @@ -141,6 +142,18 @@ main (int argc, char **argv) mach_port_deallocate (mach_task_self (), proc); + /* Mark us as essential. */ + mach_port_t startup; + startup = file_name_lookup (_SERVERS_STARTUP, 0, 0); + if (startup == MACH_PORT_NULL) + error (0, errno, "WARNING: Cannot register as essential task\n"); + + startup_essential_task (startup, mach_task_self (), MACH_PORT_NULL, + program_invocation_short_name, + bootstrap_master_host_port); + + mach_port_deallocate (mach_task_self (), startup); + printf_init(bootstrap_master_device_port); /* -- cgit v1.2.3