proc: Consolidate task->comm formatting into proc_task_name()

proc shows task->comm in three places - comm, stat, status - and each
is fetching and formatting task->comm slighly differently.  This patch
renames task_name() to proc_task_name(), makes it more generic, and
updates all three paths to use it.

This will enable expanding comm reporting for workqueue workers.

Signed-off-by: Tejun Heo <tj@kernel.org>
This commit is contained in:
Tejun Heo
2018-05-18 08:47:13 -07:00
parent 8bf895931e
commit 88b72b31e1
3 changed files with 19 additions and 14 deletions

View File

@@ -1565,9 +1565,8 @@ static int comm_show(struct seq_file *m, void *v)
if (!p)
return -ESRCH;
task_lock(p);
seq_printf(m, "%s\n", p->comm);
task_unlock(p);
proc_task_name(m, p, false);
seq_putc(m, '\n');
put_task_struct(p);