Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

linux get process name from pid within kernel

hi i have used sys_getpid() from within kernel to get process id how can I find out process name from kernel struct? does it exist in kernel??

thanks very much

like image 784
Malesh N. Avatar asked Mar 23 '11 14:03

Malesh N.


1 Answers

struct task_struct contains a member called comm, it contains executable name excluding path.

Get current macro from this file will get you the name of the program that launched the current process (as in insmod / modprobe).

Using above info you can use get the name info.

like image 175
Zimbabao Avatar answered Sep 21 '22 03:09

Zimbabao