The actual kernel code for getpid() is in kernel/sched.c: asmlinkage int sys_getpid(void) { return current->pid; } For reference, in include/linux/sched.h: extern struct task_struct *current; struct task_struct { int errno; int pid; /* and a lot of other stuff... */ };