os.path.walk(self.dir, add_to_cache, self.cache)
+def adjust_lim(goal, curr):
+ gh = goal[0]
+ gs = goal[1]
+ gm = goal[2]
+ soft = curr[0]
+ hard = curr[1]
+ if gm != VC_LIM_KEEP:
+ if gm > soft:
+ soft = gm
+ if gm > hard:
+ hard = gm
+ if gs != VC_LIM_KEEP:
+ if gs > soft:
+ soft = gs
+ if gh != VC_LIM_KEEP:
+ if gh > hard:
+ hard = gh
+ return (soft, hard)
+
+
class VServer:
INITSCRIPTS = [('/etc/rc.vinit', 'start'),
resource_type = RLIMITS[type]
try:
vserverimpl.setrlimit(self.ctx, resource_type, hard, soft, min)
+ lim = resource.getrlimit(resource_type)
+ lim = adjust_lim((hard, soft, min), lim)
+ resource.setrlimit(resource_type, lim)
except OSError, e:
self.log("Error: setrlimit(%d, %s, %d, %d, %d): %s"
% (self.ctx, type.lower(), hard, soft, min))