| 1 | package Class::Usul::IPC; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 17 | ▶ | use namespace::autoclean; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 17 | ▶ | use Class::Null; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 17 | ▶ | use Class::Usul::Constants qw( EXCEPTION_CLASS FALSE NUL OK SPC TRUE ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 17 | ▶ | use Class::Usul::Functions qw( arg_list get_user io loginid | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 17 | merge_attributes throw ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 17 | ▶ | use Class::Usul::IPC::Cmd; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 17 | ▶ | use Class::Usul::Time qw( time2str ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 17 | ▶ | use Class::Usul::Types qw( Bool ConfigProvider Logger ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 17 | ▶ | use English qw( -no_match_vars ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 17 | ▶ | use Module::Load::Conditional qw( can_load ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 17 | ▶ | use Unexpected::Functions qw( Unspecified ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 17 | ▶ | use Moo; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | # Public attributes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 17 | has 'cache_ttys' => is => 'ro', isa => Bool, default => TRUE; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 17 | has 'config' => is => 'ro', isa => ConfigProvider, required => TRUE; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 17 | has 'log' => is => 'ro', isa => Logger, required => TRUE; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | # Private functions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 0 | ▶ | my $_cmd_matches = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 0 | my ($cmd, $pattern) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 0 | ▶ | return !$pattern || $cmd =~ m{ $pattern }msx ? TRUE : FALSE; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $pattern or $cmd =~ / $pattern /msx
MC/DC0%0/2
not $pattern or $cmd =~ / $pattern /msx
not $pattern
$cmd =~ / $pattern /msx
Truth table0%0/3
not(A) or B
A= not $patternB= $cmd =~ / $pattern /msx
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 17 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 0 | ▶ | my $_new_proc_process_table = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 0 | my $cache_ttys = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | ▶ | can_load( modules => { 'Proc::ProcessTable' => '0' } ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | and return Proc::ProcessTable->new( cache_ttys => $cache_ttys ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | return Class::Null->new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 17 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | ▶ | my $_proc_belongs_to_user = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | my ($puid, $user) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | ▶ | return (!$user || $user eq 'All' || $user eq loginid $puid) ? TRUE : FALSE; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
not $user or $user eq "All" or $user eq &loginid($puid)
not $user or $user eq "All"
MC/DC0%0/3
not $user or $user eq "All" or $user eq &loginid($puid)
not $user
$user eq "All"
$user eq &loginid($puid)
Truth table0%0/4
not(A) or B or C
A= not $userB= $user eq "All"C= $user eq &loginid($puid)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 17 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | ▶ | my $_pscomp = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | my ($arg1, $arg2) = @_; my $result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | $result = $arg1->{uid} cmp $arg2->{uid}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | ▶ | $result = $arg1->{pid} <=> $arg2->{pid} if ($result == 0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | return $result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 17 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | ▶ | my $_set_fields = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=23 SCAR=63.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | my ($has, $p) = @_; my $flds = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | ▶ | $flds->{id } = $has->{pid } ? $p->pid : NUL; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | ▶ | $flds->{pid } = $has->{pid } ? $p->pid : NUL; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | ▶ | $flds->{ppid } = $has->{ppid } ? $p->ppid : NUL; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | ▶ | $flds->{start} = $has->{start } ? time2str( '%d/%m %H:%M', $p->start ) : NUL; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | ▶ | $flds->{state} = $has->{state } ? $p->state : NUL; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | ▶ | $flds->{tty } = $has->{ttydev} ? $p->ttydev : NUL; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | ▶ | $flds->{time } = $has->{time } ? int $p->time / 1_000_000 : NUL; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | ▶ | $flds->{uid } = $has->{uid } ? getpwuid $p->uid : NUL; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | ▶ | if ($has->{ttydev} and $p->ttydev) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
$has->{"ttydev"} and $p->ttydev
MC/DC0%0/2
$has->{"ttydev"} and $p->ttydev
$has->{"ttydev"}
$p->ttydev
Truth table0%0/3
A and B
A= $has->{"ttydev"}B= $p->ttydev
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | $flds->{tty} = $p->ttydev; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | ▶ | elsif ($has->{ttynum} and $p->ttynum) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$has->{"ttynum"} and $p->ttynum
MC/DC0%0/2
$has->{"ttynum"} and $p->ttynum
$has->{"ttynum"}
$p->ttynum
Truth table0%0/3
A and B
A= $has->{"ttynum"}B= $p->ttynum
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | $flds->{tty} = $p->ttynum; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | else { $flds->{tty} = NUL } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | ▶ | if ($has->{rss} and $p->rss) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
$has->{"rss"} and $p->rss
MC/DC0%0/2
$has->{"rss"} and $p->rss
$has->{"rss"}
$p->rss
Truth table0%0/3
A and B
A= $has->{"rss"}B= $p->rss
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | $flds->{size} = int $p->rss/1_024; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | ▶ | elsif ($has->{size} and $p->size) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$has->{"size"} and $p->size
MC/DC0%0/2
$has->{"size"} and $p->size
$has->{"size"}
$p->size
Truth table0%0/3
A and B
A= $has->{"size"}B= $p->size
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | $flds->{size} = int $p->size/1_024; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | else { $flds->{size} = NUL } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | ▶ | if ($has->{exec} and $p->exec) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition0%0/3
$has->{"exec"} and $p->exec
MC/DC0%0/2
$has->{"exec"} and $p->exec
$has->{"exec"}
$p->exec
Truth table0%0/3
A and B
A= $has->{"exec"}B= $p->exec
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | $flds->{cmd} = substr $p->exec, 0, 64; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | ▶ | elsif ($has->{cmndline} and $p->cmndline) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$has->{"cmndline"} and $p->cmndline
MC/DC0%0/2
$has->{"cmndline"} and $p->cmndline
$has->{"cmndline"}
$p->cmndline
Truth table0%0/3
A and B
A= $has->{"cmndline"}B= $p->cmndline
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | $flds->{cmd} = substr $p->cmndline, 0, 64; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | ▶ | elsif ($has->{fname} and $p->fname) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$has->{"fname"} and $p->fname
MC/DC0%0/2
$has->{"fname"} and $p->fname
$has->{"fname"}
$p->fname
Truth table0%0/3
A and B
A= $has->{"fname"}B= $p->fname
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | $flds->{cmd} = substr $p->fname, 0, 64; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | else { $flds->{cmd} = NUL } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | return $flds; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 17 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | ▶ | my $_signal_cmd = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | my ($cmd, $flag, $sig, $pids) = @_; my $opts = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | ▶ | $sig and push @{ $opts }, '-o', "sig=${sig}"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | ▶ | $flag and push @{ $opts }, '-o', 'flag=one'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | ▶ | return [ $cmd, '-nc', 'signal_process', @{ $opts }, '--', @{ $pids || [] } ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$pids || []
MC/DC0%0/1
$pids || []
$pids
Truth table0%0/2
A
A= $pids
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 17 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | # Construction | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 13 | ▶ | around 'BUILDARGS' => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 13 | my ($orig, $self, @args) = @_; my $attr = $orig->( $self, @args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 13 | ▶ | my $builder = $attr->{builder} or return $attr; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 13 | merge_attributes $attr, $builder, [ 'config', 'log' ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 13 | return $attr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 17 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | ▶ | my $_new_process_table = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | my ($self, $rows, $count) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | return { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | count => $count, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | fields => [ qw( uid pid ppid start time size state tty cmd ) ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | labels => { uid => 'User', pid => 'PID', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | ppid => 'PPID', start => 'Start Time', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | tty => 'TTY', time => 'Time', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | size => 'Size', state => 'State', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | cmd => 'Command' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | typelist => { pid => 'numeric', ppid => 'numeric', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | start => 'date', size => 'numeric', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | time => 'numeric' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | values => $rows, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | wrap => { cmd => 1 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 17 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | # Public methods | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | ▶ | sub child_list { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
child_list: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | my ($self, $pid, $procs) = @_; my ($child, $ppt); my @pids = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | ▶ | unless (defined $procs) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | $ppt = $_new_proc_process_table->( $self->cache_ttys ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | $procs = { map { $_->pid => $_->ppid } @{ $ppt->table } }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | ▶ | if (exists $procs->{ $pid }) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | for $child (grep { $procs->{ $_ } == $pid } keys %{ $procs }) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | push @pids, $self->child_list( $child, $procs ); # Recurse | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | push @pids, $pid; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | return sort { $a <=> $b } @pids; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | ▶ | sub list_pids_by_file_system { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
list_pids_by_file_system: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | ▶ | my ($self, $fsystem) = @_; $fsystem or return (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | my $opts = { err => 'null', expected_rv => 1 }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | # TODO: Make fuser OS dependent | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | ▶ | my $data = $self->run_cmd( "fuser ${fsystem}", $opts )->out || NUL; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->run_cmd("fuser $fsystem", $opts)->out || ''
MC/DC0%0/1
$self->run_cmd("fuser $fsystem", $opts)->out || ''
$self->run_cmd("fuser $fsystem", $opts)->out
Truth table0%0/2
A
A= $self->run_cmd("fuser $fsystem", $opts)->out
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | $data =~ s{ [^0-9\s] }{}gmx; $data =~ s{ \s+ }{ }gmx; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | ▶ | return sort { $a <=> $b } grep { defined && length } split SPC, $data; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
defined $_ && length $_
MC/DC0%0/2
defined $_ && length $_
defined $_
length $_
Truth table0%0/3
A && B
A= defined $_B= length $_
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 91 | ▶ | sub popen { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
popen: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 91 | return shift->run_cmd( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | ▶ | sub process_exists { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
process_exists: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | my ($self, @args) = @_; my $args = arg_list @args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | my $pid = $args->{pid}; my ($io, $file); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | ▶ | $file = $args->{file} and $io = io( $file ) and $io->is_file | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$file = $args->{"file"} and $io = &io($file) and $io->is_file
$file = $args->{"file"} and $io = &io($file)
MC/DC0%0/3
$file = $args->{"file"} and $io = &io($file) and $io->is_file
$file = $args->{"file"}
$io = &io($file)
$io->is_file
Truth table0%0/4
A and B and C
A= $file = $args->{"file"}B= $io = &io($file)C= $io->is_file
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | and $pid = $io->chomp->lock->getline; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | ▶ | (not $pid or $pid !~ m{ \d+ }mx) and return FALSE; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$pid and $pid =~ / \d+ /mx
MC/DC0%0/2
$pid and $pid =~ / \d+ /mx
$pid
$pid =~ / \d+ /mx
Truth table0%0/3
A and B
A= $pidB= $pid =~ / \d+ /mx
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | ▶ | return (CORE::kill 0, $pid) ? TRUE : FALSE; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | ▶ | sub process_table { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
process_table: not called CC=10 SCAR=47.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | my ($self, @args) = @_; my $args = arg_list @args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | my $pat = $args->{pattern}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | ▶ | my $ptype = $args->{type } // 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$args->{"type"} // 1
MC/DC0%0/1
$args->{"type"} // 1
$args->{"type"}
Truth table0%0/2
A
A= $args->{"type"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | ▶ | my $user = $args->{user } // get_user->name; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$args->{"user"} // &get_user()->name
MC/DC0%0/2
$args->{"user"} // &get_user()->name
$args->{"user"}
&get_user()->name
Truth table0%0/3
A // B
A= $args->{"user"}B= &get_user()->name
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | my $ppt = $_new_proc_process_table->( $self->cache_ttys ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | my $has = { map { $_ => TRUE } $ppt->fields }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | my @rows = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | my $count = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | ▶ | if ($ptype == 3) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | my %procs = map { $_->pid => $_ } @{ $ppt->table }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | my @pids = $self->list_pids_by_file_system( $args->{fsystem} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | for my $p (grep { defined } map { $procs{ $_ } } @pids) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | push @rows, $_set_fields->( $has, $p ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | $count++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | for my $p (@{ $ppt->table }) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | ▶ | if ( ($ptype == 1 and $_proc_belongs_to_user->( $p->uid, $user )) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
$ptype == 1 and &$_proc_belongs_to_user($p->uid, $user) or $ptype == 2 and &$_cmd_matches($p->cmndline, $pat)
$ptype == 1 and &$_proc_belongs_to_user($p->uid, $user)
$ptype == 2 and &$_cmd_matches($p->cmndline, $pat)
MC/DC0%0/4
$ptype == 1 and &$_proc_belongs_to_user($p->uid, $user) or $ptype == 2 and &$_cmd_matches($p->cmndline, $pat)
$ptype == 1
&$_proc_belongs_to_user($p->uid, $user)
$ptype == 2
&$_cmd_matches($p->cmndline, $pat)
Truth table0%0/7
A and B or C and D
A= $ptype == 1B= &$_proc_belongs_to_user($p->uid, $user)C= $ptype == 2D= &$_cmd_matches($p->cmndline, $pat)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | or ($ptype == 2 and $_cmd_matches->( $p->cmndline, $pat ))) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | push @rows, $_set_fields->( $has, $p ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | $count++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | return $self->$_new_process_table | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | ( [ sort { $_pscomp->( $a, $b ) } @rows ], $count ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 356 | ▶ | sub run_cmd { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
run_cmd: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 356 | my ($self, $cmd, @args) = @_; my $attr = arg_list @args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 356 | ▶ | $attr->{cmd } = $cmd or throw Unspecified, [ 'command' ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 356 | $attr->{log } = $self->log; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 356 | $attr->{rundir } = $self->config->rundir; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 356 | $attr->{tempdir} = $self->config->tempdir; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 356 | return Class::Usul::IPC::Cmd->new( $attr )->run_cmd; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | ▶ | sub signal_process { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
signal_process: not called CC=17 SCAR=57.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | my ($self, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 0 | ▶ | is_hashref $args[ 0 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | or return $self->run_cmd( $_signal_cmd->( $self->config->suid, @args ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | my ($file, $io); my $args = $args[ 0 ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 0 | ▶ | my $sig = $args->{sig} // 'TERM'; my $pids = $args->{pids} // []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/4
$args->{"sig"} // "TERM"
$args->{"pids"} // []
MC/DC0%0/1
$args->{"sig"} // "TERM"
$args->{"sig"}
MC/DC0%0/1
$args->{"pids"} // []
$args->{"pids"}
Truth table0%0/2
A
A= $args->{"sig"}
Truth table0%0/2
A
A= $args->{"pids"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | ▶ | $args->{pid} and push @{ $pids }, $args->{pid}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 0 | ▶ | if ($file = $args->{file} and $io = io( $file ) and $io->is_file) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$file = $args->{"file"} and $io = &io($file) and $io->is_file
$file = $args->{"file"} and $io = &io($file)
MC/DC0%0/3
$file = $args->{"file"} and $io = &io($file) and $io->is_file
$file = $args->{"file"}
$io = &io($file)
$io->is_file
Truth table0%0/4
A and B and C
A= $file = $args->{"file"}B= $io = &io($file)C= $io->is_file
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 0 | push @{ $pids }, $io->chomp->lock->getlines; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | ▶ | $sig eq 'TERM' and unlink $file; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | ▶ | (defined $pids->[0] and $pids->[0] =~ m{ \d+ }mx) or throw 'Process id bad'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $pids->[0] and $pids->[0] =~ / \d+ /mx
MC/DC0%0/2
defined $pids->[0] and $pids->[0] =~ / \d+ /mx
defined $pids->[0]
$pids->[0] =~ / \d+ /mx
Truth table0%0/3
A and B
A= defined $pids->[0]B= $pids->[0] =~ / \d+ /mx
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | for my $mpid (@{ $pids }) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | ▶ | if (exists $args->{flag} and $args->{flag} =~ m{ one }imx) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $args->{"flag"} and $args->{"flag"} =~ / one /mix
MC/DC0%0/2
exists $args->{"flag"} and $args->{"flag"} =~ / one /mix
exists $args->{"flag"}
$args->{"flag"} =~ / one /mix
Truth table0%0/3
A and B
A= exists $args->{"flag"}B= $args->{"flag"} =~ / one /mix
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | CORE::kill $sig, $mpid; next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 0 | my @pids = reverse $self->child_list( $mpid ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | CORE::kill $sig, $_ for (@pids); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 0 | ▶ | $args->{force} or next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 0 | sleep 3; @pids = reverse $self->child_list( $mpid ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 0 | CORE::kill 'KILL', $_ for (@pids); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | return OK; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 0 | ▶ | sub signal_process_as_root { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
signal_process_as_root: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | my ($self, @args) = @_; return $self->signal_process( arg_list @args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 17 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||