Obtaining Process Name in Kernel Space
I have a situation where I have a kernel module loggging in the description of the user processes calling the module.
The Information expected to be logged include: Process ID, Process description/name, etc....
I have no issues with the other data, but am stuck with regards to Process description/name. This data field is essential since Process ID being dyanamic doesnt give me any forthright useful info as to which user level module called my module.
Referring to the Rubini booked yielded this: char comm array in task_struct carries the Process description. But I could not get further details on this array: Who updates this, is the user space supposed to give an input for this, is this a compulosory field, or only some processes have an entry in this array, etc...
1.Could anyone please clarify on the status of the comm array, or any other better alternative to Log the process name.
2.Which ID is better: pid or tgid.
I am a Kernel newbie, and I am finding it tough to get a standard set of Kerenl APIs etc. For ex: there is no documentation in the kerenel regarding many semaphore APIs like: down_interruptible or variable description of variables like comm even though it is present in an important structure like task_struct. So where can I find good documentation/description of Kernel Structures, Variables and APIs.
Thanks a lot for your patience and for the help.