get _complete_ process name from pid
kernel, linux, linux-kernel
Solution
You could always look at how the kernel does it. You'll see the function:
proc_pid_cmdline(struct task_struct *task, char * buffer)
It's fairly easy to follow but once you have the `task_struct` for the process you are interested in you use `access_process_vm()` to slurp the bits you want from `mm->arg_start`.
Problem
I am in a kernel module and I want to have the whole process name from a given pid. exactly: I want the line which is hold in /proc/PID/cmdline. The problem is that `task_struct->comm[]` is only 15 bytes long and doesn't handle if a program changes his `argv[]` manually or via setproctitle(3)... Any ideas? :)