Skip to contentSkip to conversation

get_task_comm(): return the result

PATCH In review [email protected] 1 participant 1 message Nov 8, 2007

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 get_task_comm(): return the result

From: Andrew Morton <[email protected]>

It was dumb to make get_task_comm() return void. Change it to return a pointer to the resulting output for caller convenience.

Cc Ulrich Drepper <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Roland McGrath <[email protected]>

---

 fs/exec.c             |    3 ++-
 include/linux/sched.h |    2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)
include/linux/sched.h renamed from include/linux/sched.h~get_task_comm-return-the-result +1 -1
diff -puN include/linux/sched.h~get_task_comm-return-the-result include/linux/sched.h
@@ -1692,7 +1692,7 @@ extern long do_fork(unsigned long, unsig
 struct task_struct *fork_idle(int);
 
 extern void set_task_comm(struct task_struct *tsk, char *from);
-extern void get_task_comm(char *to, struct task_struct *tsk);
+extern char *get_task_comm(char *to, struct task_struct *tsk);
 
 #ifdef CONFIG_SMP
 extern void wait_task_inactive(struct task_struct * p);
fs/exec.c renamed from fs/exec.c~get_task_comm-return-the-result +2 -1
diff -puN fs/exec.c~get_task_comm-return-the-result fs/exec.c
@@ -947,12 +947,13 @@ static void flush_old_files(struct files
 	spin_unlock(&files->file_lock);
 }
 
-void get_task_comm(char *buf, struct task_struct *tsk)
+char *get_task_comm(char *buf, struct task_struct *tsk)
 {
 	/* buf must be at least sizeof(tsk->comm) in size */
 	task_lock(tsk);
 	strncpy(buf, tsk->comm, sizeof(tsk->comm));
 	task_unlock(tsk);
+	return buf;
 }
 
 void set_task_comm(struct task_struct *tsk, char *buf)

_