I tried google, but found getppid() which gets the parent pid of the current process.
getppid()
I need something like getppid(some_other_pid)
getppid(some_other_pid)
You can have a look at sysctl() system call and this link.
sysctl()