Tyler MacDonald > Sys-Mlockall-0.01 > Sys::Mlockall

Download:
Sys-Mlockall-0.01.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.01   Source  

NAME ^

Sys::Mlockall - Prevent this process's memory from being placed in swap.

SYNOPSIS ^

use Sys::Mlockall qw(:all);

if(mlockall(MCL_CURRENT | MCL_FUTURE) != 0) { die "Failed to lock RAM: $!"; }

[memory will not be swapped from here on out]

DESCRIPTION ^

This module provides a quick-and-dirty interface to the mlockall() and munlockall() system calls. mlockall() can be used to prevent your process's memory from being placed in swap, which can be useful for scripts that deal with sensitive information (passwords / RSA keys / stardrive plans / etc).

EXPORTS ^

Please see mlockall(2) for documentation on these. Their calling convention and return value are exactly the same, and errno will, by perl convention, be stored in $!.

mlockall()
munlockall()
MCL_CURRENT
MCL_FUTURE

NOTES ^

By default, linux systems have the resource limit RLIMIT_MAXLOCK set to 64kb, which is insufficient for running perl scripts. The unit tests require root permissions to boost that limit to 32MB; in production, you may want to use the "ulimit" commanad, or add a rule to /etc/security/limits.conf (or /etc/security/limits.d/ if supported).

LICENSE ^

You may use this module under the same terms as perl itself.

MAINTAINER ^

Tyler MacDonald <japh@crackerjack.net>

syntax highlighting: