| 1 | package ControlFreak::Proxy::Process; | ||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||
| 3 | 5 | ▶ | use strict; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 4 | 5 | ▶ | use warnings; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||
| 6 | 5 | ▶ | use JSON::XS; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 7 | 5 | ▶ | use Try::Tiny; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 8 | 5 | ▶ | use POSIX 'SIGTERM'; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 9 | 5 | ▶ | use IO::Select; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||
| 11 | 5 | $SIG{PIPE} = 'IGNORE'; | |||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||
| 13 | =head1 NAME | ||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||
| 15 | ControlFreak::Proxy::Process - The Perl implementation of a proxy process. | ||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||
| 17 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||
| 19 | This class is used by L<cfk-share-mem-proxy.pl> to implement the controlling | ||||||||||||||||||||||||||||||||
| 20 | process of proxied services. | ||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||
| 22 | =cut | ||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||
| 24 | 5 | ▶ | sub new { | ||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 25 | 5 | my $class = shift; | |||||||||||||||||||||||||||||||
| 26 | 5 | my %param = @_; | |||||||||||||||||||||||||||||||
| 27 | 5 | ▶ | my $proxy = bless { %param }, ref $class || $class; | ||||||||||||||||||||||||||||||
|
Condition33%1/3
ref $class || $class
MC/DC0%0/2
ref $class || $class
ref $class
$class
Truth table33%1/3
A || B
A= ref $classB= $class
| |||||||||||||||||||||||||||||||||
| 28 | 5 | $proxy->init; | |||||||||||||||||||||||||||||||
| 29 | 5 | return $proxy; | |||||||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||
| 32 | 18 | ▶ | sub log { | ||||||||||||||||||||||||||||||
|
Subroutine
log: called CC=2 SCAR=7.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 33 | 18 | my $proxy = shift; | |||||||||||||||||||||||||||||||
| 34 | 18 | my ($type, $msg) = @_; | |||||||||||||||||||||||||||||||
| 35 | 18 | ▶ | my $pipe = $proxy->{log_hdl} or return; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 36 | 0 | $proxy->write_log("$type:-:$msg"); | |||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||
| 39 | 12 | ▶ | sub write_log { | ||||||||||||||||||||||||||||||
|
Subroutine
write_log: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 40 | 12 | my $proxy = shift; | |||||||||||||||||||||||||||||||
| 41 | 12 | my $fh = $proxy->{log_fh}; | |||||||||||||||||||||||||||||||
| 42 | 12 | ▶ | return unless $fh; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 43 | ## check buffer size XXX | ||||||||||||||||||||||||||||||||
| 44 | 12 | push @{ $proxy->{log_buffer} }, shift; | |||||||||||||||||||||||||||||||
| 45 | 12 | $proxy->{write_select}->add($fh); | |||||||||||||||||||||||||||||||
| 46 | 12 | return; | |||||||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||
| 49 | 5 | ▶ | sub init { | ||||||||||||||||||||||||||||||
|
Subroutine
init: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 50 | 5 | my $proxy = shift; | |||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||
| 52 | #set_nonblocking($proxy->{$_}) for (qw/command_fh status_fh log_fh/); | ||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||
| 54 | ## where we buffer the writes until our wout fh are ready | ||||||||||||||||||||||||||||||||
| 55 | 5 | $proxy->{log_buffer} = []; | |||||||||||||||||||||||||||||||
| 56 | 5 | $proxy->{status_buffer} = []; | |||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||
| 58 | ## callbacks | ||||||||||||||||||||||||||||||||
| 59 | 5 | ▶ | $proxy->{readers}{ $proxy->{command_fh} } = sub { $proxy->command_cb(@_) }; | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 60 | $proxy->{writers}{ $proxy->{log_fh} } = $proxy->{log_buffer} | ||||||||||||||||||||||||||||||||
| 61 | 5 | ▶ | if $proxy->{log_fh}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 62 | 5 | $proxy->{writers}{ $proxy->{status_fh} } = $proxy->{status_buffer}; | |||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||
| 64 | 5 | my $fh = $proxy->{command_fh}; | |||||||||||||||||||||||||||||||
| 65 | 5 | $proxy->{read_select} = IO::Select->new; | |||||||||||||||||||||||||||||||
| 66 | 5 | $proxy->{write_select} = IO::Select->new; | |||||||||||||||||||||||||||||||
| 67 | 5 | $proxy->{read_select}->add($proxy->{command_fh}); | |||||||||||||||||||||||||||||||
| 68 | $proxy->{write_select}->add($proxy->{log_fh}) | ||||||||||||||||||||||||||||||||
| 69 | 5 | ▶ | if $proxy->{log_fh}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 70 | 5 | $proxy->{write_select}->add($proxy->{status_fh}); | |||||||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||
| 73 | 11 | ▶ | sub command_cb { | ||||||||||||||||||||||||||||||
|
Subroutine
command_cb: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 74 | 11 | my $proxy = shift; | |||||||||||||||||||||||||||||||
| 75 | 11 | my $command = shift; | |||||||||||||||||||||||||||||||
| 76 | 11 | chomp $command; | |||||||||||||||||||||||||||||||
| 77 | 11 | $proxy->process_command($_) for (split /\n/, $$command); | |||||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||
| 80 | 11 | ▶ | sub process_command { | ||||||||||||||||||||||||||||||
|
Subroutine
process_command: called CC=5 SCAR=17.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 81 | 11 | my $proxy = shift; | |||||||||||||||||||||||||||||||
| 82 | 11 | my $command = shift; | |||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||
| 84 | 11 | ▶ | my $param = try { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 85 | 11 | decode_json($command) | |||||||||||||||||||||||||||||||
| 86 | 0 | ▶ | } catch { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 87 | 0 | $proxy->log('err', "parse error in command $command: $_"); | |||||||||||||||||||||||||||||||
| 88 | 0 | return; | |||||||||||||||||||||||||||||||
| 89 | 11 | }; | |||||||||||||||||||||||||||||||
| 90 | 11 | my $c = $param->{command}; | |||||||||||||||||||||||||||||||
| 91 | 11 | ▶ | if ($c && $c eq 'start') { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
$c and $c eq "start"
MC/DC50%1/2
$c and $c eq "start"
$c
$c eq "start"
Truth table66%2/3
A and B
A= $cB= $c eq "start"
| |||||||||||||||||||||||||||||||||
| 92 | 10 | $proxy->start_service($param); | |||||||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||||||
| 94 | ▶ | elsif ($c && $c eq 'stop') { | |||||||||||||||||||||||||||||||
|
Condition33%1/3
$c and $c eq "stop"
MC/DC0%0/2
$c and $c eq "stop"
$c
$c eq "stop"
Truth table33%1/3
A and B
A= $cB= $c eq "stop"
| |||||||||||||||||||||||||||||||||
| 95 | 1 | $proxy->stop_service($param); | |||||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||||||
| 97 | else { | ||||||||||||||||||||||||||||||||
| 98 | 0 | $proxy->log('err', "couldn't understand command $command: $_"); | |||||||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||||||
| 100 | 8 | return; | |||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||
| 103 | 20 | ▶ | sub xfer_log { | ||||||||||||||||||||||||||||||
|
Subroutine
xfer_log: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 104 | 20 | my $proxy = shift; | |||||||||||||||||||||||||||||||
| 105 | 20 | my ($type, $svc) = @_; | |||||||||||||||||||||||||||||||
| 106 | 20 | ▶ | my $watcher_cb = sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=5 SCAR=16.3
| |||||||||||||||||||||||||||||||||
| 107 | 20 | my $msg = shift; | |||||||||||||||||||||||||||||||
| 108 | 20 | ▶ | return unless defined $msg; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 109 | 20 | ▶ | chomp $$msg if $$msg; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 110 | 20 | ▶ | my $name = $svc->{name} || ""; | ||||||||||||||||||||||||||||||
|
Condition50%1/2
$svc->{'name'} || ''
MC/DC0%0/1
$svc->{'name'} || ''
$svc->{'name'}
Truth table50%1/2
A
A= $svc->{'name'}
| |||||||||||||||||||||||||||||||||
| 111 | 20 | my @msgs = split /\n/, $$msg; | |||||||||||||||||||||||||||||||
| 112 | 20 | $proxy->write_log("$type:$name:$_") for @msgs; | |||||||||||||||||||||||||||||||
| 113 | 20 | return; | |||||||||||||||||||||||||||||||
| 114 | 20 | }; | |||||||||||||||||||||||||||||||
| 115 | 20 | return $watcher_cb; | |||||||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||
| 118 | 10 | ▶ | sub start_service { | ||||||||||||||||||||||||||||||
|
Subroutine
start_service: called CC=7 SCAR=22.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 119 | 10 | my $proxy = shift; | |||||||||||||||||||||||||||||||
| 120 | 10 | my $param = shift; | |||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||
| 122 | 10 | my $name = $param->{name}; | |||||||||||||||||||||||||||||||
| 123 | 10 | my $cmd = $param->{cmd}; | |||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||
| 125 | 10 | my $svc = {}; | |||||||||||||||||||||||||||||||
| 126 | 10 | $svc->{name} = $name; # intentional repeat | |||||||||||||||||||||||||||||||
| 127 | 10 | ▶ | $svc->{env} = $param->{env} || {}; | ||||||||||||||||||||||||||||||
|
Condition50%1/2
$param->{'env'} || {}
MC/DC0%0/1
$param->{'env'} || {}
$param->{'env'}
Truth table50%1/2
A
A= $param->{'env'}
| |||||||||||||||||||||||||||||||||
| 128 | 10 | $proxy->{services}{$name} = $svc; | |||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||
| 130 | 10 | $proxy->log('out', "starting $name"); | |||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||
| 132 | 10 | my %stds = (); | |||||||||||||||||||||||||||||||
| 133 | 10 | ▶ | if (my $sockname = $param->{tie_stdin_to}) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 134 | 0 | ▶ | if ( my $fd = $proxy->{sockets}{$sockname} ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 135 | 0 | ▶ | if (open $svc->{fh}, "<&=$fd") { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 136 | 0 | $stds{in} = $svc->{fh}; | |||||||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||||||
| 138 | else { | ||||||||||||||||||||||||||||||||
| 139 | 0 | $proxy->log('err', "couldn't open fd $fd: $!"); | |||||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||||||
| 142 | else { | ||||||||||||||||||||||||||||||||
| 143 | 0 | $proxy->log('err', "'$sockname' not found in proxy"); | |||||||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||||||
| 146 | 10 | ▶ | unless ($svc->{ignore_stdout}) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 147 | 10 | $stds{out} = $proxy->xfer_log(out => $svc); | |||||||||||||||||||||||||||||||
| 148 | } | ||||||||||||||||||||||||||||||||
| 149 | 10 | ▶ | unless ($svc->{ignore_stderr} ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 150 | 10 | $stds{err} = $proxy->xfer_log(err => $svc); | |||||||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||||||
| 152 | $proxy->fork_do_cmd( | ||||||||||||||||||||||||||||||||
| 153 | $cmd, | ||||||||||||||||||||||||||||||||
| 154 | '$$' => \$svc->{pid}, | ||||||||||||||||||||||||||||||||
| 155 | 3 | ▶ | on_prepare => sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 156 | 3 | $proxy->prepare_child($svc => $cmd); | |||||||||||||||||||||||||||||||
| 157 | }, | ||||||||||||||||||||||||||||||||
| 158 | 10 | %stds, | |||||||||||||||||||||||||||||||
| 159 | ); | ||||||||||||||||||||||||||||||||
| 160 | 7 | $proxy->send_status('started', $name, $svc->{pid}); | |||||||||||||||||||||||||||||||
| 161 | 7 | $proxy->verify_pid($svc); | |||||||||||||||||||||||||||||||
| 162 | } | ||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||
| 164 | 3 | ▶ | sub prepare_child { | ||||||||||||||||||||||||||||||
|
Subroutine
prepare_child: called CC=3 SCAR=11.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 165 | 3 | my $proxy = shift; | |||||||||||||||||||||||||||||||
| 166 | 3 | my $svc = shift; | |||||||||||||||||||||||||||||||
| 167 | 3 | my $cmd = shift; | |||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||
| 169 | $SIG{HUP} = $SIG{INT} = $SIG{TERM} | ||||||||||||||||||||||||||||||||
| 170 | = $SIG{__WARN__} = $SIG{__DIE__} | ||||||||||||||||||||||||||||||||
| 171 | 3 | = 'DEFAULT'; | |||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||
| 173 | 3 | my $name = $svc->{name}; | |||||||||||||||||||||||||||||||
| 174 | 3 | $0 = "[cfk $name] $cmd"; | |||||||||||||||||||||||||||||||
| 175 | 3 | ▶ | unless ($svc->{no_new_session}) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 176 | 3 | ▶ | my $sessid = POSIX::setsid() | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 177 | or print STDERR "cannot create a new session for proxied svc\n"; | ||||||||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||
| 180 | 3 | $proxy->setup_environment($svc); | |||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||
| 182 | 3 | return; | |||||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||
| 185 | 3 | ▶ | sub setup_environment { | ||||||||||||||||||||||||||||||
|
Subroutine
setup_environment: called CC=4 SCAR=14.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 186 | 3 | my $proxy = shift; | |||||||||||||||||||||||||||||||
| 187 | 3 | my $svc = shift; | |||||||||||||||||||||||||||||||
| 188 | 3 | my $env = $svc->{env}; | |||||||||||||||||||||||||||||||
| 189 | 3 | ▶ | return unless $env; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 190 | 3 | ▶ | return unless ref $env eq 'HASH'; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 191 | 3 | ▶ | while (my ($k, $v) = each %$env) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 192 | 0 | $ENV{$k} = $v; | |||||||||||||||||||||||||||||||
| 193 | } | ||||||||||||||||||||||||||||||||
| 194 | 3 | $ENV{CONTROL_FREAK_ENABLED} = 1; | |||||||||||||||||||||||||||||||
| 195 | 3 | $ENV{CONTROL_FREAK_SERVICE} = $svc->{name}; | |||||||||||||||||||||||||||||||
| 196 | 3 | return 1; | |||||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||
| 199 | 10 | ▶ | sub fork_do_cmd { | ||||||||||||||||||||||||||||||
|
Subroutine
fork_do_cmd: called CC=15 SCAR=29.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 200 | 10 | my $proxy = shift; | |||||||||||||||||||||||||||||||
| 201 | 10 | my $cmd = shift; | |||||||||||||||||||||||||||||||
| 202 | 10 | my %param = @_; | |||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||
| 204 | 10 | my %redir; | |||||||||||||||||||||||||||||||
| 205 | 10 | ▶ | if (my $in = $param{in}) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 206 | 0 | $redir{0} = $in; | |||||||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||||||
| 208 | 10 | ▶ | if (my $out = $param{out}) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 209 | 10 | my ($pr, $pw); | |||||||||||||||||||||||||||||||
| 210 | 10 | pipe ($pr, $pw); | |||||||||||||||||||||||||||||||
| 211 | 10 | $proxy->{readers}{$pr} = $out; | |||||||||||||||||||||||||||||||
| 212 | 10 | $proxy->{read_select}->add($pr); | |||||||||||||||||||||||||||||||
| 213 | 10 | $redir{1} = $pw; | |||||||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||||||
| 215 | 10 | ▶ | if (my $err = $param{err}) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 216 | 10 | my ($pr, $pw); | |||||||||||||||||||||||||||||||
| 217 | 10 | pipe ($pr, $pw); | |||||||||||||||||||||||||||||||
| 218 | 10 | $proxy->{readers}{$pr} = $err; | |||||||||||||||||||||||||||||||
| 219 | 10 | $proxy->{read_select}->add($pr); | |||||||||||||||||||||||||||||||
| 220 | 10 | $redir{2} = $pw; | |||||||||||||||||||||||||||||||
| 221 | } | ||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||
| 223 | 10 | my $pid = fork; | |||||||||||||||||||||||||||||||
| 224 | 10 | ▶ | if (! defined $pid) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 225 | 0 | $proxy->log('err', "couldn't fork! $!"); | |||||||||||||||||||||||||||||||
| 226 | 0 | exit -1; | |||||||||||||||||||||||||||||||
| 227 | } | ||||||||||||||||||||||||||||||||
| 228 | 10 | ▶ | unless ($pid) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 229 | ## do the redirection of stds if requested | ||||||||||||||||||||||||||||||||
| 230 | ## otherwise reopen to /dev/null | ||||||||||||||||||||||||||||||||
| 231 | 3 | my $null; | |||||||||||||||||||||||||||||||
| 232 | 3 | for (0, 1, 2) { | |||||||||||||||||||||||||||||||
| 233 | 9 | ▶ | if (exists $redir{$_}) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 234 | 6 | POSIX::close($_); | |||||||||||||||||||||||||||||||
| 235 | 6 | ▶ | unless (defined POSIX::dup2(fileno $redir{$_}, $_)) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 236 | 0 | POSIX::_exit(125); | |||||||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||||||
| 238 | 6 | POSIX::close($redir{$_}); | |||||||||||||||||||||||||||||||
| 239 | } | ||||||||||||||||||||||||||||||||
| 240 | else { | ||||||||||||||||||||||||||||||||
| 241 | 3 | ▶ | unless ($null) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 242 | 3 | ▶ | unless (open $null, "+>/dev/null") { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 243 | 0 | print STDERR "Error opening null: $!"; | |||||||||||||||||||||||||||||||
| 244 | 0 | POSIX::_exit(124); | |||||||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||||||
| 246 | } | ||||||||||||||||||||||||||||||||
| 247 | 3 | POSIX::close($_); | |||||||||||||||||||||||||||||||
| 248 | 3 | POSIX::dup2($null, $_); | |||||||||||||||||||||||||||||||
| 249 | } | ||||||||||||||||||||||||||||||||
| 250 | } | ||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||
| 252 | 3 | ▶ | if (exists $param{on_prepare}) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 253 | 3 | ▶ | eval { $param{on_prepare}->(); 1 } or POSIX::_exit(123) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 254 | } | ||||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||||
| 256 | 3 | my $ret = $proxy->run_command($cmd); | |||||||||||||||||||||||||||||||
| 257 | 3 | ▶ | unless (defined $ret) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 258 | 3 | print STDERR "Couldn't do '$cmd': $@"; | |||||||||||||||||||||||||||||||
| 259 | 3 | exit -1; | |||||||||||||||||||||||||||||||
| 260 | } | ||||||||||||||||||||||||||||||||
| 261 | 0 | print STDERR "My job is done"; | |||||||||||||||||||||||||||||||
| 262 | 0 | exit 0; | |||||||||||||||||||||||||||||||
| 263 | } | ||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||
| 265 | 7 | ${$param{'$$'}} = $pid | |||||||||||||||||||||||||||||||
| 266 | 7 | ▶ | if $param{'$$'}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||||||
| 268 | 7 | %redir = (); # close child side of the fds | |||||||||||||||||||||||||||||||
| 269 | 7 | return; | |||||||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||||
| 272 | 3 | ▶ | sub run_command { | ||||||||||||||||||||||||||||||
|
Subroutine
run_command: called CC=2 SCAR=7.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 273 | 3 | my $proxy = shift; | |||||||||||||||||||||||||||||||
| 274 | 3 | my $cmd = shift; | |||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||
| 276 | 3 | ▶ | if (my $code = $proxy->{svc_coderef}) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 277 | ## ignore command alltogether | ||||||||||||||||||||||||||||||||
| 278 | 0 | return $code->(); | |||||||||||||||||||||||||||||||
| 279 | } | ||||||||||||||||||||||||||||||||
| 280 | 3 | return do $cmd; | |||||||||||||||||||||||||||||||
| 281 | } | ||||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||
| 283 | 1 | ▶ | sub stop_service { | ||||||||||||||||||||||||||||||
|
Subroutine
stop_service: called CC=2 SCAR=7.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 284 | 1 | my $proxy = shift; | |||||||||||||||||||||||||||||||
| 285 | 1 | my $param = shift; | |||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||
| 287 | 1 | my $svcname = $param->{name}; | |||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||
| 289 | 1 | my $svc = $proxy->{services}{$svcname}; | |||||||||||||||||||||||||||||||
| 290 | 1 | ▶ | unless ($svc) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 291 | 0 | $proxy->log('err', "Oops, I don't know about '$svcname'"); | |||||||||||||||||||||||||||||||
| 292 | 0 | return; | |||||||||||||||||||||||||||||||
| 293 | } | ||||||||||||||||||||||||||||||||
| 294 | 1 | $proxy->_stop_service($svc); | |||||||||||||||||||||||||||||||
| 295 | } | ||||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||
| 297 | 1 | ▶ | sub _stop_service { | ||||||||||||||||||||||||||||||
|
Subroutine
_stop_service: called CC=2 SCAR=7.5
| |||||||||||||||||||||||||||||||||
| 298 | 1 | my $proxy = shift; | |||||||||||||||||||||||||||||||
| 299 | 1 | my $svc = shift; | |||||||||||||||||||||||||||||||
| 300 | 1 | my $pid = $svc->{pid}; | |||||||||||||||||||||||||||||||
| 301 | 1 | $proxy->log('out', "stopping $svc->{name}"); | |||||||||||||||||||||||||||||||
| 302 | 1 | ▶ | unless ($pid) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 303 | 0 | $proxy->log('err', "no pid for '$svc->{name}'"); | |||||||||||||||||||||||||||||||
| 304 | 0 | return; | |||||||||||||||||||||||||||||||
| 305 | } | ||||||||||||||||||||||||||||||||
| 306 | 1 | kill -(SIGTERM), getpgrp($pid); | |||||||||||||||||||||||||||||||
| 307 | } | ||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||
| 309 | 14 | ▶ | sub send_status { | ||||||||||||||||||||||||||||||
|
Subroutine
send_status: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 310 | 14 | my $proxy = shift; | |||||||||||||||||||||||||||||||
| 311 | 14 | my ($cmd, $name, $pid, $es) = @_; | |||||||||||||||||||||||||||||||
| 312 | my $fh = $proxy->{status_fh} | ||||||||||||||||||||||||||||||||
| 313 | 14 | ▶ | or return; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||||||
| 315 | 14 | my $string = encode_json({ | |||||||||||||||||||||||||||||||
| 316 | status => $cmd, | ||||||||||||||||||||||||||||||||
| 317 | name => $name, | ||||||||||||||||||||||||||||||||
| 318 | pid => $pid, | ||||||||||||||||||||||||||||||||
| 319 | exit_status => $es, | ||||||||||||||||||||||||||||||||
| 320 | }); | ||||||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||||||
| 322 | 14 | push @{ $proxy->{status_buffer} }, $string; | |||||||||||||||||||||||||||||||
| 323 | ## now watch for writability. | ||||||||||||||||||||||||||||||||
| 324 | 14 | $proxy->{write_select}->add($fh); | |||||||||||||||||||||||||||||||
| 325 | } | ||||||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||||||
| 327 | 5 | ▶ | sub sockets_from_env { | ||||||||||||||||||||||||||||||
|
Subroutine
sockets_from_env: called CC=3 SCAR=11.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 328 | 5 | my $class = shift; | |||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||
| 330 | 5 | my $sockets = {}; | |||||||||||||||||||||||||||||||
| 331 | 5 | for (keys %ENV) { | |||||||||||||||||||||||||||||||
| 332 | 185 | ▶ | next unless /^_CFK_SOCK_(.+)$/; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 333 | 0 | $sockets->{$1} = $ENV{$_}; | |||||||||||||||||||||||||||||||
| 334 | } | ||||||||||||||||||||||||||||||||
| 335 | 5 | return $sockets; | |||||||||||||||||||||||||||||||
| 336 | } | ||||||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||||||
| 338 | 2 | ▶ | sub shutdown { | ||||||||||||||||||||||||||||||
|
Subroutine
shutdown: called CC=2 SCAR=7.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 339 | 2 | my $proxy = shift; | |||||||||||||||||||||||||||||||
| 340 | 2 | for my $svc (values %{ $proxy->{services} }) { | |||||||||||||||||||||||||||||||
| 341 | 0 | $proxy->_stop_service($svc); | |||||||||||||||||||||||||||||||
| 342 | } | ||||||||||||||||||||||||||||||||
| 343 | } | ||||||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||||||
| 345 | 7 | ▶ | sub child_exit { | ||||||||||||||||||||||||||||||
|
Subroutine
child_exit: called CC=2 SCAR=7.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 346 | 7 | my $proxy = shift; | |||||||||||||||||||||||||||||||
| 347 | 7 | my ($pid, $status) = @_; | |||||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||||||
| 349 | 7 | my ($svc) = grep { $_->{pid} == $pid } | |||||||||||||||||||||||||||||||
| 350 | 7 | grep { $_->{pid} } | |||||||||||||||||||||||||||||||
| 351 | 7 | values %{ $proxy->{services} }; | |||||||||||||||||||||||||||||||
| 352 | |||||||||||||||||||||||||||||||||
| 353 | 7 | ▶ | unless ($svc) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 354 | 0 | $proxy->log(err => "Blacklisting yet unknown pid $pid"); | |||||||||||||||||||||||||||||||
| 355 | 0 | $proxy->blacklist_pid($pid, $status); | |||||||||||||||||||||||||||||||
| 356 | 0 | return; | |||||||||||||||||||||||||||||||
| 357 | } | ||||||||||||||||||||||||||||||||
| 358 | 7 | $proxy->send_status('stopped', $svc->{name}, $pid, $status); | |||||||||||||||||||||||||||||||
| 359 | 7 | $svc->{pid} = undef; | |||||||||||||||||||||||||||||||
| 360 | 7 | delete $proxy->{services}{ $svc->{name} }; | |||||||||||||||||||||||||||||||
| 361 | } | ||||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||
| 363 | 0 | ▶ | sub blacklist_pid { | ||||||||||||||||||||||||||||||
|
Subroutine
blacklist_pid: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 364 | 0 | my $proxy = shift; | |||||||||||||||||||||||||||||||
| 365 | 0 | my ($pid, $status) = @_; | |||||||||||||||||||||||||||||||
| 366 | 0 | $proxy->{pid_blacklist}->{$pid} = { time => time, exit_status => $status }; | |||||||||||||||||||||||||||||||
| 367 | } | ||||||||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||||||
| 369 | 7 | ▶ | sub verify_pid { | ||||||||||||||||||||||||||||||
|
Subroutine
verify_pid: called CC=4 SCAR=23.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 370 | 7 | my $proxy = shift; | |||||||||||||||||||||||||||||||
| 371 | 7 | my ($svc) = @_; | |||||||||||||||||||||||||||||||
| 372 | 7 | for my $pid (keys %{ $proxy->{pid_blacklist} }) { | |||||||||||||||||||||||||||||||
| 373 | 0 | my $bl = $proxy->{pid_blacklist}{$pid}; | |||||||||||||||||||||||||||||||
| 374 | 0 | my $es = $bl->{exit_status}; | |||||||||||||||||||||||||||||||
| 375 | 0 | ▶ | if ($svc->{pid} == $pid) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 376 | 0 | $proxy->send_status('stopped', $svc->{name}, $pid, $es); | |||||||||||||||||||||||||||||||
| 377 | 0 | $svc->{pid} = undef; | |||||||||||||||||||||||||||||||
| 378 | 0 | next; | |||||||||||||||||||||||||||||||
| 379 | } | ||||||||||||||||||||||||||||||||
| 380 | 0 | my $time = $bl->{time}; | |||||||||||||||||||||||||||||||
| 381 | 0 | ▶ | if (time - $time > 5) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 382 | 0 | $proxy->log(err => "Oops pid disappeared: $pid"); | |||||||||||||||||||||||||||||||
| 383 | } | ||||||||||||||||||||||||||||||||
| 384 | } | ||||||||||||||||||||||||||||||||
| 385 | 7 | return; | |||||||||||||||||||||||||||||||
| 386 | } | ||||||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||||||
| 388 | 5 | ▶ | sub run { | ||||||||||||||||||||||||||||||
|
Subroutine
run: called CC=5 SCAR=16.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 389 | 5 | my $proxy = shift; | |||||||||||||||||||||||||||||||
| 390 | |||||||||||||||||||||||||||||||||
| 391 | 7 | ▶ | $SIG{CHLD} = sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 392 | ## Ideally we woudn't do much in there, to return quickly | ||||||||||||||||||||||||||||||||
| 393 | 7 | ▶ | while ((my $pid = waitpid -1, &POSIX::WNOHANG) > 0) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 394 | 7 | $proxy->child_exit($pid, $?); | |||||||||||||||||||||||||||||||
| 395 | } | ||||||||||||||||||||||||||||||||
| 396 | 5 | }; | |||||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||||||
| 398 | 5 | my $rs = $proxy->{read_select}; | |||||||||||||||||||||||||||||||
| 399 | 5 | my $ws = $proxy->{write_select}; | |||||||||||||||||||||||||||||||
| 400 | 5 | while (1) { | |||||||||||||||||||||||||||||||
| 401 | 5 | ▶ | while (my ($rout, $wout) = IO::Select->select($rs, $ws, undef)) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 402 | 39 | for my $fh (@$rout) { | |||||||||||||||||||||||||||||||
| 403 | 32 | my $len = sysread($fh, my $buf, 16*1024); | |||||||||||||||||||||||||||||||
| 404 | 31 | ▶ | if ($len <= 0) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 405 | 14 | $rs->remove($fh); | |||||||||||||||||||||||||||||||
| 406 | 14 | close $fh; | |||||||||||||||||||||||||||||||
| 407 | } | ||||||||||||||||||||||||||||||||
| 408 | 31 | $proxy->dispatch_read($fh, \$buf); | |||||||||||||||||||||||||||||||
| 409 | } | ||||||||||||||||||||||||||||||||
| 410 | 35 | for my $fh (@$wout) { | |||||||||||||||||||||||||||||||
| 411 | 24 | $proxy->dispatch_write($fh); | |||||||||||||||||||||||||||||||
| 412 | } | ||||||||||||||||||||||||||||||||
| 413 | } | ||||||||||||||||||||||||||||||||
| 414 | # it would be nice to have more log channels | ||||||||||||||||||||||||||||||||
| 415 | #$proxy->log(debug => "select() interrupted with $!"); | ||||||||||||||||||||||||||||||||
| 416 | } | ||||||||||||||||||||||||||||||||
| 417 | } | ||||||||||||||||||||||||||||||||
| 418 | |||||||||||||||||||||||||||||||||
| 419 | 31 | ▶ | sub dispatch_read { | ||||||||||||||||||||||||||||||
|
Subroutine
dispatch_read: called CC=2 SCAR=7.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 420 | 31 | my $proxy = shift; | |||||||||||||||||||||||||||||||
| 421 | 31 | my ($fh, $dataref) = @_; | |||||||||||||||||||||||||||||||
| 422 | 31 | my $cb = $proxy->{readers}->{$fh}; | |||||||||||||||||||||||||||||||
| 423 | 31 | ▶ | unless ($cb) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 424 | 0 | $proxy->log(err => "cannot find callback for reader"); | |||||||||||||||||||||||||||||||
| 425 | 0 | return; | |||||||||||||||||||||||||||||||
| 426 | } | ||||||||||||||||||||||||||||||||
| 427 | 31 | $cb->($dataref); | |||||||||||||||||||||||||||||||
| 428 | } | ||||||||||||||||||||||||||||||||
| 429 | |||||||||||||||||||||||||||||||||
| 430 | 24 | ▶ | sub dispatch_write { | ||||||||||||||||||||||||||||||
|
Subroutine
dispatch_write: called CC=6 SCAR=20.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 431 | 24 | my $proxy = shift; | |||||||||||||||||||||||||||||||
| 432 | 24 | my ($fh) = @_; | |||||||||||||||||||||||||||||||
| 433 | 24 | ▶ | if (! exists $proxy->{writers}{$fh} ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 434 | 0 | $proxy->log(err => "cannot find the buffer for writer"); | |||||||||||||||||||||||||||||||
| 435 | 0 | return; | |||||||||||||||||||||||||||||||
| 436 | } | ||||||||||||||||||||||||||||||||
| 437 | 24 | ▶ | my $buf = $proxy->{writers}{$fh} || []; | ||||||||||||||||||||||||||||||
|
Condition50%1/2
$proxy->{'writers'}{$fh} || []
MC/DC0%0/1
$proxy->{'writers'}{$fh} || []
$proxy->{'writers'}{$fh}
Truth table50%1/2
A
A= $proxy->{'writers'}{$fh}
| |||||||||||||||||||||||||||||||||
| 438 | 24 | my $ws = $proxy->{write_select}; | |||||||||||||||||||||||||||||||
| 439 | 24 | ▶ | while (@$buf) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 440 | 26 | my $data = shift @$buf; | |||||||||||||||||||||||||||||||
| 441 | 26 | my $len = syswrite $fh, "$data\n"; | |||||||||||||||||||||||||||||||
| 442 | 26 | ▶ | if (! defined $len or $len <= 0) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not defined $len or $len <= 0
MC/DC0%0/2
not defined $len or $len <= 0
not defined $len
$len <= 0
Truth table33%1/3
not(A) or B
A= not defined $lenB= $len <= 0
| |||||||||||||||||||||||||||||||||
| 443 | 0 | $ws->remove($fh); | |||||||||||||||||||||||||||||||
| 444 | 0 | close $fh; | |||||||||||||||||||||||||||||||
| 445 | 0 | last; | |||||||||||||||||||||||||||||||
| 446 | } | ||||||||||||||||||||||||||||||||
| 447 | } | ||||||||||||||||||||||||||||||||
| 448 | ## We don't need to look for writability for now | ||||||||||||||||||||||||||||||||
| 449 | 24 | $ws->remove($fh); | |||||||||||||||||||||||||||||||
| 450 | } | ||||||||||||||||||||||||||||||||
| 451 | |||||||||||||||||||||||||||||||||
| 452 | 0 | ▶ | sub set_nonblocking { | ||||||||||||||||||||||||||||||
|
Subroutine
set_nonblocking: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 453 | 0 | require Fcntl; | |||||||||||||||||||||||||||||||
| 454 | 0 | fcntl $_[0], &Fcntl::F_SETFL, &Fcntl::O_NONBLOCK; | |||||||||||||||||||||||||||||||
| 455 | } | ||||||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||||||
| 457 | 5 | 1; | |||||||||||||||||||||||||||||||