I know that this can be done in bash by: pstree parent-pid
. But how can I do this in C
? Is there any method that doesn't have to iterating the whole /proc file system (e.g. system call/library function)?
相关问题
- Multiple sockets for clients to connect to
- Is shmid returned by shmget() unique across proces
- What is the best way to do a search in a large fil
- glDrawElements only draws half a quad
- how to get running process information in java?
you can use
popen
to read the output of the commandps -ef
,then look for the all the child process of a specifiedPID