Module: xenomai-forge
Branch: master
Commit: fe0b803afbe802a2bd9b901c38539f728d794b24
URL:    
http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=fe0b803afbe802a2bd9b901c38539f728d794b24

Author: Gilles Chanteperdrix <gilles.chanteperd...@xenomai.org>
Date:   Tue May 15 00:55:03 2012 +0200

posix: get pthread_set_name_np to set linux thread name too

---

 kernel/cobalt/thread.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/kernel/cobalt/thread.c b/kernel/cobalt/thread.c
index d3fbb86..6459eef 100644
--- a/kernel/cobalt/thread.c
+++ b/kernel/cobalt/thread.c
@@ -1094,6 +1094,7 @@ int cobalt_thread_set_name_np(unsigned long tid, const 
char __user *u_name)
 {
        char name[XNOBJECT_NAME_LEN];
        struct cobalt_hkey hkey;
+       struct task_struct *p;
        pthread_t k_tid;
 
        if (__xn_safe_strncpy_from_user(name, u_name,
@@ -1106,6 +1107,10 @@ int cobalt_thread_set_name_np(unsigned long tid, const 
char __user *u_name)
        hkey.mm = current->mm;
        k_tid = cobalt_thread_find(&hkey);
 
+       p = xnthread_user_task(&k_tid->threadbase);
+       strncpy(p->comm, name, sizeof(p->comm));
+       p->comm[sizeof(p->comm) - 1] = '\0';
+
        return pthread_set_name_np(k_tid, name);
 }
 


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git

Reply via email to