If I fork
and the child process then exec
and creates more child processes (which themselves can create more processes) , how do I get a list of pid
s of all the descendent process from the first process?
Is there a better way then looping though /proc/
and checking the PPid
(the parent of process's id) of each of process?
Iterating through /proc is the "standard" way to do this. That's how ps
and friends (pstree
, etc.) are implemented.
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