aboutsummaryrefslogtreecommitdiff
path: root/kern
diff options
context:
space:
mode:
Diffstat (limited to 'kern')
-rw-r--r--kern/task.c16
-rw-r--r--kern/task.h3
2 files changed, 18 insertions, 1 deletions
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;
@@ -1157,6 +1158,21 @@ task_set_name(
}
/*
+ * 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:
*
* Attempt to free resources owned by tasks.
diff --git a/kern/task.h b/kern/task.h
index 52eb8324..6251317c 100644
--- a/kern/task.h
+++ b/kern/task.h
@@ -64,7 +64,8 @@ struct task {
/* Flags */
unsigned int active:1, /* Task has not been terminated */
/* boolean_t */ may_assign:1, /* can assigned pset be changed? */
- assign_active:1; /* waiting for may_assign */
+ assign_active:1, /* waiting for may_assign */
+ essential:1; /* Is this task essential for the system? */
/* Miscellaneous */
vm_map_t map; /* Address space description */