Linux-Info
view release on metacpan or search on metacpan
lib/Linux/Info/Processes.pm view on Meta::CPAN
sub _get_owner {
my ( $self, $pid ) = @_;
my $file = $self->{files};
my $owner = "N/a";
open my $fh, '<', "$file->{path}/$pid/$file->{status}"
or return;
while ( my $line = <$fh> ) {
if ( $line =~ /^Uid:(?:\s+|\t+)(\d+)/ ) {
$owner = getpwuid($1) || "N/a";
last;
}
}
close($fh);
return $owner;
}
sub _get_cmdline {
my ( $self, $pid ) = @_;
lib/Linux/Info/Processes.pm view on Meta::CPAN
my $lxs = Linux::Info::Processes->new;
# or Linux::Info::Processes->new(pids => \@pids)
$lxs->init;
sleep 1;
my $stat = $lxs->get;
=head1 PROCESS STATISTICS
Generated by F</proc/E<lt>pidE<gt>/stat>, F</proc/E<lt>pidE<gt>/status>,
F</proc/E<lt>pidE<gt>/cmdline> and F<getpwuid()>.
Note that if F</etc/passwd> isn't readable, the key owner is set to F<N/a>.
ppid - The parent process ID of the process.
nlwp - The number of light weight processes that runs by this process.
owner - The owner name of the process.
pgrp - The group ID of the process.
state - The status of the process.
session - The session ID of the process.
ttynr - The tty the process use.
lib/Linux/Info/Processes.pm view on Meta::CPAN
=head1 SEE ALSO
=over
=item *
B<proc(5)>
=item *
B<perldoc -f getpwuid>
=item *
L<Linux::Info>
=back
=head1 AUTHOR
Alceu Rodrigues de Freitas Junior <glasswalk3r@yahoo.com.br>
( run in 0.236 second using v1.01-cache-2.11-cpan-8d75d55dd25 )