From 82305c623900ce30a666bd14ae6901a1bf149bb7 Mon Sep 17 00:00:00 2001 From: Justus Winter <4winter@informatik.uni-hamburg.de> Date: Sun, 26 Apr 2015 15:35:43 +0200 Subject: kern: gracefully handle resource shortage * kern/task.c (task_create): Gracefully handle resource shortage. --- kern/task.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'kern') diff --git a/kern/task.c b/kern/task.c index 57e7f41..dcd5371 100644 --- a/kern/task.c +++ b/kern/task.c @@ -89,9 +89,8 @@ kern_return_t task_create( #endif new_task = (task_t) kmem_cache_alloc(&task_cache); - if (new_task == TASK_NULL) { - panic("task_create: no memory for task structure"); - } + if (new_task == TASK_NULL) + return KERN_RESOURCE_SHORTAGE; /* one ref for just being alive; one for our caller */ new_task->ref_count = 2; -- cgit v1.2.3