Commit 59714d65dfbc86d5cb93adc5bac57a921cc2fa84
Committed by
Linus Torvalds
1 parent
0ccf831cbe
Exists in
master
and in
4 other branches
get_task_comm(): return the result
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 <drepper@redhat.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Roland McGrath <roland@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 2 changed files with 3 additions and 2 deletions Side-by-side Diff
fs/exec.c
... | ... | @@ -947,12 +947,13 @@ |
947 | 947 | spin_unlock(&files->file_lock); |
948 | 948 | } |
949 | 949 | |
950 | -void get_task_comm(char *buf, struct task_struct *tsk) | |
950 | +char *get_task_comm(char *buf, struct task_struct *tsk) | |
951 | 951 | { |
952 | 952 | /* buf must be at least sizeof(tsk->comm) in size */ |
953 | 953 | task_lock(tsk); |
954 | 954 | strncpy(buf, tsk->comm, sizeof(tsk->comm)); |
955 | 955 | task_unlock(tsk); |
956 | + return buf; | |
956 | 957 | } |
957 | 958 | |
958 | 959 | void set_task_comm(struct task_struct *tsk, char *buf) |
include/linux/sched.h
... | ... | @@ -1770,7 +1770,7 @@ |
1770 | 1770 | struct task_struct *fork_idle(int); |
1771 | 1771 | |
1772 | 1772 | extern void set_task_comm(struct task_struct *tsk, char *from); |
1773 | -extern void get_task_comm(char *to, struct task_struct *tsk); | |
1773 | +extern char *get_task_comm(char *to, struct task_struct *tsk); | |
1774 | 1774 | |
1775 | 1775 | #ifdef CONFIG_SMP |
1776 | 1776 | extern void wait_task_inactive(struct task_struct * p); |