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)
I think the simplest thing would be to open "/proc" and parse the contents.
You'll find the ppid as the 4th parameter of /proc/pid/stat