Skip to content
Advertisement

How to extract process hierarchy information in linux? [closed]

I want to write a program in Linux which by getting a session id could print all processes and process groups in that session in a tree view structure!?

How can I extract such information!? Should I resort to proc file system?

Advertisement

Answer

Most (all?) Linux programs read /proc to know about running processes.

If you are using Perl, then may be Proc::ProcessTable cpan module may save you some work.

Edit: Since you are using C, then you can look at pstree source code to get inspiration.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement