runlimit(8)

NAME
runlimit - run a program with new resource limits

SYNOPSIS
runlimit [-hV] [ opts ] program [ args ... ]

DESCRIPTION
runlimit sets up an environment with new resource limits as given by opts, then runs program with any additional args.

If program does not contain a ``/'' slash character, runlimit will perform a shell-like search for the executable using the PATH variable in the current environment.

OPTIONS
For each of the following resource limit options in opts, runlimit calls setrlimit(2) to setup the corresponding soft resource limit. Normally the argument to each option is a positive decimal integer. An argument of `=' or `^' may be given to set the soft limit equal to the current hard limit. Any resource limit specified that is greater than its hard limit is truncated to the hard limit.

-E  Environment. Resource parameters are scanned from the current environment in the form r=v, where r is any RLIMIT_* resource name as defined for getrlimit(2) and described below, and v is the value used to set the corresponding resource limit. The -E option may be combined with -F or other options. Any resource limit set with a command-line option, or read from a file with the -F option, takes precedence over the environment.

-F file
    File-defined. Resource limits are taken from file, a plain-text file with one or more non-empty lines of the form r=v, where r is any RLIMIT_* resource name as defined for getrlimit(2) and described below, and v is the value used to set the corresponding resource limit. Empty lines and lines beginning with `#' are ignored. Leading and trailing whitespace is trimmed from both r and v. The -F option may be combined with -E or other options. Any resource limit set with a command-line option takes precedence over a file-defined limit.

-a availmem
    Total available memory (in bytes). Resource parameter RLIMIT_AS and/or RLIMIT_VMEM (used synonymously).

-c coresize
    Maximum size of a core file (in bytes). Resource parameter RLIMIT_CORE. An argument of 0 will suppress core files.

-d databytes
    Maximum data segment (in bytes). Resource parameter RLIMIT_DATA.

-f filesize
    Maximum size for any file that may be created (in bytes). Resource parameter RLIMIT_FSIZE.

-l lockbytes
    Maximum memory that may be locked by mlock(2) (in bytes). Resource parameter RLIMIT_MEMLOCK.

-m bytes
    Combines the options -a -d -l and -s (in bytes).

-o files
    Maximum number of open files (in number of files). Resource parameter RLIMIT_NOFILE.

-p processes
    Maximum number of processes per uid (in number of processes). Resource parameter RLIMIT_NPROC.

-r rssbytes
    Maximum resident memory (in bytes). Resource parameter RLIMIT_RSS.

-s stackbytes
    Maximum stack size (in bytes). Resource parameter RLIMIT_STACK. -t secs Maximum CPU time per process (in seconds). Resource parameter RLIMIT_CPU.

runlimit also provides the following standard runtools_intro(8) options:

-h  Help. Print a brief usage message to stderr and exit.

-V  Version. Print the version number to stderr and exit.

EXIT STATUS
runlimit exits with one of the following values:

0   program was invoked and completed successfully. In this case, the exit code is returned by the program, rather than by runlimit itself.

100 runlimit failed because of a usage error, such as an invalid command-line option or argument. In this case, runlimit prints a brief error message and usage help to stderr on exit.

111 runlimit failed due to some system or resource error. In this case, runlimit prints a brief diagnostic message to stderr on exit.

1-127
    program was invoked and failed with its own non-zero exit status.

CAVEATS
Not all resource limits are supported on all platforms.

(The source distribution includes a catlimits(8) utility that will show the current resource limits, indicating any that are not supported on the host platform.)

AUTHOR
Wayne Marshall, http://b0llix.net/perp/

SEE ALSO
setrlimit(2), runtools_intro(8), runargs(8), runargv0(8), runchoom(8), rundetach(8), rundeux(8), runenv(8), runfile(8), runlock(8), runpause(8), runsession(8), runtool(8), runtrap(8), runuid(8)