Jason Yeo
Jason Yeo

Reputation: 3702

finding children processes of a particular process (UNIX)

i am required 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.

Upvotes: 1

Views: 355

Answers (1)

Gabe
Gabe

Reputation: 86768

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.

Upvotes: 5

Related Questions