POSIX::1003::Limit - POSIX access to ulimit and rlimit
POSIX::1003::Limit is a POSIX::1003::Module
# ULIMIT support use POSIX::1003::Limit; # load all names use POSIX::1003::Limit qw(ulimit); # keys are strings! $size = ulimit('UL_GETFSIZE'); use POSIX::1003::Limit qw(ulimit UL_GETFSIZE); $size = UL_GETFSIZE; # constants are subs use POSIX::1003::Limit '%ulimit'; my $key = $ulimit{UL_GETFSIZE}; $ulimit{_SC_NEW_KEY} = $key_code; $size = ulimit($key); print "$_\n" for keys %ulimit; # RLIMIT support use POSIX::1003::Limit ':rlimit'; my ($cur, $max, $success) = getrlimit('RLIMIT_CORE'); my ($cur, $max) = getrlimit('RLIMIT_CORE'); my $cur = RLIMIT_CORE; my $success = setrlimit('RLIMIT_CORE', 1e6, 1e8); setrlimit('RLIMIT_CORE', 1e6) or die; setrlimit('RLIMIT_CORE', RLIM_SAVED_MAX, RLIM_INFINITY); RLIMIT_CORE(1e6, 1e8);
This module provides access to the "ulimit" (user limit) and "rlimit" (resource limit) handling. On most systems, ulimit() is succeeded by rlimit() hence provides a very limited set of features.
ulimit()
rlimit()
See documentation in base class.
See "METHODS" in POSIX::1003::Module
my ($cur, $max, $success) = getrlimit('RLIMIT_CORE'); my ($cur, $max) = getrlimit('RLIMIT_CORE');
my $success = setrlimit('RLIMIT_CORE', 1e6, 1e8);
Returns the ulimit value related to the NAMEd constant. The NAME must be a string. undef will be returned when the NAME is not known by the system.
undef
my $filesize = ulimit('UL_GETFSIZE') || SSIZE_MAX;
Returns a list with all known resource names, unsorted.
Returns a list with all known names, unsorted.
This exported variable is a tied HASH which maps UL_* names on unique numbers, to be used with ulimit().
UL_*
This exported variable is a tied HASH which maps RLIMIT_* names on unique numbers, to be used with getrlimit() and setrlimit().
RLIMIT_*
The following constants where detected on your system when the module got installed. The second column shows the value which where returned at that time.
For ulimit, with a value when it is a getter:
UL_GETFSIZE 9223372036854775807 UL_GETMAXBRK undef UL_GETOPENMAX 1024 UL_SETFSIZE (setter)
The constant names for rlimit, with the soft and hard limits that getrlimit() returned during installation of the module.
RLIMIT_AS 18446744073709551615, 18446744073709551615 RLIMIT_CORE 0, 18446744073709551615 RLIMIT_CPU 18446744073709551615, 18446744073709551615 RLIMIT_DATA 18446744073709551615, 18446744073709551615 RLIMIT_FSIZE 18446744073709551615, 18446744073709551615 RLIMIT_LOCKS 18446744073709551615, 18446744073709551615 RLIMIT_MEMLOCK 65536, 65536 RLIMIT_MSGQUEUE 819200, 819200 RLIMIT_NICE 0, 0 RLIMIT_NLIMITS 0, 15 RLIMIT_NOFILE 1024, 4096 RLIMIT_NPROC 61461, 61461 RLIMIT_OFILE 1024, 4096 RLIMIT_RSS 18446744073709551615, 18446744073709551615 RLIMIT_RTPRIO 0, 0 RLIMIT_RTTIME 18446744073709551615, 18446744073709551615 RLIMIT_SIGPENDING 61461, 61461 RLIMIT_STACK 8388608, 18446744073709551615
This module is part of POSIX-1003 distribution version 0.94_3, built on June 10, 2013. Website: http://perl.overmeer.net. The code is based on POSIX, which is released with Perl itself. See also POSIX::Util for additional functionality.
Copyrights 2011-2013 on the perl code and the related documentation by [Mark Overmeer]. For other contributors see ChangeLog.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://www.perl.com/perl/misc/Artistic.html
To install POSIX::1003, copy and paste the appropriate command in to your terminal.
cpanm
cpanm POSIX::1003
CPAN shell
perl -MCPAN -e shell install POSIX::1003
For more information on module installation, please visit the detailed CPAN module installation guide.