in reply to Find children of process (unix/linux)

Consider Proc::ProcessTable. You may want to look into porting that to any unsupported OS ...

use strict; use Proc::ProcessTable; my $tgt = shift || $$; my %cmd; my %children; my $pt = new Proc::ProcessTable or die("No process table "); sub treeprint { my ($pid, $indent) = @_; print ' ' x $indent,"$pid: $cmd{$pid}\n"; # What the heck ... let's recurse to the end of the tree foreach (@{$children{$pid}}) { &treeprint($_, $indent+1); } } foreach my $proc ( @{$pt->table} ) { push @{$children{$proc->ppid}}, $proc->pid; $cmd{$proc->pid} = $proc->cmndline; } &treeprint($tgt,0);

The intelligent reader will judge for himself. Without examining the facts fully and fairly, there is no way of knowing whether vox populi is really vox dei, or merely vox asinorum. -- Cyrus H. Gordon