softlimit hardlimit 1 user commands nosh
softlimit hardlimit change resource limit then chain
`softlimit` limits next-prog `hardlimit` limits next-prog

## Description

`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:

-m bytes

  sets `RLIMIT_AS`, `RLIMIT_DATA`, `RLIMIT_MEMLOCK`, and `RLIMIT_STACK`

-a bytes

  sets `RLIMIT_AS`

-c bytes

  sets `RLIMIT_CORE`

-d bytes

  sets `RLIMIT_DATA`

-f bytes

  sets `RLIMIT_FSIZE`

-l bytes

  sets `RLIMIT_MEMLOCK`

-o n

  sets `RLIMIT_NOFILE`

-p n

  sets `RLIMIT_NPROC`

-r n

  sets `RLIMIT_RSS`

-s bytes

  sets `RLIMIT_STACK`

-t 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.

## Author

Jonathan de Boyne Pollard