Module posix.sys.resource

Control Maximum System Resource Consumption.

Functions

getrlimit (resource) Get resource limits for this process.
setrlimit (resource[, softlimit[, hardlimit]]) Set a resource limit for subsequent child processes.

Tables

PosixRlimit Resource limit record.

Constants

posix.sys.resource Rlimit constants.


Functions

getrlimit (resource)
Get resource limits for this process.

Parameters:

  • resource int one of RLIMIT_CORE, RLIMIT_CPU, RLIMIT_DATA, RLIMIT_FSIZE, RLIMIT_NOFILE, RLIMIT_STACK or RLIMIT_AS

Returns:

  1. int softlimit
  2. int hardlimit, if successful

Or

  1. nil
  2. string error message
  3. int errnum

See also:

setrlimit (resource[, softlimit[, hardlimit]])
Set a resource limit for subsequent child processes.

Parameters:

  • resource string one of "core", "cpu", "data", "fsize", "nofile", "stack" or "as"
  • softlimit process may receive a signal when reached (optional)
  • hardlimit process may be terminated when reached (optional)

Returns:

    int 0, if successful

Or

  1. nil
  2. string error message
  3. int errnum

See also:

Usage:

    P.setrlimit ("nofile", 1000, 2000)

Tables

PosixRlimit
Resource limit record.

Fields:

  • rlim_cur int current soft limit
  • rlim_max int hard limit

Constants

posix.sys.resource
Rlimit constants.

Fields:

  • RLIM_INFINITY int unlimited resource usage
  • RLIM_SAVED_CUR int saved current resource soft limit
  • RLIM_SAVED_MAX int saved resource hard limit
  • RLIMIT_CORE int maximum bytes allowed for a core file
  • RLIMIT_CPU int maximum cputime secconds allowed per process
  • RLIMIT_DATA int maximum data segment bytes per process
  • RLIMIT_FSIZE int maximum bytes in any file
  • RLIMIT_NOFILE int maximum number of open files per process
  • RLIMIT_STACK int maximum stack segment bytes per process
  • RLIMIT_AS int maximum bytes total address space per process

Usage:

      -- Print resource constants supported on this host.
      for name, value in pairs (require "posix.sys.resource") do
        if type (value) == "number" then
          print (name, value)
         end
      end
generated by LDoc 1.4.3 Last updated 2015-01-04 12:06:34