[Mono-list] Getting parent process

Mariano Benedettini mbenedettini at ad-net.us
Thu Jan 26 12:34:49 EST 2006

Jonathan Pryor wrote:
> On Wed, 2006-01-25 at 11:03 -0300, Mariano Benedettini wrote:
>>How can I build a process tree ?
>>Say, starting from the current process id, get the parent of it and 
>>With Mono.Unix.Process.GetCurrentProcessId() and 
>>Mono.Unix.UnixEnvironment.GetParentProcessId() I can get the current 
>>process and its parent, but cant go further :-(
> The short answer is that you don't, at least not while sticking strictly
> to POSIX.  I don't know why, but that information is not exposed.
> This doesn't mean it's not possible, it just means it's not in POSIX
> (and thus not portable).  pstree(1) reads the Linux /proc file system to
> build the process tree; see:
> http://cvs.sourceforge.net/viewcvs.py/psmisc/psmisc/src/pstree.c?rev=1.32&view=markup
>  - Jon

Thanks for the tip, I was almost sure that looking in /proc was the only 
way (now I'm totally sure).
I don't care about portability so I'll gonna make it that way.


Mariano Benedettini
Ad Network SA
mbenedettini at ad-net.us

More information about the Mono-list mailing list