Proc - Comm

The /proc/<pid>/comm and /proc/<pid>/task/<tid>/comm files provide a method to access a tasks comm value. It also allows for a task to set its own or one of its thread siblings comm value. The comm value is limited in size compared to the cmdline value, so writing anything longer then the kernel's TASK_COMM_LEN (currently 16 chars) will result in a truncated comm value.

Access with get_task_comm or set_task_comm (which lock it with task_lock())

Initialized normally by setup_new_exec.

Example usage:

#include linux/sched.h
 
struct task_struct *task;
 
for_each_process(task)
{
  printk("Name: %s PID: [%d]\n", task->comm, task->pid);
}