I tried google, but found getppid()
which gets the parent pid of the current process.
I need something like getppid(some_other_pid)
, is there such a thing? Basically takes the pid of some process and returns the parent process' 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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With