| CfgTie documentation | Contained in the CfgTie distribution. |
CfgTie::TieRsrc -- an associative array of resources and their usage limits
This module makes the resource limits available as a regular hash
tie %Resources,'CfgTie::TieRsrc'
This is a straightforward hash tie that allows us to access the user database sanely.
The resource limits for the system.
Note: this requires that BSD::Resource be installed.
It is a hash reference. The keys may be any of cpu, data, stack,
core, rss, memlock, nproc, nofile, open_max, as, vmem,
nlimits, infinity. The values are always list references of the form:
[$soft, $hard]
CfgTie::Cfgfile, CfgTie::TieAliases, CfgTie::TieGeneric, CfgTie::TieGroup,CfgTie::TieHost, CfgTie::TieMTab, CfgTie::TieNamed,CfgTie::TieNet, CfgTie::TiePh, CfgTie::TieProto,CfgTie::TieRCService,CfgTie::TieServ, CfgTie::TieShadow
Randall Maas (mailto:randym@acm.org, http://www.hamline.edu/~rcmaas/)
| CfgTie documentation | Contained in the CfgTie distribution. |
#!/usr/bin/perl -Tw #Copyright 1998-2001, Randall Maas. All rights reserved. This program is free #software; you can redistribute it and/or modify it under the same terms as #PERL itself. package CfgTie::TieRsrc;
my $Ok=0; if (eval("use BSD::Resource;")) {$Ok=1;} my $K= { cpu =>RLIMIT_CPU, fsize=>RLIMIT_FSIZE, data =>RLIMIT_DATA, stack=>RLIMIT_STACK, core =>RLIMIT_CORE, rss =>RLIMIT_RSS, memlock=>RLIMIT_MEMLOCK, nproc =>RLIMIT_NPROC, nofile =>RLIMIT_NOFILE, open_max=>RLIMIT_OPEN_MAX, as =>RLIMIT_AS, vmem =>RLIMIT_VMEM, nlimits =>RLIMIT_NLIMITS, infinity=>RLIMIT_INFINITY, }; 1; sub TIEHASH { if (!$Ok) {return undef;} return bless {}, $_[0]; } sub FETCH { #Get the limits setting from the system getrlimits($_[0]->{id},$->{$_[1]}); } sub STORE { #Pass the rlimits setting onto the system setrlimits($K->{$_[1]}, $_[2]->[0],$_[2]->[1]); }