softlimit, hardlimit — change resource limit then chain
softlimit
[limits
...] {next-prog
}
hardlimit
[limits
...] {next-prog
}
softlimit and hardlimit are chain-loading utilities that change their soft/hard resource limits and then chain load to next-prog
with the execvp(3) function.
next-prog
may contain its own command line options, which softlimit and hardlimit will ignore.
The following limit options are available:
bytes
]sets RLIMIT_AS
, RLIMIT_DATA
, RLIMIT_MEMLOCK
, and RLIMIT_STACK
bytes
]sets RLIMIT_AS
bytes
]sets RLIMIT_CORE
bytes
]sets RLIMIT_DATA
bytes
]sets RLIMIT_FSIZE
bytes
]sets RLIMIT_MEMLOCK
n
]sets RLIMIT_NOFILE
n
]sets RLIMIT_NPROC
n
]sets RLIMIT_RSS
bytes
]sets RLIMIT_STACK
seconds
]sets RLIMIT_CPU
See setrlimit(2) for an explanation of the effects of these limits and the privileges that are sometimes required.
To set an "infinite" limit, use the text unlimited
for the limit value.
Similarly, the text =
or hard
will use the current value of the hard limit as the value.
(This provides a simple means of setting the soft limit to the hard limit ceiling without knowing its current value.)
An attempt to set the hard limit below the soft limit, or to set a non-infinite hard limit when the soft limit is infinite, will be silently converted into setting the soft limit equal to the hard limit being set.
Special treatment is given to the -m option because it sets multiple limits at once. An attempt to set any one soft limit greater than the matching hard limit will be silently converted into an attempt to set the soft limit equal to the hard limit.
For limits that are set as bytes: the bytes
value can be suffixed with the SI abbreviations k
, M
, G
, or T
denoting the relevant power of 10; or alternatively can be suffixed with the IEEE/IEC abbreviations Ki
, Mi
, Gi
, and Ti
denoting the relevant power of 2.
For limits that are set as seconds: the seconds
value can be suffixed with the SI or IEEE/IEC abbreviations; or alternatively with m
/minute
/minutes
, h
/hour
/hours
, d
/day
/days
, or w
/week
/weeks
denoting minutes, hours, days, or weeks respectively.
All suffixes are case-sensitive.
For a command with coarser granularity, that can set soft and hard limits in one operation, see ulimit(1).