get process name from process id

  • Follow


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.

0
Reply perlcoder 7/17/2008 5:18:49 PM

perlcoder <a@a.com> writes:

> 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.

-- 
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/
0
Reply Joost 7/17/2008 5:31:43 PM


On 17 Jul 2008 10:18:49 -0700 perlcoder <a@a.com> wrote: 

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
0
Reply Ted 7/17/2008 5:33:06 PM

2 Replies
268 Views

(page loaded in 0.24 seconds)

Similiar Articles:













7/18/2012 12:47:42 AM


Reply: