From 45afcc68979b700bdef1dc0e27ba79e0822b1c18 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sat, 3 Dec 2022 20:18:36 +0100 Subject: task: Add task_set_essential Whenever a Hurd essential task crashes, startup just reboots the system since there's not much that can be done at that point. When we have a kernel debugger, however, we could at least get crashing information, so let's let Hurd's startup tell the kernel which tasks are essential, and trigger the debugger whenever they crash. --- kern/task.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'kern/task.c') diff --git a/kern/task.c b/kern/task.c index e91c192b..e9158c73 100644 --- a/kern/task.c +++ b/kern/task.c @@ -178,6 +178,7 @@ task_create_kernel( new_task->may_assign = TRUE; new_task->assign_active = FALSE; + new_task->essential = FALSE; #if MACH_PCSAMPLE new_task->pc_sample.buffer = 0; @@ -1156,6 +1157,21 @@ task_set_name( return KERN_SUCCESS; } +/* + * task_set_essential + * + * Set whether TASK is an essential task, i.e. the whole system will crash + * if this task crashes. + */ +kern_return_t +task_set_essential( + task_t task, + boolean_t essential) +{ + task->essential = !!essential; + return KERN_SUCCESS; +} + /* * task_collect_scan: * -- cgit v1.2.3