Linux::Perl::memfd
my $fh = Linux::Perl::memfd->( name => 'whatever', #optional flags => ['CLOEXEC'], #optional huge_page_size => '64KB', #optional ); syswrite( $fh, 'some data' ); sysseek( $fh, 0, 0 ); sysread( $fh, my $buf, 9 );
This is a Perl interface to memfd.
See man 2 memfd_create for more details about this functionality.
man 2 memfd_create
Instantiates this class. Instances of the class are regular Perl file handle objects and can be interacted with as such.
%OPTS are:
name: Optional, as described in man 2 memfd_create. An empty string is used by default.
name
flags: Optional, may contain any or all of: CLOEXEC, ALLOW_SEALING.
flags
CLOEXEC
ALLOW_SEALING
huge_page_size: Optional, must be one of: 64KB, 512KB, 1MB, 2MB, 8MB, 16MB, 256MB, 1GB, 2GB, 16GB. Your kernel may or may not support this functionality.
huge_page_size
64KB
512KB
1MB
2MB
8MB
16MB
256MB
1GB
2GB
16GB
To install Linux::Perl, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Linux::Perl
CPAN shell
perl -MCPAN -e shell install Linux::Perl
For more information on module installation, please visit the detailed CPAN module installation guide.