<?xml version="1.0" encoding="UTF-8"?>
<!-- **************************************************************************
.... For copyright and licensing terms, see the file named COPYING.
.... **************************************************************************
.-->
<?xml-stylesheet href="docbook-xml.css" type="text/css"?>

<refentry id="softlimit">

<refmeta xmlns:xi="http://www.w3.org/2001/XInclude">
<refentrytitle>softlimit</refentrytitle>
<refentrytitle>hardlimit</refentrytitle>
<manvolnum>1</manvolnum>
<refmiscinfo class="manual">user commands</refmiscinfo>
<refmiscinfo class="source">nosh</refmiscinfo>
<xi:include href="version.xml" />
</refmeta>

<refnamediv>
<refname>softlimit</refname>
<refname>hardlimit</refname>
<refpurpose>change resource limit then chain</refpurpose>
</refnamediv>

<refsynopsisdiv>
<cmdsynopsis>
<command>softlimit</command>
<arg choice='opt' rep='repeat'><replaceable>limits</replaceable></arg>
<arg choice='req'><replaceable>next-prog</replaceable></arg>
</cmdsynopsis>
<cmdsynopsis>
<command>hardlimit</command>
<arg choice='opt' rep='repeat'><replaceable>limits</replaceable></arg>
<arg choice='req'><replaceable>next-prog</replaceable></arg>
</cmdsynopsis>
</refsynopsisdiv>

<refsection><title>Description</title>

<para>
<command>softlimit</command> and <command>hardlimit</command> are chain-loading utilities that change their soft/hard resource limits and then chain load to <replaceable>next-prog</replaceable> with the <citerefentry><refentrytitle>execvp</refentrytitle><manvolnum>3</manvolnum></citerefentry> function.
</para>

<para>
<replaceable>next-prog</replaceable> may contain its own command line options, which <command>softlimit</command> and <command>hardlimit</command> will ignore.
</para>

<para>
The following limit options are available:
</para>

<variablelist>

<varlistentry><term>
<arg>-m <replaceable>bytes</replaceable></arg></term><listitem><para>sets <code>RLIMIT_AS</code>, <code>RLIMIT_DATA</code>, <code>RLIMIT_MEMLOCK</code>, and <code>RLIMIT_STACK</code>
</para></listitem></varlistentry>

<varlistentry><term>
<arg>-a <replaceable>bytes</replaceable></arg></term><listitem><para>sets <code>RLIMIT_AS</code>
</para></listitem></varlistentry>

<varlistentry><term>
<arg>-c <replaceable>bytes</replaceable></arg></term><listitem><para>sets <code>RLIMIT_CORE</code>
</para></listitem></varlistentry>

<varlistentry><term>
<arg>-d <replaceable>bytes</replaceable></arg></term><listitem><para>sets <code>RLIMIT_DATA</code>
</para></listitem></varlistentry>

<varlistentry><term>
<arg>-f <replaceable>bytes</replaceable></arg></term><listitem><para>sets <code>RLIMIT_FSIZE</code>
</para></listitem></varlistentry>

<varlistentry><term>
<arg>-l <replaceable>bytes</replaceable></arg></term><listitem><para>sets <code>RLIMIT_MEMLOCK</code>
</para></listitem></varlistentry>

<varlistentry><term>
<arg>-o <replaceable>n</replaceable></arg></term><listitem><para>sets <code>RLIMIT_NOFILE</code>
</para></listitem></varlistentry>

<varlistentry><term>
<arg>-p <replaceable>n</replaceable></arg></term><listitem><para>sets <code>RLIMIT_NPROC</code>
</para></listitem></varlistentry>

<varlistentry><term>
<arg>-r <replaceable>n</replaceable></arg></term><listitem><para>sets <code>RLIMIT_RSS</code>
</para></listitem></varlistentry>

<varlistentry><term>
<arg>-s <replaceable>bytes</replaceable></arg></term><listitem><para>sets <code>RLIMIT_STACK</code>
</para></listitem></varlistentry>

<varlistentry><term>
<arg>-t <replaceable>seconds</replaceable></arg></term><listitem><para>sets <code>RLIMIT_CPU</code>
</para></listitem></varlistentry>

</variablelist>

<para>
See <citerefentry><refentrytitle>setrlimit</refentrytitle><manvolnum>2</manvolnum></citerefentry> for an explanation of the effects of these limits and the privileges that are sometimes required.
</para>

<para>
To set an "infinite" limit, use the text <code>unlimited</code> for the limit value.
Similarly, the text <code>=</code> or <code>hard</code> 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.)
</para>

<para>
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.
</para>

<para>
Special treatment is given to the <arg choice='plain'>-m</arg> 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.
</para>

<para>
For limits that are set as bytes: the <replaceable>bytes</replaceable> value can be suffixed with the SI abbreviations <code>k</code>, <code>M</code>, <code>G</code>, or <code>T</code> denoting the relevant power of 10; or alternatively can be suffixed with the IEEE/IEC abbreviations <code>Ki</code>, <code>Mi</code>, <code>Gi</code>, and <code>Ti</code> denoting the relevant power of 2.
For limits that are set as seconds: the <replaceable>seconds</replaceable> value can be suffixed with the SI or IEEE/IEC abbreviations; or alternatively with <code>m</code>/<code>minute</code>/<code>minutes</code>, <code>h</code>/<code>hour</code>/<code>hours</code>, <code>d</code>/<code>day</code>/<code>days</code>, or <code>w</code>/<code>week</code>/<code>weeks</code> denoting minutes, hours, days, or weeks respectively.
All suffixes are case-sensitive.
</para>

<para>
For a command with coarser granularity, that can set soft and hard limits in one operation, see <citerefentry><refentrytitle>ulimit</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
</para>

</refsection><refsection><title>Author</title>
<para><author><personname><firstname>Jonathan</firstname> <surname>de Boyne Pollard</surname></personname></author></para>
</refsection>

</refentry>
