| 1 | package Future::Uring::Handle; | ||||||||||||||||||||||||||||
| 2 | 5 | $Future::Uring::Handle::VERSION = '0.005'; | |||||||||||||||||||||||||||
| 3 | 5 | ▶ | use 5.020; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 5 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 5 | ▶ | use experimental qw/signatures lexical_subs/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 5 | require Future::Uring; | |||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 5 | ▶ | use IO::Uring qw/ | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | IORING_FSYNC_DATASYNC IOSQE_ASYNC IOSQE_IO_LINK IOSQE_IO_HARDLINK IOSQE_IO_DRAIN IORING_RECVSEND_POLL_FIRST | ||||||||||||||||||||||||||||
| 11 | IORING_TIMEOUT_ABS IORING_TIMEOUT_BOOTTIME IORING_TIMEOUT_REALTIME | ||||||||||||||||||||||||||||
| 12 | 5 | /; | |||||||||||||||||||||||||||
| 13 | 5 | ▶ | use IO::Uring::Singleton 'ring'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | 5 | ▶ | use IO::Poll qw/POLLIN POLLOUT/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | 5 | ▶ | use File::StatX qw/STATX_BASIC_STATS STATX_BTIME/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 1 | ▶ | my sub to_sflags($args) { | ||||||||||||||||||||||||||
|
Subroutine
to_sflags: called CC=6 SCAR=20.3
| |||||||||||||||||||||||||||||
| 18 | 1 | my $result = 0; | |||||||||||||||||||||||||||
| 19 | 1 | ▶ | $result |= IOSQE_ASYNC if $args->{async}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 20 | 1 | ▶ | $result |= IOSQE_IO_LINK if $args->{link} || $args->{timeout}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$args->{"link"} or $args->{"timeout"}
MC/DC0%0/2
$args->{"link"} or $args->{"timeout"}
$args->{"link"}
$args->{"timeout"}
Truth table33%1/3
A or B
A= $args->{"link"}B= $args->{"timeout"}
| |||||||||||||||||||||||||||||
| 21 | 1 | ▶ | $result |= IOSQE_IO_HARDLINK if $args->{hardlink}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 22 | 1 | ▶ | $result |= IOSQE_IO_DRAIN if $args->{drain}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 23 | 1 | return $result; | |||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 5 | my %clocks = ( | |||||||||||||||||||||||||||
| 27 | monotonic => 0, | ||||||||||||||||||||||||||||
| 28 | boottime => IORING_TIMEOUT_BOOTTIME, | ||||||||||||||||||||||||||||
| 29 | realtime => IORING_TIMEOUT_REALTIME, | ||||||||||||||||||||||||||||
| 30 | ); | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | 0 | ▶ | my sub add_timeout($ring, $args) { | ||||||||||||||||||||||||||
|
Subroutine
add_timeout: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||
| 33 | 0 | ▶ | my $time_spec = ref $args->{timeout} ? $args->{timeout} : Time::Spec->new($args->{timeout}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 34 | 0 | my ($flags, $s_flags) = (0, 0); | |||||||||||||||||||||||||||
| 35 | 0 | ▶ | $flags |= $clocks{$args->{timeout_clock}} // croak("No such clock $args->{timeout_clock}") if $args->{timeout_clock}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$clocks{$args->{"timeout_clock"}} // croak(qq[No such clock $args->{"timeout_clock"}])
MC/DC0%0/1
$clocks{$args->{"timeout_clock"}} // croak(qq[No such clock $args->{"timeout_clock"}])
$clocks{$args->{"timeout_clock"}}
Truth table0%0/2
A
A= $clocks{$args->{"timeout_clock"}}
| |||||||||||||||||||||||||||||
| 36 | 0 | ▶ | $flags |= IORING_TIMEOUT_ABS if $args->{timeout_absolute}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 37 | 0 | ▶ | $s_flags |= IOSQE_IO_LINK if $args->{link}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 38 | 0 | $ring->link_timeout($time_spec, $flags, $s_flags); | |||||||||||||||||||||||||||
| 39 | 0 | return; | |||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 13 | ▶ | sub new($class, $fh) { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 43 | 13 | return bless { fh => $fh }, $class; | |||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | 0 | ▶ | sub inner($self) { | ||||||||||||||||||||||||||
|
Subroutine
inner: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 47 | 0 | return $self->{fh}; | |||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | 2 | ▶ | sub accept($self, %args) { | ||||||||||||||||||||||||||
|
Subroutine
accept: called CC=7 SCAR=35.7
Pod
documented
| |||||||||||||||||||||||||||||
| 51 | 2 | my $future = Future::Uring::_Future->new; | |||||||||||||||||||||||||||
| 52 | 2 | my (undef, $sourcename, $line) = caller; | |||||||||||||||||||||||||||
| 53 | 2 | ▶ | my $s_flags = %args ? to_sflags(\%args) : 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 54 | 2 | my $ring = ring; | |||||||||||||||||||||||||||
| 55 | 0 | ▶ | $ring->submit if $args{timeout} && $ring->sq_space_left < 2; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$args{"timeout"} and $ring->sq_space_left < 2
MC/DC0%0/2
$args{"timeout"} and $ring->sq_space_left < 2
$args{"timeout"}
$ring->sq_space_left < 2
Truth table0%0/3
A and B
A= $args{"timeout"}B= $ring->sq_space_left < 2
| |||||||||||||||||||||||||||||
| 56 | 0 | ▶ | my $class = $args{class} // ref $self->{fh}; | ||||||||||||||||||||||||||
|
Condition0%0/2
$args{"class"} // ref $self->{"fh"}
MC/DC0%0/1
$args{"class"} // ref $self->{"fh"}
$args{"class"}
Truth table0%0/2
A
A= $args{"class"}
| |||||||||||||||||||||||||||||
| 57 | 0 | ▶ | my $id = $ring->accept($self->{fh}, $s_flags, sub($res, $flags) { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 58 | 0 | ▶ | if ($res >= 0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 59 | 0 | my $fh = $class->new_from_fd($res, 'w+'); | |||||||||||||||||||||||||||
| 60 | 0 | $future->done(Future::Uring::Handle->new($fh)); | |||||||||||||||||||||||||||
| 61 | } else { | ||||||||||||||||||||||||||||
| 62 | 0 | $future->fail(Future::Uring::Exception->new('accept', $res, $sourcename, $line)); | |||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||
| 64 | 0 | }); | |||||||||||||||||||||||||||
| 65 | 0 | ▶ | $future->on_cancel(sub { $ring->cancel($id, 0, 0) }) if $args{mutable}; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 66 | 0 | ▶ | add_timeout($ring, \%args) if $args{timeout}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 67 | 0 | return $future; | |||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | 0 | ▶ | sub allocate($self, $offset, $length, %args) { | ||||||||||||||||||||||||||
|
Subroutine
allocate: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||
| 71 | 0 | my $future = Future::Uring::_Future->new; | |||||||||||||||||||||||||||
| 72 | 0 | my (undef, $sourcename, $line) = caller; | |||||||||||||||||||||||||||
| 73 | 0 | ▶ | my $s_flags = %args ? to_sflags(\%args) : 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 74 | 0 | my $ring = ring; | |||||||||||||||||||||||||||
| 75 | 0 | ▶ | $ring->submit if $args{timeout} && $ring->sq_space_left < 2; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$args{"timeout"} and $ring->sq_space_left < 2
MC/DC0%0/2
$args{"timeout"} and $ring->sq_space_left < 2
$args{"timeout"}
$ring->sq_space_left < 2
Truth table0%0/3
A and B
A= $args{"timeout"}B= $ring->sq_space_left < 2
| |||||||||||||||||||||||||||||
| 76 | 0 | ▶ | my $id = $ring->fallocate($self->{fh}, $offset, $length, $s_flags, sub($res, $flags) { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 77 | 0 | ▶ | if ($res < 0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 78 | 0 | $future->fail(Future::Uring::Exception->new('allocate', $res, $sourcename, $line)); | |||||||||||||||||||||||||||
| 79 | } else { | ||||||||||||||||||||||||||||
| 80 | 0 | $future->done; | |||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||
| 82 | 0 | }); | |||||||||||||||||||||||||||
| 83 | 0 | ▶ | $future->on_cancel(sub { $ring->cancel($id, 0, 0) }) if $args{mutable}; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 84 | 0 | ▶ | add_timeout($ring, \%args) if $args{timeout}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 85 | 0 | return $future; | |||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | 0 | ▶ | sub bind($self, $name, %args) { | ||||||||||||||||||||||||||
|
Subroutine
bind: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||
| 89 | 0 | my $future = Future::Uring::_Future->new; | |||||||||||||||||||||||||||
| 90 | 0 | my (undef, $sourcename, $line) = caller; | |||||||||||||||||||||||||||
| 91 | 0 | ▶ | my $s_flags = %args ? to_sflags(\%args) : 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 92 | 0 | my $ring = ring; | |||||||||||||||||||||||||||
| 93 | 0 | ▶ | $ring->submit if $args{timeout} && $ring->sq_space_left < 2; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$args{"timeout"} and $ring->sq_space_left < 2
MC/DC0%0/2
$args{"timeout"} and $ring->sq_space_left < 2
$args{"timeout"}
$ring->sq_space_left < 2
Truth table0%0/3
A and B
A= $args{"timeout"}B= $ring->sq_space_left < 2
| |||||||||||||||||||||||||||||
| 94 | 0 | ▶ | my $id = $ring->bind($self->{fh}, $name, $s_flags, sub($res, $flags) { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 95 | 0 | ▶ | if ($res < 0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 96 | 0 | $future->fail(Future::Uring::Exception->new('bind', $res, $sourcename, $line)); | |||||||||||||||||||||||||||
| 97 | } else { | ||||||||||||||||||||||||||||
| 98 | 0 | $future->done; | |||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||
| 100 | 0 | }); | |||||||||||||||||||||||||||
| 101 | 0 | ▶ | $future->on_cancel(sub { $ring->cancel($id, 0, 0) }) if $args{mutable}; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 102 | 0 | ▶ | add_timeout($ring, \%args) if $args{timeout}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 103 | 0 | return $future; | |||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||
| 106 | 0 | ▶ | sub close($self, %args) { | ||||||||||||||||||||||||||
|
Subroutine
close: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||
| 107 | 0 | my $future = Future::Uring::_Future->new; | |||||||||||||||||||||||||||
| 108 | 0 | my (undef, $sourcename, $line) = caller; | |||||||||||||||||||||||||||
| 109 | 0 | ▶ | my $s_flags = %args ? to_sflags(\%args) : 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 110 | 0 | my $ring = ring; | |||||||||||||||||||||||||||
| 111 | 0 | ▶ | $ring->submit if $args{timeout} && $ring->sq_space_left < 2; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$args{"timeout"} and $ring->sq_space_left < 2
MC/DC0%0/2
$args{"timeout"} and $ring->sq_space_left < 2
$args{"timeout"}
$ring->sq_space_left < 2
Truth table0%0/3
A and B
A= $args{"timeout"}B= $ring->sq_space_left < 2
| |||||||||||||||||||||||||||||
| 112 | 0 | ▶ | my $id = $ring->close($self->{fh}, $s_flags, sub($res, $flags) { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 113 | 0 | ▶ | if ($res < 0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 114 | 0 | $future->fail(Future::Uring::Exception->new('close', $res, $sourcename, $line)); | |||||||||||||||||||||||||||
| 115 | } else { | ||||||||||||||||||||||||||||
| 116 | 0 | $future->done; | |||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||
| 118 | 0 | }); | |||||||||||||||||||||||||||
| 119 | 0 | ▶ | $future->on_cancel(sub { $ring->cancel($id, 0, 0) }) if $args{mutable}; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 120 | 0 | ▶ | add_timeout($ring, \%args) if $args{timeout}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 121 | 0 | return $future; | |||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||
| 124 | 2 | ▶ | sub connect($self, $name, %args) { | ||||||||||||||||||||||||||
|
Subroutine
connect: called CC=6 SCAR=32.2
Pod
documented
| |||||||||||||||||||||||||||||
| 125 | 2 | my $future = Future::Uring::_Future->new; | |||||||||||||||||||||||||||
| 126 | 2 | my (undef, $sourcename, $line) = caller; | |||||||||||||||||||||||||||
| 127 | 2 | ▶ | my $s_flags = %args ? to_sflags(\%args) : 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 128 | 2 | my $ring = ring; | |||||||||||||||||||||||||||
| 129 | 0 | ▶ | $ring->submit if $args{timeout} && $ring->sq_space_left < 2; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$args{"timeout"} and $ring->sq_space_left < 2
MC/DC0%0/2
$args{"timeout"} and $ring->sq_space_left < 2
$args{"timeout"}
$ring->sq_space_left < 2
Truth table0%0/3
A and B
A= $args{"timeout"}B= $ring->sq_space_left < 2
| |||||||||||||||||||||||||||||
| 130 | 0 | ▶ | my $id = $ring->connect($self->{fh}, $name, $s_flags, sub($res, $flags) { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 131 | 0 | ▶ | if ($res < 0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 132 | 0 | $future->fail(Future::Uring::Exception->new('connect', $res, $sourcename, $line)); | |||||||||||||||||||||||||||
| 133 | } else { | ||||||||||||||||||||||||||||
| 134 | 0 | $future->done; | |||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||
| 136 | 0 | }); | |||||||||||||||||||||||||||
| 137 | 0 | ▶ | $future->on_cancel(sub { $ring->cancel($id, 0, 0) }) if $args{mutable}; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 138 | 0 | ▶ | add_timeout($ring, \%args) if $args{timeout}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 139 | 0 | return $future; | |||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||
| 142 | 0 | ▶ | sub listen($self, $size, %args) { | ||||||||||||||||||||||||||
|
Subroutine
listen: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||
| 143 | 0 | my $future = Future::Uring::_Future->new; | |||||||||||||||||||||||||||
| 144 | 0 | my (undef, $sourcename, $line) = caller; | |||||||||||||||||||||||||||
| 145 | 0 | ▶ | my $s_flags = %args ? to_sflags(\%args) : 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 146 | 0 | my $ring = ring; | |||||||||||||||||||||||||||
| 147 | 0 | ▶ | $ring->submit if $args{timeout} && $ring->sq_space_left < 2; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$args{"timeout"} and $ring->sq_space_left < 2
MC/DC0%0/2
$args{"timeout"} and $ring->sq_space_left < 2
$args{"timeout"}
$ring->sq_space_left < 2
Truth table0%0/3
A and B
A= $args{"timeout"}B= $ring->sq_space_left < 2
| |||||||||||||||||||||||||||||
| 148 | 0 | ▶ | my $id = $ring->listen($self->{fh}, $size, $s_flags, sub($res, $flags) { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 149 | 0 | ▶ | if ($res < 0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 150 | 0 | $future->fail(Future::Uring::Exception->new('listen', $res, $sourcename, $line)); | |||||||||||||||||||||||||||
| 151 | } else { | ||||||||||||||||||||||||||||
| 152 | 0 | $future->done; | |||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||
| 154 | 0 | }); | |||||||||||||||||||||||||||
| 155 | 0 | ▶ | $future->on_cancel(sub { $ring->cancel($id, 0, 0) }) if $args{mutable}; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 156 | 0 | ▶ | add_timeout($ring, \%args) if $args{timeout}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 157 | 0 | return $future; | |||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||
| 160 | 0 | ▶ | sub poll($self, %args) { | ||||||||||||||||||||||||||
|
Subroutine
poll: not called CC=9 SCAR=45.0
Pod
documented
| |||||||||||||||||||||||||||||
| 161 | 0 | my $future = Future::Uring::_Future->new; | |||||||||||||||||||||||||||
| 162 | 0 | my (undef, $sourcename, $line) = caller; | |||||||||||||||||||||||||||
| 163 | 0 | ▶ | my $s_flags = %args ? to_sflags(\%args) : 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 164 | 0 | ▶ | my $mask = $args{mask} // 0; | ||||||||||||||||||||||||||
|
Condition0%0/2
$args{"mask"} // 0
MC/DC0%0/1
$args{"mask"} // 0
$args{"mask"}
Truth table0%0/2
A
A= $args{"mask"}
| |||||||||||||||||||||||||||||
| 165 | 0 | ▶ | $mask |= POLLIN if $args{read}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 166 | 0 | ▶ | $mask |= POLLOUT if $args{write}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 167 | 0 | my $ring = ring; | |||||||||||||||||||||||||||
| 168 | 0 | ▶ | $ring->submit if $args{timeout} && $ring->sq_space_left < 2; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$args{"timeout"} and $ring->sq_space_left < 2
MC/DC0%0/2
$args{"timeout"} and $ring->sq_space_left < 2
$args{"timeout"}
$ring->sq_space_left < 2
Truth table0%0/3
A and B
A= $args{"timeout"}B= $ring->sq_space_left < 2
| |||||||||||||||||||||||||||||
| 169 | 0 | ▶ | my $id = $ring->poll($self->{fh}, $mask, $s_flags, sub($res, $flags) { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 170 | 0 | ▶ | if ($res < 0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 171 | 0 | $future->fail(Future::Uring::Exception->new('poll', $res, $sourcename, $line)); | |||||||||||||||||||||||||||
| 172 | } else { | ||||||||||||||||||||||||||||
| 173 | 0 | $future->done($res); | |||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||
| 175 | 0 | }); | |||||||||||||||||||||||||||
| 176 | 0 | ▶ | if ($args{mutable}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 177 | 0 | bless $future, 'Future::Uring::_PollFuture'; | |||||||||||||||||||||||||||
| 178 | 0 | $future->set_udata('uring_id', $id); | |||||||||||||||||||||||||||
| 179 | 0 | ▶ | $future->on_cancel(sub { $ring->cancel($id, 0, 0) }); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||
| 181 | 0 | ▶ | add_timeout($ring, \%args) if $args{timeout}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 182 | 0 | return $future; | |||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||
| 185 | 2 | ▶ | sub recv($self, $length, %args) { | ||||||||||||||||||||||||||
|
Subroutine
recv: called CC=8 SCAR=35.1
Pod
documented
| |||||||||||||||||||||||||||||
| 186 | 2 | my $future = Future::Uring::_Future->new; | |||||||||||||||||||||||||||
| 187 | 2 | my (undef, $sourcename, $line) = caller; | |||||||||||||||||||||||||||
| 188 | 2 | my $buffer = "\0" x $length; | |||||||||||||||||||||||||||
| 189 | 2 | ▶ | my $flags = $args{flags} // 0; | ||||||||||||||||||||||||||
|
Condition50%1/2
$args{"flags"} // 0
MC/DC0%0/1
$args{"flags"} // 0
$args{"flags"}
Truth table50%1/2
A
A= $args{"flags"}
| |||||||||||||||||||||||||||||
| 190 | 2 | ▶ | my $s_flags = %args ? to_sflags(\%args) : 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 191 | 2 | ▶ | my $p_flags = $args{poll_first} ? IORING_RECVSEND_POLL_FIRST : 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 192 | 2 | my $ring = ring; | |||||||||||||||||||||||||||
| 193 | 0 | ▶ | $ring->submit if $args{timeout} && $ring->sq_space_left < 2; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$args{"timeout"} and $ring->sq_space_left < 2
MC/DC0%0/2
$args{"timeout"} and $ring->sq_space_left < 2
$args{"timeout"}
$ring->sq_space_left < 2
Truth table0%0/3
A and B
A= $args{"timeout"}B= $ring->sq_space_left < 2
| |||||||||||||||||||||||||||||
| 194 | 0 | ▶ | my $id = $ring->recv($self->{fh}, $buffer, $flags, $p_flags, $s_flags, sub($res, $flags) { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||
| 195 | 0 | ▶ | if ($res > 0) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 196 | 0 | ▶ | $future->done($res == $length ? $buffer : substr $buffer, 0, $res); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 197 | } elsif ($res == 0) { | ||||||||||||||||||||||||||||
| 198 | 0 | $future->done; | |||||||||||||||||||||||||||
| 199 | } else { | ||||||||||||||||||||||||||||
| 200 | 0 | $future->fail(Future::Uring::Exception->new('recv', $res, $sourcename, $line)); | |||||||||||||||||||||||||||
| 201 | } | ||||||||||||||||||||||||||||
| 202 | 0 | }); | |||||||||||||||||||||||||||
| 203 | 0 | ▶ | $future->on_cancel(sub { $ring->cancel($id, 0, 0) }) if $args{mutable}; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 204 | 0 | ▶ | add_timeout($ring, \%args) if $args{timeout}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 205 | 0 | return $future; | |||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||
| 208 | 3 | ▶ | sub read($self, $length, %args) { | ||||||||||||||||||||||||||
|
Subroutine
read: called CC=7 SCAR=33.0
Pod
documented
| |||||||||||||||||||||||||||||
| 209 | 3 | my $future = Future::Uring::_Future->new; | |||||||||||||||||||||||||||
| 210 | 3 | my (undef, $sourcename, $line) = caller; | |||||||||||||||||||||||||||
| 211 | 3 | my $buffer = "\0" x $length; | |||||||||||||||||||||||||||
| 212 | 3 | ▶ | my $offset = $args{offset} // -1; | ||||||||||||||||||||||||||
|
Condition50%1/2
$args{"offset"} // -1
MC/DC0%0/1
$args{"offset"} // -1
$args{"offset"}
Truth table50%1/2
A
A= $args{"offset"}
| |||||||||||||||||||||||||||||
| 213 | 3 | ▶ | my $s_flags = %args ? to_sflags(\%args) : 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 214 | 3 | my $ring = ring; | |||||||||||||||||||||||||||
| 215 | 0 | ▶ | $ring->submit if $args{timeout} && $ring->sq_space_left < 2; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$args{"timeout"} and $ring->sq_space_left < 2
MC/DC0%0/2
$args{"timeout"} and $ring->sq_space_left < 2
$args{"timeout"}
$ring->sq_space_left < 2
Truth table0%0/3
A and B
A= $args{"timeout"}B= $ring->sq_space_left < 2
| |||||||||||||||||||||||||||||
| 216 | 0 | ▶ | my $id = $ring->read($self->{fh}, $buffer, $offset, $s_flags, sub($res, $flags) { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||
| 217 | 0 | ▶ | if ($res > 0) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 218 | 0 | ▶ | $future->done($res == $length ? $buffer : substr $buffer, 0, $res); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 219 | } elsif ($res == 0) { | ||||||||||||||||||||||||||||
| 220 | 0 | $future->done; | |||||||||||||||||||||||||||
| 221 | } else { | ||||||||||||||||||||||||||||
| 222 | 0 | $future->fail(Future::Uring::Exception->new('read', $res, $sourcename, $line)); | |||||||||||||||||||||||||||
| 223 | } | ||||||||||||||||||||||||||||
| 224 | 0 | }); | |||||||||||||||||||||||||||
| 225 | 0 | ▶ | $future->on_cancel(sub { $ring->cancel($id, 0, 0) }) if $args{mutable}; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 226 | 0 | ▶ | add_timeout($ring, \%args) if $args{timeout}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 227 | 0 | return $future; | |||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||
| 230 | 0 | ▶ | sub send($self, $buffer, %args) { | ||||||||||||||||||||||||||
|
Subroutine
send: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||||||||||||||||||||
| 231 | 0 | my $future = Future::Uring::_Future->new; | |||||||||||||||||||||||||||
| 232 | 0 | my (undef, $sourcename, $line) = caller; | |||||||||||||||||||||||||||
| 233 | 0 | ▶ | my $flags = $args{flags} // 0; | ||||||||||||||||||||||||||
|
Condition0%0/2
$args{"flags"} // 0
MC/DC0%0/1
$args{"flags"} // 0
$args{"flags"}
Truth table0%0/2
A
A= $args{"flags"}
| |||||||||||||||||||||||||||||
| 234 | 0 | ▶ | my $s_flags = %args ? to_sflags(\%args) : 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 235 | 0 | ▶ | my $p_flags = $args{poll_first} ? IORING_RECVSEND_POLL_FIRST : 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 236 | 0 | my $ring = ring; | |||||||||||||||||||||||||||
| 237 | 0 | ▶ | $ring->submit if $args{timeout} && $ring->sq_space_left < 2; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$args{"timeout"} and $ring->sq_space_left < 2
MC/DC0%0/2
$args{"timeout"} and $ring->sq_space_left < 2
$args{"timeout"}
$ring->sq_space_left < 2
Truth table0%0/3
A and B
A= $args{"timeout"}B= $ring->sq_space_left < 2
| |||||||||||||||||||||||||||||
| 238 | 0 | ▶ | my $id = $ring->send($self->{fh}, $buffer, $flags, $p_flags, $s_flags, sub($res, $flags) { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 239 | 0 | ▶ | if ($res >= 0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 240 | 0 | $future->done($res); | |||||||||||||||||||||||||||
| 241 | } else { | ||||||||||||||||||||||||||||
| 242 | 0 | $future->fail(Future::Uring::Exception->new('send', $res, $sourcename, $line)); | |||||||||||||||||||||||||||
| 243 | } | ||||||||||||||||||||||||||||
| 244 | 0 | }); | |||||||||||||||||||||||||||
| 245 | 0 | ▶ | $future->on_cancel(sub { $ring->cancel($id, 0, 0) }) if $args{mutable}; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 246 | 0 | ▶ | add_timeout($ring, \%args) if $args{timeout}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 247 | 0 | return $future; | |||||||||||||||||||||||||||
| 248 | } | ||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||
| 250 | 2 | ▶ | sub sendto($self, $buffer, $name, %args) { | ||||||||||||||||||||||||||
|
Subroutine
sendto: called CC=8 SCAR=34.6
Pod
documented
| |||||||||||||||||||||||||||||
| 251 | 2 | my $future = Future::Uring::_Future->new; | |||||||||||||||||||||||||||
| 252 | 2 | my (undef, $sourcename, $line) = caller; | |||||||||||||||||||||||||||
| 253 | 2 | ▶ | my $flags = $args{flags} // 0; | ||||||||||||||||||||||||||
|
Condition50%1/2
$args{"flags"} // 0
MC/DC0%0/1
$args{"flags"} // 0
$args{"flags"}
Truth table50%1/2
A
A= $args{"flags"}
| |||||||||||||||||||||||||||||
| 254 | 2 | ▶ | my $s_flags = %args ? to_sflags(\%args) : 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 255 | 2 | ▶ | my $p_flags = $args{poll_first} ? IORING_RECVSEND_POLL_FIRST : 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 256 | 2 | my $ring = ring; | |||||||||||||||||||||||||||
| 257 | 0 | ▶ | $ring->submit if $args{timeout} && $ring->sq_space_left < 2; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$args{"timeout"} and $ring->sq_space_left < 2
MC/DC0%0/2
$args{"timeout"} and $ring->sq_space_left < 2
$args{"timeout"}
$ring->sq_space_left < 2
Truth table0%0/3
A and B
A= $args{"timeout"}B= $ring->sq_space_left < 2
| |||||||||||||||||||||||||||||
| 258 | 0 | ▶ | my $id = $ring->sendto($self->{fh}, $buffer, $flags, $name, $p_flags, $s_flags, sub($res, $flags) { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 259 | 0 | ▶ | if ($res >= 0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 260 | 0 | $future->done($res); | |||||||||||||||||||||||||||
| 261 | } else { | ||||||||||||||||||||||||||||
| 262 | 0 | $future->fail(Future::Uring::Exception->new('sendto', $res, $sourcename, $line)); | |||||||||||||||||||||||||||
| 263 | } | ||||||||||||||||||||||||||||
| 264 | 0 | }); | |||||||||||||||||||||||||||
| 265 | 0 | ▶ | $future->on_cancel(sub { $ring->cancel($id, 0, 0) }) if $args{mutable}; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 266 | 0 | ▶ | add_timeout($ring, \%args) if $args{timeout}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 267 | 0 | return $future; | |||||||||||||||||||||||||||
| 268 | } | ||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||
| 270 | 0 | ▶ | sub shutdown($self, $how, %args) { | ||||||||||||||||||||||||||
|
Subroutine
shutdown: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||
| 271 | 0 | my $future = Future::Uring::_Future->new; | |||||||||||||||||||||||||||
| 272 | 0 | my (undef, $sourcename, $line) = caller; | |||||||||||||||||||||||||||
| 273 | 0 | ▶ | my $s_flags = %args ? to_sflags(\%args) : 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 274 | 0 | my $ring = ring; | |||||||||||||||||||||||||||
| 275 | 0 | ▶ | $ring->submit if $args{timeout} && $ring->sq_space_left < 2; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$args{"timeout"} and $ring->sq_space_left < 2
MC/DC0%0/2
$args{"timeout"} and $ring->sq_space_left < 2
$args{"timeout"}
$ring->sq_space_left < 2
Truth table0%0/3
A and B
A= $args{"timeout"}B= $ring->sq_space_left < 2
| |||||||||||||||||||||||||||||
| 276 | 0 | ▶ | my $id = $ring->shutdown($self->{fh}, $how, $s_flags, sub($res, $flags) { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 277 | 0 | ▶ | if ($res < 0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 278 | 0 | $future->fail(Future::Uring::Exception->new('shutdown', $res, $sourcename, $line)); | |||||||||||||||||||||||||||
| 279 | } else { | ||||||||||||||||||||||||||||
| 280 | 0 | $future->done; | |||||||||||||||||||||||||||
| 281 | } | ||||||||||||||||||||||||||||
| 282 | 0 | }); | |||||||||||||||||||||||||||
| 283 | 0 | ▶ | $future->on_cancel(sub { $ring->cancel($id, 0, 0) }) if $args{mutable}; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 284 | 0 | ▶ | add_timeout($ring, \%args) if $args{timeout}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 285 | 0 | return $future; | |||||||||||||||||||||||||||
| 286 | } | ||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||
| 288 | 0 | ▶ | sub splice($self, $out, $nbytes, %args) { | ||||||||||||||||||||||||||
|
Subroutine
splice: not called CC=9 SCAR=45.0
Pod
documented
| |||||||||||||||||||||||||||||
| 289 | 0 | my $future = Future::Uring::_Future->new; | |||||||||||||||||||||||||||
| 290 | 0 | my (undef, $sourcename, $line) = caller; | |||||||||||||||||||||||||||
| 291 | 0 | ▶ | my $off_in = $args{off_in} // -1; | ||||||||||||||||||||||||||
|
Condition0%0/2
$args{"off_in"} // -1
MC/DC0%0/1
$args{"off_in"} // -1
$args{"off_in"}
Truth table0%0/2
A
A= $args{"off_in"}
| |||||||||||||||||||||||||||||
| 292 | 0 | ▶ | my $fh = $out->isa('Future::Uring::Handle') ? $out->inner : $out; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 293 | 0 | ▶ | my $off_out = $args{off_out} // -1; | ||||||||||||||||||||||||||
|
Condition0%0/2
$args{"off_out"} // -1
MC/DC0%0/1
$args{"off_out"} // -1
$args{"off_out"}
Truth table0%0/2
A
A= $args{"off_out"}
| |||||||||||||||||||||||||||||
| 294 | 0 | ▶ | my $s_flags = %args ? to_sflags(\%args) : 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 295 | 0 | my $ring = ring; | |||||||||||||||||||||||||||
| 296 | 0 | ▶ | $ring->submit if $args{timeout} && $ring->sq_space_left < 2; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$args{"timeout"} and $ring->sq_space_left < 2
MC/DC0%0/2
$args{"timeout"} and $ring->sq_space_left < 2
$args{"timeout"}
$ring->sq_space_left < 2
Truth table0%0/3
A and B
A= $args{"timeout"}B= $ring->sq_space_left < 2
| |||||||||||||||||||||||||||||
| 297 | 0 | ▶ | my $id = $ring->splice($self->{fh}, $off_in, $fh, $off_out, 0, $s_flags, sub($res, $flags) { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 298 | 0 | ▶ | if ($res < 0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 299 | 0 | $future->fail(Future::Uring::Exception->new('splice', $res, $sourcename, $line)); | |||||||||||||||||||||||||||
| 300 | } else { | ||||||||||||||||||||||||||||
| 301 | 0 | $future->done; | |||||||||||||||||||||||||||
| 302 | } | ||||||||||||||||||||||||||||
| 303 | 0 | }); | |||||||||||||||||||||||||||
| 304 | 0 | ▶ | $future->on_cancel(sub { $ring->cancel($id, 0, 0) }) if $args{mutable}; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 305 | 0 | ▶ | add_timeout($ring, \%args) if $args{timeout}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 306 | 0 | return $future; | |||||||||||||||||||||||||||
| 307 | } | ||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||
| 309 | 0 | ▶ | sub statx($self, %args) { | ||||||||||||||||||||||||||
|
Subroutine
statx: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||||||||||||||||||||
| 310 | 0 | my $future = Future::Uring::_Future->new; | |||||||||||||||||||||||||||
| 311 | 0 | my (undef, $sourcename, $line) = caller; | |||||||||||||||||||||||||||
| 312 | 0 | ▶ | my $flags = $args{flags} // 0; | ||||||||||||||||||||||||||
|
Condition0%0/2
$args{"flags"} // 0
MC/DC0%0/1
$args{"flags"} // 0
$args{"flags"}
Truth table0%0/2
A
A= $args{"flags"}
| |||||||||||||||||||||||||||||
| 313 | 0 | ▶ | my $mask = $args{mask} // STATX_BASIC_STATS | STATX_BTIME; | ||||||||||||||||||||||||||
|
Condition0%0/2
$args{"mask"} // 4095
MC/DC0%0/1
$args{"mask"} // 4095
$args{"mask"}
Truth table0%0/2
A
A= $args{"mask"}
| |||||||||||||||||||||||||||||
| 314 | 0 | my $stat = File::StatX->new; | |||||||||||||||||||||||||||
| 315 | 0 | ▶ | my $s_flags = %args ? to_sflags(\%args) : 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 316 | 0 | my $ring = ring; | |||||||||||||||||||||||||||
| 317 | 0 | ▶ | $ring->submit if $args{timeout} && $ring->sq_space_left < 2; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$args{"timeout"} and $ring->sq_space_left < 2
MC/DC0%0/2
$args{"timeout"} and $ring->sq_space_left < 2
$args{"timeout"}
$ring->sq_space_left < 2
Truth table0%0/3
A and B
A= $args{"timeout"}B= $ring->sq_space_left < 2
| |||||||||||||||||||||||||||||
| 318 | 0 | ▶ | my $id = $ring->fstatx($self->{fh}, $flags, $mask, $stat, $s_flags, sub($res, $flags) { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 319 | 0 | ▶ | if ($res >= 0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 320 | 0 | $future->done($stat); | |||||||||||||||||||||||||||
| 321 | } else { | ||||||||||||||||||||||||||||
| 322 | 0 | $future->fail(Future::Uring::Exception->new('statx', $res, $sourcename, $line)); | |||||||||||||||||||||||||||
| 323 | } | ||||||||||||||||||||||||||||
| 324 | 0 | }); | |||||||||||||||||||||||||||
| 325 | 0 | ▶ | $future->on_cancel(sub { $ring->cancel($id, 0, 0) }) if $args{mutable}; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 326 | 0 | ▶ | add_timeout($ring, \%args) if $args{timeout}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 327 | 0 | return $future; | |||||||||||||||||||||||||||
| 328 | } | ||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||
| 330 | 0 | ▶ | sub sync($self, %args) { | ||||||||||||||||||||||||||
|
Subroutine
sync: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||
| 331 | 0 | my $future = Future::Uring::_Future->new; | |||||||||||||||||||||||||||
| 332 | 0 | my (undef, $sourcename, $line) = caller; | |||||||||||||||||||||||||||
| 333 | 0 | ▶ | my $flags = $args{datasync} ? IORING_FSYNC_DATASYNC : 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 334 | 0 | ▶ | my $s_flags = %args ? to_sflags(\%args) : 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 335 | 0 | my $ring = ring; | |||||||||||||||||||||||||||
| 336 | 0 | ▶ | $ring->submit if $args{timeout} && $ring->sq_space_left < 2; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$args{"timeout"} and $ring->sq_space_left < 2
MC/DC0%0/2
$args{"timeout"} and $ring->sq_space_left < 2
$args{"timeout"}
$ring->sq_space_left < 2
Truth table0%0/3
A and B
A= $args{"timeout"}B= $ring->sq_space_left < 2
| |||||||||||||||||||||||||||||
| 337 | 0 | ▶ | my $id = $ring->fsync($self->{fh}, $flags, $s_flags, sub($res, $flags) { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 338 | 0 | ▶ | if ($res < 0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 339 | 0 | $future->fail(Future::Uring::Exception->new('sync', $res, $sourcename, $line)); | |||||||||||||||||||||||||||
| 340 | } else { | ||||||||||||||||||||||||||||
| 341 | 0 | $future->done; | |||||||||||||||||||||||||||
| 342 | } | ||||||||||||||||||||||||||||
| 343 | 0 | }); | |||||||||||||||||||||||||||
| 344 | 0 | ▶ | $future->on_cancel(sub { $ring->cancel($id, 0, 0) }) if $args{mutable}; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 345 | 0 | ▶ | add_timeout($ring, \%args) if $args{timeout}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 346 | 0 | return $future; | |||||||||||||||||||||||||||
| 347 | } | ||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||
| 349 | 0 | ▶ | sub tee($self, $out, $nbytes, %args) { | ||||||||||||||||||||||||||
|
Subroutine
tee: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||
| 350 | 0 | my $future = Future::Uring::_Future->new; | |||||||||||||||||||||||||||
| 351 | 0 | my (undef, $sourcename, $line) = caller; | |||||||||||||||||||||||||||
| 352 | 0 | ▶ | my $fh = $out->isa('Future::Uring::Handle') ? $out->inner : $out; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 353 | 0 | ▶ | my $s_flags = %args ? to_sflags(\%args) : 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 354 | 0 | my $ring = ring; | |||||||||||||||||||||||||||
| 355 | 0 | ▶ | $ring->submit if $args{timeout} && $ring->sq_space_left < 2; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$args{"timeout"} and $ring->sq_space_left < 2
MC/DC0%0/2
$args{"timeout"} and $ring->sq_space_left < 2
$args{"timeout"}
$ring->sq_space_left < 2
Truth table0%0/3
A and B
A= $args{"timeout"}B= $ring->sq_space_left < 2
| |||||||||||||||||||||||||||||
| 356 | 0 | ▶ | my $id = $ring->tee($self->{fh}, $fh, $nbytes, 0, $s_flags, sub($res, $flags) { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 357 | 0 | ▶ | if ($res < 0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 358 | 0 | $future->fail(Future::Uring::Exception->new('tee', $res, $sourcename, $line)); | |||||||||||||||||||||||||||
| 359 | } else { | ||||||||||||||||||||||||||||
| 360 | 0 | $future->done; | |||||||||||||||||||||||||||
| 361 | } | ||||||||||||||||||||||||||||
| 362 | 0 | }); | |||||||||||||||||||||||||||
| 363 | 0 | ▶ | $future->on_cancel(sub { $ring->cancel($id, 0, 0) }) if $args{mutable}; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 364 | 0 | ▶ | add_timeout($ring, \%args) if $args{timeout}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 365 | 0 | return $future; | |||||||||||||||||||||||||||
| 366 | } | ||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||
| 368 | 0 | ▶ | sub truncate($self, $length, %args) { | ||||||||||||||||||||||||||
|
Subroutine
truncate: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||
| 369 | 0 | my $future = Future::Uring::_Future->new; | |||||||||||||||||||||||||||
| 370 | 0 | my (undef, $sourcename, $line) = caller; | |||||||||||||||||||||||||||
| 371 | 0 | ▶ | my $s_flags = %args ? to_sflags(\%args) : 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 372 | 0 | my $ring = ring; | |||||||||||||||||||||||||||
| 373 | 0 | ▶ | $ring->submit if $args{timeout} && $ring->sq_space_left < 2; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$args{"timeout"} and $ring->sq_space_left < 2
MC/DC0%0/2
$args{"timeout"} and $ring->sq_space_left < 2
$args{"timeout"}
$ring->sq_space_left < 2
Truth table0%0/3
A and B
A= $args{"timeout"}B= $ring->sq_space_left < 2
| |||||||||||||||||||||||||||||
| 374 | 0 | ▶ | my $id = $ring->ftruncate($self->{fh}, $length, $s_flags, sub($res, $flags) { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 375 | 0 | ▶ | if ($res < 0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 376 | 0 | $future->fail(Future::Uring::Exception->new('truncate', $res, $sourcename, $line)); | |||||||||||||||||||||||||||
| 377 | } else { | ||||||||||||||||||||||||||||
| 378 | 0 | $future->done; | |||||||||||||||||||||||||||
| 379 | } | ||||||||||||||||||||||||||||
| 380 | 0 | }); | |||||||||||||||||||||||||||
| 381 | 0 | ▶ | $future->on_cancel(sub { $ring->cancel($id, 0, 0) }) if $args{mutable}; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 382 | 0 | ▶ | add_timeout($ring, \%args) if $args{timeout}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 383 | 0 | return $future; | |||||||||||||||||||||||||||
| 384 | } | ||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||
| 386 | 2 | ▶ | sub write($self, $buffer, %args) { | ||||||||||||||||||||||||||
|
Subroutine
write: called CC=7 SCAR=33.5
Pod
documented
| |||||||||||||||||||||||||||||
| 387 | 2 | my $future = Future::Uring::_Future->new; | |||||||||||||||||||||||||||
| 388 | 2 | my (undef, $sourcename, $line) = caller; | |||||||||||||||||||||||||||
| 389 | 2 | ▶ | my $offset = $args{offset} // -1; | ||||||||||||||||||||||||||
|
Condition50%1/2
$args{"offset"} // -1
MC/DC0%0/1
$args{"offset"} // -1
$args{"offset"}
Truth table50%1/2
A
A= $args{"offset"}
| |||||||||||||||||||||||||||||
| 390 | 2 | ▶ | my $s_flags = %args ? to_sflags(\%args) : 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 391 | 2 | my $ring = ring; | |||||||||||||||||||||||||||
| 392 | 0 | ▶ | $ring->submit if $args{timeout} && $ring->sq_space_left < 2; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$args{"timeout"} and $ring->sq_space_left < 2
MC/DC0%0/2
$args{"timeout"} and $ring->sq_space_left < 2
$args{"timeout"}
$ring->sq_space_left < 2
Truth table0%0/3
A and B
A= $args{"timeout"}B= $ring->sq_space_left < 2
| |||||||||||||||||||||||||||||
| 393 | 0 | ▶ | my $id = $ring->write($self->{fh}, $buffer, $offset, $s_flags, sub($res, $flags) { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 394 | 0 | ▶ | if ($res >= 0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 395 | 0 | $future->done($res); | |||||||||||||||||||||||||||
| 396 | } else { | ||||||||||||||||||||||||||||
| 397 | 0 | $future->fail(Future::Uring::Exception->new('write', $res, $sourcename, $line)); | |||||||||||||||||||||||||||
| 398 | } | ||||||||||||||||||||||||||||
| 399 | 0 | }); | |||||||||||||||||||||||||||
| 400 | 0 | ▶ | $future->on_cancel(sub { $ring->cancel($id, 0, 0) }) if $args{mutable}; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 401 | 0 | ▶ | add_timeout($ring, \%args) if $args{timeout}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 402 | 0 | return $future; | |||||||||||||||||||||||||||
| 403 | } | ||||||||||||||||||||||||||||
| 404 | |||||||||||||||||||||||||||||
| 405 | package | ||||||||||||||||||||||||||||
| 406 | Future::Uring::_PollFuture; | ||||||||||||||||||||||||||||
| 407 | |||||||||||||||||||||||||||||
| 408 | 5 | ▶ | use parent -norequire, 'Future::Uring::_Future'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||
| 410 | 5 | ▶ | use IO::Uring qw/IORING_POLL_UPDATE_EVENTS/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 411 | 5 | ▶ | use IO::Poll qw/POLLIN POLLOUT/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||
| 413 | 0 | ▶ | sub update($original, %args) { | ||||||||||||||||||||||||||
|
Subroutine
update: not called CC=9 SCAR=45.0
| |||||||||||||||||||||||||||||
| 414 | 0 | my $future = Future::Uring::_Future->new; | |||||||||||||||||||||||||||
| 415 | 0 | my (undef, $sourcename, $line) = caller; | |||||||||||||||||||||||||||
| 416 | 0 | my $old_id = $original->udata('uring_id'); | |||||||||||||||||||||||||||
| 417 | 0 | ▶ | my $s_flags = %args ? to_sflags(\%args) : 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 418 | 0 | ▶ | my $mask = $args{mask} // 0; | ||||||||||||||||||||||||||
|
Condition0%0/2
$args{"mask"} // 0
MC/DC0%0/1
$args{"mask"} // 0
$args{"mask"}
Truth table0%0/2
A
A= $args{"mask"}
| |||||||||||||||||||||||||||||
| 419 | 0 | ▶ | $mask |= POLLIN if $args{read}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 420 | 0 | ▶ | $mask |= POLLOUT if $args{write}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 421 | 0 | my $ring = Future::Uring::ring(); | |||||||||||||||||||||||||||
| 422 | 0 | ▶ | $ring->submit if $args{timeout} && $ring->sq_space_left < 2; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$args{"timeout"} and $ring->sq_space_left < 2
MC/DC0%0/2
$args{"timeout"} and $ring->sq_space_left < 2
$args{"timeout"}
$ring->sq_space_left < 2
Truth table0%0/3
A and B
A= $args{"timeout"}B= $ring->sq_space_left < 2
| |||||||||||||||||||||||||||||
| 423 | 0 | ▶ | my $id = $ring->poll_update($old_id, undef, $mask, IORING_POLL_UPDATE_EVENTS, $s_flags, sub($res, $flags) { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 424 | 0 | ▶ | if ($res < 0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 425 | 0 | $future->fail(Future::Uring::Exception->new('poll_update', $res, $sourcename, $line)); | |||||||||||||||||||||||||||
| 426 | } else { | ||||||||||||||||||||||||||||
| 427 | 0 | $future->done; | |||||||||||||||||||||||||||
| 428 | } | ||||||||||||||||||||||||||||
| 429 | 0 | }); | |||||||||||||||||||||||||||
| 430 | 0 | ▶ | $future->on_cancel(sub { $ring->cancel($id, 0, 0) }) if $args{mutable}; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 431 | 0 | ▶ | add_timeout($ring, \%args) if $args{timeout}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 432 | 0 | return $future; | |||||||||||||||||||||||||||
| 433 | } | ||||||||||||||||||||||||||||
| 434 | |||||||||||||||||||||||||||||
| 435 | 5 | 1; | |||||||||||||||||||||||||||
| 436 | |||||||||||||||||||||||||||||
| 437 | # ABSTRACT: A Uring filehandle | ||||||||||||||||||||||||||||
| 438 | |||||||||||||||||||||||||||||
| 439 | __END__ | ||||||||||||||||||||||||||||