-static inline int __vx_cres_avail(struct vx_info *vxi,
- int res, int num, char *_file, int _line)
-{
- unsigned long value;
-
- if (VXD_RLIMIT(res, RLIMIT_NOFILE) ||
- VXD_RLIMIT(res, RLIMIT_NPROC) ||
- VXD_RLIMIT(res, VLIMIT_NSOCK) ||
- VXD_RLIMIT(res, VLIMIT_OPENFD))
- vxlprintk(1, "vx_cres_avail[%5d,%s,%2d]: %5ld > %5d + %5d",
- (vxi?vxi->vx_id:-1), vlimit_name[res], res,
- (vxi?vxi->limit.rlim[res]:1),
- (vxi?atomic_read(&vxi->limit.rcur[res]):0),
- num, _file, _line);
- if (!vxi)
- return 1;
- value = atomic_read(&vxi->limit.rcur[res]);
- if (value > vxi->limit.rmax[res])
- vxi->limit.rmax[res] = value;
- if (vxi->limit.rlim[res] == RLIM_INFINITY)
- return 1;
- if (value + num <= vxi->limit.rlim[res])
- return 1;
- atomic_inc(&vxi->limit.lhit[res]);
- return 0;
-}