System Call Table
I am trying to find the kernel function which the system call getpid() calls when it is invoked. However, when I look at the system call table all I am able to locate is the number associated with it (20) but no location of the file is given. Where would I have to look on the system to find this. Thank you!
Most of the system calls that don't have architectural dependencies can be found in src/kernel/... Just grep for it.
Originally Posted by NuNn
If all else fails, use a sledgehammer:
But be prepared to wade through the output to find the actual definition.
$ grep -Hrl getpid /path/to/kernel/src
Personally, I just use cscope and index the kernel source.
I like this a lot for finding definitions in source code, it works like a recursive grep (eg, start at /usr/include) but there's a GUI to organize the information in a more helpful friendly way, so you can sort the wheat from the chaff or whatever, and get a better picture of context than with your normal grep.
Also I wrote it, so it is guaranteed to work for me ;) Read the "Simple Command Lookup" under "uses" on the webpage and you will get the idea.
Or use LXR / The Linux Cross Reference - we actually use the same tool at work for our source-code.