summaryrefslogtreecommitdiff
path: root/kern/task.c
diff options
context:
space:
mode:
authorJustus Winter <4winter@informatik.uni-hamburg.de>2014-02-01 02:23:07 +0100
committerJustus Winter <4winter@informatik.uni-hamburg.de>2014-02-05 11:57:56 +0100
commitde74f85990dc39bc6723f046f83d4e53c45f4343 (patch)
treeb6fc1e172728f190095342b3d1597d43402c572a /kern/task.c
parent32dcfafb3b8cdc22641254d50571b8be1d33fae3 (diff)
kern: implement task_set_name
task_set_name sets the name of a task. This is a debugging aid. The name will be used in error messages printed by the kernel. * kern/task.c (task_set_name): New function. * kern/task.h (task_set_name): New declaration.
Diffstat (limited to 'kern/task.c')
-rw-r--r--kern/task.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/kern/task.c b/kern/task.c
index 0b5a6f7..66eb25c 100644
--- a/kern/task.c
+++ b/kern/task.c
@@ -37,6 +37,7 @@
#include <mach/vm_param.h>
#include <mach/task_info.h>
#include <mach/task_special_ports.h>
+#include <mach_debug/mach_debug_types.h>
#include <ipc/ipc_space.h>
#include <ipc/ipc_types.h>
#include <kern/debug.h>
@@ -1071,6 +1072,22 @@ task_priority(
}
/*
+ * task_set_name
+ *
+ * Set the name of task TASK to NAME. This is a debugging aid.
+ * NAME will be used in error messages printed by the kernel.
+ */
+kern_return_t
+task_set_name(
+ task_t task,
+ kernel_debug_name_t name)
+{
+ strncpy(task->name, name, sizeof task->name - 1);
+ task->name[sizeof task->name - 1] = '\0';
+ return KERN_SUCCESS;
+}
+
+/*
* task_collect_scan:
*
* Attempt to free resources owned by tasks.