finding children processes of a particular process (UNIX)
i am requir开发者_C百科ed to produce something similar to ptree in solaris for my assignment.
to do something like that i would need the child PID of the processes. i already have the list of processes running on the machine but the only information i have are the parent PID of each processes. is there any way to fetch the child PID of each process in the system?
the program will be ran on a solaris machine.
You said you already have the list of processes and their parents. To find the child PIDs of any process, simply loop over the processes looking for ones whose parent PID is the PID of the process you're investigating.
精彩评论