summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arch/x86/machine/cpu.c3
-rw-r--r--kern/task.c4
-rw-r--r--kern/thread.h6
3 files changed, 9 insertions, 4 deletions
diff --git a/arch/x86/machine/cpu.c b/arch/x86/machine/cpu.c
index fc8fde3f..225f6483 100644
--- a/arch/x86/machine/cpu.c
+++ b/arch/x86/machine/cpu.c
@@ -445,8 +445,7 @@ cpu_show_thread(void)
thread = thread_self();
- /* TODO Thread name accessor */
- printf("cpu: interrupted thread: %p (%s)\n", thread, thread->name);
+ printf("cpu: interrupted thread: %p (%s)\n", thread, thread_name(thread));
}
#ifdef __LP64__
diff --git a/kern/task.c b/kern/task.c
index 3ad863bd..aaa30f44 100644
--- a/kern/task.c
+++ b/kern/task.c
@@ -212,7 +212,7 @@ task_lookup_thread(struct task *task, const char *name)
spinlock_lock(&task->lock);
list_for_each_entry(&task->threads, thread, task_node) {
- if (strcmp(thread->name, name) == 0) {
+ if (strcmp(thread_name(thread), name) == 0) {
thread_ref(thread);
spinlock_unlock(&task->lock);
return thread;
@@ -263,7 +263,7 @@ task_info(struct task *task)
thread_sched_class_to_str(thread_user_sched_class(thread)),
thread_user_priority(thread),
thread_real_global_priority(thread),
- thread->name);
+ thread_name(thread));
}
spinlock_unlock(&task->lock);
diff --git a/kern/thread.h b/kern/thread.h
index fd729b3d..49d8b109 100644
--- a/kern/thread.h
+++ b/kern/thread.h
@@ -712,6 +712,12 @@ thread_get_specific(unsigned int key)
return thread_tsd_get(thread_self(), key);
}
+static inline const char *
+thread_name(const struct thread *thread)
+{
+ return thread->name;
+}
+
#ifdef CONFIG_PERFMON
static inline struct perfmon_td *
thread_get_perfmon_td(struct thread *thread)