Regarding Process Ids

Post everything else here

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

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

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 prgmname.pl(perl 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

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


any idea please notify me

thanks&regards,
karthick
User avatar
Pills
Forum Admin
Posts: 312
Joined: Wed Jul 02, 2003 1:14 pm
Location: Long Island, NY
Contact:

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

And this has what to do with IRC?

Moved to off-topic.
admin, irc.umich.edu
oper, irc.servercentral.net
Nico
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