Perl.pm

filter: Statementstmt 94.4% 17 / 18 Branchbran 50.0% 1 / 2 Conditioncond 66.6% 2 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 4 / 4 Podpod 0.0% 0 / 1 totaltotal 80.0% 24 / 30 CC 3 SCAR 7.4
CC
3
Cov
87%
call
3.2
BEGIN
1.0
BEGIN
1.0
CRAP 2.1
« Perl/Base/TimerEventFD.pm ↑ Summary Perl/X/Base.pm »
1 package Linux::Perl;
2  
3 43 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 43 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 =encoding utf-8
7  
8 =head1 NAME
9  
10 Linux::Perl - Linux system calls with pure Perl
11  
12 =head1 SYNOPSIS
13  
14 my $efd = Linux::Perl::eventfd->new();
15  
16 #...or, if you know your architecture:
17 my $efd = Linux::Perl::eventfd::x86_64->new();
18  
19 =head1 DESCRIPTION
20  
21 Linux::Perl’s goal is to provide, without use of XS, feature-complete
22 implementations of Linux kernel features that the Perl interpreter does
23 not expose.
24  
25 In memory-sensitive environments it is useful to minimize the number
26 of XS modules that Perl loads. Oftentimes the CPAN modules that implement
27 support for various Linux system calls, though, will bring in XS for the
28 sake of writing platform-neutral code.
29  
30 Linux::Perl accommodates use cases where platform neutrality is less of
31 a concern than minimizing memory usage.
32  
33 =head1 MODULES
34  
35 Each family of system calls lives in its own namespace under C<Linux::Perl>:
36  
37 =over
38  
39 =item * L<Linux::Perl::epoll>
40  
41 =item * L<Linux::Perl::inotify>
42  
43 =item * L<Linux::Perl::eventfd>
44  
45 =item * L<Linux::Perl::getrandom>
46  
47 =item * L<Linux::Perl::timerfd>
48  
49 =item * L<Linux::Perl::memfd>
50  
51 =item * L<Linux::Perl::signalfd>
52  
53 =item * L<Linux::Perl::sigprocmask>
54  
55 =item * L<Linux::Perl::aio>
56  
57 =item * L<Linux::Perl::uname>
58  
59 =item * L<Linux::Perl::getdents>
60  
61 =item * L<Linux::Perl::mq>
62  
63 =item * L<Linux::Perl::sendmsg>
64  
65 =item * L<Linux::Perl::prlimit>
66  
67 =back
68  
69 The distribution contains a number of other modules, none of which is
70 currently intended for outside use.
71  
72 =head1 PLATFORM-SPECIFIC INVOCATION
73  
74 Linux::Perl achieves functionality by hard-coding each supported platform’s
75 number for each required system call. As a consequence, any new platforms’
76 system calls will need to be added manually.
77  
78 To allow optimization for portability or efficiency, each implementation
79 can be called with a platform-neutral syntax as well as with a
80 platform-specific one; for example:
81  
82 my $efd = Linux::Perl::eventfd->new();
83  
84 my $efd = Linux::Perl::eventfd::x86_64->new();
85  
86 The platform-specific call is a bit lighter because it avoids loading
87 L<Config> to determine the current platform.
88  
89 =head1 PLATFORM SUPPORT
90  
91 C<x86_64> and C<arm> are the best-supported platforms. C<i686> and C<i386>
92 also have some support.
93  
94 Support for adding new platforms just involves adding new modules with the
95 necessary constants to the distribution.
96  
97 Note also that a 64-bit Perl is generally assumed.
98  
99 =cut
100  
101 43 ▶use Linux::Perl::X ();
Subroutine BEGIN: called CC=1 SCAR=0.0
102  
103 43 our $VERSION = '0.16-TRIAL5';
104  
105 43 our @_TOLERATE_ERRNO;
106  
107 195 ▶sub call {
Subroutine call: called CC=3 SCAR=11.6
Pod undocumented
108 195 local $!;
109 195 my $ok = syscall(0 + $_[0], @_[1 .. $#_]);
110 195 ▶ if ($ok == -1 && !grep { $_ == $! } @_TOLERATE_ERRNO) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ok == -1 and not grep({$_ == $!;} @Linux::Perl::_TOLERATE_ERRNO)) 0 195 195
Condition66%2/3
$ok == -1 and not grep({$_ == $!;} @Linux::Perl::_TOLERATE_ERRNO)
!ll&&!rl&&r
19140
MC/DC0%0/2
$ok == -1 and not grep({$_ == $!;} @Linux::Perl::_TOLERATE_ERRNO)
$ok == -1 not grep({$_ == $!;} @Linux::Perl::_TOLERATE_ERRNO)
Truth table66%2/3
A and not(B)
A= $ok == -1B= not grep({$_ == $!;} @Linux::Perl::_TOLERATE_ERRNO)
ABresult
0X0
100
111
111 0 die Linux::Perl::X->create('Call', $_[0], $!);
112 }
113  
114 195 return $ok;
115 }
116  
117 =head1 REPOSITORY
118  
119 L<https://github.com/FGasper/p5-Linux-Perl>
120  
121 =head1 AUTHOR
122  
123 Felipe Gasper (FELIPE)
124  
125 =head1 COPYRIGHT
126  
127 Copyright 2018 by L<Gasper Software Consulting|http://gaspersoftware.com>
128  
129 =head1 LICENSE
130  
131 This distribution is released under the same license as Perl.
132  
133 =cut
134  
135 43 1;
« Perl/Base/TimerEventFD.pm ↑ Summary Perl/X/Base.pm »