get process name from process id

P

perlcoder

I need to know the name of the parent process.
using getppid function I can get the process id
of the parent process. How do I translate parent
pid to a name.

Is there a way to do it in in perl without invoking ps command.


thanks.
 
J

Joost Diepenmaat

perlcoder said:
I need to know the name of the parent process.
using getppid function I can get the process id
of the parent process. How do I translate parent
pid to a name.

Is there a way to do it in in perl without invoking ps command.

From what I've been able to find in a few minutes of searching, you
can't do this portably on unix. using the output of `ps` may very well
be the "best" way to go about it, since ps is at least part of POSIX.
 
T

Ted Zlatanov

p> I need to know the name of the parent process.
p> using getppid function I can get the process id
p> of the parent process. How do I translate parent
p> pid to a name.

p> Is there a way to do it in in perl without invoking ps command.

Get Proc::processTable from CPAN.

Ted
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,123
Latest member
Layne6498
Top