Regarding Process Ids

Post everything else here

Moderators: Website/Forum Admins, Other/Off Topic Moderators

Posts: 1
Joined: Sun Oct 23, 2005 6:08 am
Location: hyderabad

Regarding Process Ids

Postby karthick » Sun Oct 23, 2005 6:40 am

Hi all ,
I need to write an utility prgm in perl which should work like this

perl 3(level) PID program)

If the level and PID are given then the prgm might display the child and grandchild pid's upto the given level.

the output should look like

| |
child1PID child2 PID
-------------------------------------- ----------------------
| | | | |
PID ........... child 2's child
the Id needs to be fetched upto the given levels

any idea please notify me

User avatar
Forum Admin
Posts: 312
Joined: Wed Jul 02, 2003 1:14 pm
Location: Long Island, NY

Postby Pills » Sun Oct 23, 2005 2:52 pm

And this has what to do with IRC?

Moved to off-topic.
Posts: 8
Joined: Sun Sep 05, 2004 11:12 am
Location: France

Postby Nico » Sun Oct 23, 2005 9:27 pm

Since your program will mess with process ids, your code will most probably be platform dependant.

If your target platform is Win32, then you should have a look to Win32::Process::Info and its Subprocesses method.

If it's Linux, *BSD or *nix, you might find Proc::ProcessTable and Proc::ProcessTable::Process interesting. These module allow you to retrieve a list of the current processes and to get details about any of them (like the ppid). I think you can manage to do what you want by looping in the list, checking if the parent pid matches.

Who is online

Users browsing this forum: No registered users and 2 guests