On Tue, May 30, 2006 at 05:20:51PM +0530, Gopala Krishna wrote: > > > Fortunately, here comes the proc filesystem ! > So, you have the pid of the father process : look at the file > /proc/'ppid'/status there should be a fild ppid : you have the pid of > your grand parent. > You can do a recursive function to find all the ancestors of your > process. > This solution is quite annoying since you have to handle files, but > it > works. > > If this solution is not acceptable for you, you can look at the > pstree > source code. > > I don't know if you wanted to do that in your own programm or just > wanted some soft to give you the entire tree (like pstree). Anyway... > : > > > In My case, I knew only pid of the first process. I want the top down approach > rather than the bottom up (i.e if I know child, I know parent. but, my > requirement is to find out child and it's grand children, If I know the parent > pid). Currently I am going through pstree code. > > Thanks and regards, > Gopal. I've understood :) In fact, pstree uses the solution I described earlier : walking throught the proc file system. -- tyler tyler@xxxxxxxx ___________________________________________________________________________ Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son interface révolutionnaire. http://fr.mail.yahoo.com -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/