| Server IP : 134.236.49.22 / Your IP : 216.73.216.114 Web Server : Apache/2.2.15 (Fedora) System : Linux km10.dyndns.org 2.6.31.5-127.fc12.i686.PAE #1 SMP Sat Nov 7 21:25:57 EST 2009 i686 User : apache ( 48) PHP Version : 5.3.3 Disable Function : NONE MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/libexec/webmin/proc/ |
Upload File : |
#!/usr/bin/perl
# index.cgi
# Display a list of all existing processes
require './proc-lib.pl';
&ui_print_header(undef, $text{'index_title'}, "", "tree", !$no_module_config, 1);
&index_links("tree");
print &ui_columns_start([ $text{'pid'},
$text{'owner'},
$info_arg_map{'_stime'} ? ( $text{'stime'} ) : ( ),
$text{'command'} ], 100);
@procs = sort { $a->{'pid'} <=> $b->{'pid'} } &list_processes();
foreach $pr (@procs) {
$p = $pr->{'pid'}; $pp = $pr->{'ppid'};
$argmap{$p} = $pr->{'args'};
$usermap{$p} = $pr->{'user'};
$stimemap{$p} = $pr->{'_stime'};
push(@{$children{$pp}}, $p);
$inlist{$pr->{'pid'}}++;
}
foreach $pr (@procs) {
push(@roots, $pr->{'pid'}) if (!$inlist{$pr->{'ppid'}} ||
$pr->{'pid'} == $pr->{'ppid'} ||
$pr->{'pid'} == 0);
}
foreach $r (&unique(@roots)) {
&walk_procs("", $r);
}
print &ui_columns_end();
&ui_print_footer("/", $text{'index'});
# walk_procs(indent, pid)
sub walk_procs
{
next if ($done_proc{$_[1]}++);
local(@ch, $_, $args);
if (&can_view_process($usermap{$_[1]})) {
local @cols;
if (&can_edit_process($usermap{$_[1]})) {
push(@cols, "$_[0]<a href=\"edit_proc.cgi?$_[1]\">$_[1]</a>");
}
else {
push(@cols, "$_[0]$_[1]");
}
push(@cols, $usermap{$_[1]});
if ($info_arg_map{'_stime'}) {
push(@cols, $stimemap{$_[1]});
}
$args = &cut_string($argmap{$_[1]});
push(@cols, &html_escape($args));
print &ui_columns_row(\@cols);
}
foreach (@{$children{$_[1]}}) {
&walk_procs("$_[0] ", $_);
}
}