I have added a custom system call in Linux Kernel. Now I want to find out the id of the process which issued that system call. If I use current pointer in the system call, I will get the information of the currently running process. It may not be the actual process which issued the system call especially in a multi-process environment. For example, in a user space program I have the code.
int pid = fork();
if(pid < 0) {
<statements>;
} else if(pid == 0) {
mysystemcall();
}
This is just an illustration. Now we don't know the order of execution of the parent and child process. Inside a system call, the current pointer may not be pointing to the task_struct of the parent process which issued that system call. So how can I find that process