On Tue, 2006-05-30 at 17:20 +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. > > Hi all, I think there is another way.* You can get hold of your current, use its list to get hold of the process structure and the up you go using the process->parent.... It may not be the correct way, but I suppose surely it is one way of doing it*. * As I am reading LDD, I only see things as modules regards Taha -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/