NAME

Linux::Perl::memfd

SYNOPSIS

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 );

DESCRIPTION

This is a Perl interface to memfd.

See man 2 memfd_create for more details about this functionality.

METHODS

CLASS->new( %OPTS )

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.

  • flags: Optional, may contain any or all of: 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.