0

How can i find out which process made a system call and switched the program from user to kernel mode without passing the pid to system call? Is there a function that returns this process pid, or a variable that it is stored into?

skrtbhtngr
  • 2,223
  • 23
  • 29
Alex.P
  • 33
  • 1
  • 1
  • 3
  • 2
    Possible duplicate of [What is Structure pointer "current" pointing to in Linux kernel code?](http://stackoverflow.com/questions/22346545/what-is-structure-pointer-current-pointing-to-in-linux-kernel-code) – Andrew Henle Nov 09 '16 at 11:21
  • I think you have a fundamental, and common, misunderstanding of how kernel mode works. Kernel code runs in the context of the current process, just in supervisor mode rather than user mode. So the current process is what is currently set up to run (e.g. has page tables loaded). Different OS's have different ways of providing basic Process Information to the kernel. – Mgetz Nov 09 '16 at 13:26

0 Answers0