Re: [LIP] How to get the parent PID.

[email protected]
Newsgroups gmane.user-groups.linux.india.programmers
Message-ID <[email protected]>
Logu posted in linux-india-programmers:
> Given a PID, how to get the parent PID of it. Is there any library/system 
> call available for this.

getppid() returns the parent PID of the current process.

You can also check PPID in the process's environment.

Both the above will work only for the current process. If you want to
find the PPID of another process, the Linux-specific way is to look at
the fourth word in /proc/PID/environ.

Binand

-- 
Hanlon's Razor: Never attribute to malice that which can be adequately
explained by stupidity.
Bruce's Razor: Never attribute to stupidity that which can be adequately
explained by Microsoft funding.


-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.
Get your fingers limbered up and give it your best shot. 4 great events, 4
opportunities to win big! Highest score wins.NEC IT Guy Games. Play to
win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.