summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustus Winter <4winter@informatik.uni-hamburg.de>2015-04-26 15:35:43 +0200
committerJustus Winter <4winter@informatik.uni-hamburg.de>2015-05-20 10:56:15 +0200
commit82305c623900ce30a666bd14ae6901a1bf149bb7 (patch)
tree7652580ba7ec9c3c2a0c0a8f9481fb2de4fd56f3
parentb3c5e41bc05bc622c637d1da75a3c63091e4e789 (diff)
kern: gracefully handle resource shortage
* kern/task.c (task_create): Gracefully handle resource shortage.
-rw-r--r--kern/task.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/kern/task.c b/kern/task.c
index 57e7f413..dcd53712 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;