Format
limit [–h]
[resource [maximum-use]]
Description
limit limits
the consumption by the current process and each process it creates
in order to not individually exceed maximum-use on the specified resource.
If no maximum-use is given, then the current
limit is printed; if no resource is given,
then all limitations are given. If the -h flag
is specified, the hard limits are used instead of the current limits.
The hard limits impose a ceiling on the values of the current limits.
All hard limits can be raised only by a process which has superuser
authority but a user can lower or raise the current limits within
the legal range. If a user attempts to make a soft limit "unlimited",
and their effective UID is not 0, then limit (or unlimit)
sets the soft limit to the current hard limit value.
Resources
include:
- addressspace
- The maximum address space size for the process, measured in kilobytes.
If the limit is exceeded, malloc() and mmap() functions will fail.
Also, automatic stack growth will fail. An attempt to set the address
space size limit lower than the current usage or higher than the existing
hard limit will fail.
- coredumpsize
- The size of the largest core dump file that will be created. A
value of 0 (zero) prevents file creation. Dump file creation will
stop at this limit.
- cputime
- The maximum amount of CPU time, in seconds, to be used by each
process. If the limit is exceeded, a SIGXCPU signal is sent to the
process and the process is granted a small CPU time extension to allow
for signal generation and delivery. If the extension is used up, the
process is terminated with a SIGKILL signal. An attempt to set the
CPU limit lower than that already used will fail.
- datasize
- The data size limit is the maximum size of the break value for
the process, in units of 1024 bytes. This resource always has unlimited
hard and soft limits.
- descriptors
- The maximum number of open file descriptors allowed for the process.
This number is one greater than the maximum value that can be assigned
to a newly created descriptor. Any function that attempts to create
a new file descriptor beyond the limit will fail. An attempt to set
the open file descriptors limit lower than that already used will
fail.
- filesize
- The largest single file which can be created by a process. A
value of 0 (zero) prevents file creation. If the size is exceeded,
a SIGXFSZ signal is sent to the process. If the process is blocking,
catching, or ignoring SIGXFSZ, continued attempts to increase the
size of a file beyond the limit will fail.
- memlimit
- The amount of storage, in megabytes, above the 2 gigabyte bar
that a process is allowed to have allocated and unhidden at any given
time. An attempt to set the storage size limit lower than the current
usage or higher than the existing hard limit will fail.
- stacksize
- The maximum size of the automatically-extended stack region for
a process. The stack is a per-thread resource that has unlimited hard
and soft limits.
maximum-use can be given
as a (floating point or integer) number followed by a scale factor.
For
cputime the default scaling is seconds,
while m for minutes or h for hours, or a time of the form mm:ss giving
minutes and seconds can be used. For
memlimit,
the default scaling is in megabytes. For all limits for which the
scale is not specified, the default scale is k or kilobytes (1024
bytes); a scale factor of m or megabytes can also be used.
For
both resource names and scale factors, unambiguous
prefixes of the names suffice.
Usage notes
If the command fails because
of an attempt to set a resource limit lower than the current amount
in use or higher than the existing hard limit, the resulting error
message might indicate an invalid argument.