line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Linux::Perl; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=encoding utf-8 |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 NAME |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
Linux::Perl - Linux system calls with pure Perl |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 SYNOPSIS |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
my $efd = Linux::Perl::eventfd->new(); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
#...or, if you know your architecture: |
14
|
|
|
|
|
|
|
my $efd = Linux::Perl::eventfd::x86_64->new(); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 DESCRIPTION |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
In memory-sensitive environments it is useful to minimize the number |
19
|
|
|
|
|
|
|
of XS modules that Perl loads. Oftentimes the CPAN modules that implement |
20
|
|
|
|
|
|
|
support for various Linux system calls, though, will bring in XS for the |
21
|
|
|
|
|
|
|
sake of writing platform-neutral code. |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
Linux::Perl accommodates use cases where platform neutrality is less of |
24
|
|
|
|
|
|
|
a concern than minimizing memory usage. |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 MODULES |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
Each family of system calls lives in its own namespace under C: |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=over |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=item * L |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=item * L |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=item * L |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=back |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
The distribution contains a number of other modules, none of which is |
41
|
|
|
|
|
|
|
intended for outside use. |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 PLATFORM-SPECIFIC INVOCATION |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
Each Linux::Perl system call implementation can be called with a |
46
|
|
|
|
|
|
|
platform-neutral syntax as well as with a platform-specific one: |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
my $efd = Linux::Perl::eventfd->new(); |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
my $efd = Linux::Perl::eventfd::x86_64->new(); |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
The platform-specific call is a bit lighter because it avoids loading |
53
|
|
|
|
|
|
|
L to determine the current platform. |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 PLATFORM SUPPORT |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
The following platforms are supported: |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=over |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=item * x86_64 (i.e., 64-bit Intel/AMD) |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
This is probably the only platform that will foreseeably receive substantial |
64
|
|
|
|
|
|
|
testing during development. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=item * i386 (32-bit Intel/AMD) |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=back |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Support for adding new platforms is usually trivial; just send a pull request. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=cut |
73
|
|
|
|
|
|
|
|
74
|
8
|
|
|
8
|
|
47
|
use strict; |
|
8
|
|
|
|
|
9
|
|
|
8
|
|
|
|
|
190
|
|
75
|
8
|
|
|
8
|
|
37
|
use warnings; |
|
8
|
|
|
|
|
18
|
|
|
8
|
|
|
|
|
178
|
|
76
|
|
|
|
|
|
|
|
77
|
8
|
|
|
8
|
|
2675
|
use Linux::Perl::X (); |
|
8
|
|
|
|
|
19
|
|
|
8
|
|
|
|
|
814
|
|
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
our $VERSION = '0.01-TRIAL4'; |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub call { |
82
|
40
|
|
|
40
|
0
|
223
|
local $!; |
83
|
40
|
|
|
|
|
414468
|
my $ok = syscall(0 + $_[0], @_[1 .. $#_]); |
84
|
40
|
50
|
|
|
|
194
|
if ($ok == -1) { |
85
|
0
|
|
|
|
|
0
|
die Linux::Perl::X->create('Call', $_[0], $!); |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
40
|
|
|
|
|
200
|
return $ok; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 REPOSITORY |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
L |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 AUTHOR |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Felipe Gasper (FELIPE) |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 COPYRIGHT |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Copyright 2018 by L |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 LICENSE |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
This distribution is released under the same license as Perl. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=cut |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
1; |