in reply to Re: Function to get a child pid
in thread Function to get a child pid

fork is not accepting arguments. This will help me when I call this function recursively to find all the child pid.So can you explain me how to pass pid as argument to fork

Replies are listed 'Best First'.
Re^3: Function to get a child pid
by blazar (Canon) on Oct 21, 2005 at 13:45 UTC

    Maybe I wasn't clear, and I apologize for that... I wasn't suggesting fork as a function "to get a child pid of a process running, by just passing only the parent process pid". Because I can hardly make sense of such a request.

    Said this, maybe you just want to get a list of all the childs of a given (parent) process. If so, then you may use Proc::ProcessTable to search amongst all processes those that are childs of the given parent. You will be particularly interested in Proc::ProcessTable::Process's ppid() method.

    To put all this together is left as an exercise to the reader.