title: In Linux how do I retrieve the pid of the process making a system call
body: <p>I'm trying to understand how system call works in Linux kernel. One question I have is, how can I retrieve the pid of the process making a system call?</p>
  
  <p>e.g. I'm looking at <code>read()</code> call (sync read) which I think is defined in <strong>fs/read_write.c</strong> as</p>
  
  <pre><code>ssize_t do_sync_read(struct file *filp, char __user *buf, size_t len, loff_t *ppos)
  </code></pre>