<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.posix.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'en',
  ),
  'this' => 
  array (
    0 => 'function.posix-getrlimit.php',
    1 => 'posix_getrlimit',
    2 => 'Return info about system resource limits',
  ),
  'up' => 
  array (
    0 => 'ref.posix.php',
    1 => 'POSIX Functions',
  ),
  'prev' => 
  array (
    0 => 'function.posix-getpwuid.php',
    1 => 'posix_getpwuid',
  ),
  'next' => 
  array (
    0 => 'function.posix-getsid.php',
    1 => 'posix_getsid',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/posix/functions/posix-getrlimit.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.posix-getrlimit" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">posix_getrlimit</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">posix_getrlimit</span> &mdash; <span class="dc-title">Return info about system resource limits</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.posix-getrlimit-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>posix_getrlimit</strong></span>(<span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.integer.php" class="type int">int</a></span></span> <code class="parameter">$resource</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>): <span class="type"><span class="type"><a href="language.types.array.php" class="type array">array</a></span>|<span class="type"><a href="language.types.singleton.php" class="type false">false</a></span></span></div>

  <p class="para rdfs-comment">
   <span class="function"><strong>posix_getrlimit()</strong></span> returns an <span class="type"><a href="language.types.array.php" class="type array">array</a></span>
   of information about the current resource&#039;s soft and hard limits.
  </p>
  
<p class="para">
  Each resource has an associated soft and hard limit.  The soft
  limit is the value that the kernel enforces for the corresponding
  resource.  The hard limit acts as a ceiling for the soft limit.
  An unprivileged process may only set its soft limit to a value
  from 0 to the hard limit, and irreversibly lower its hard limit.
</p>

 </div>


 <div class="refsect1 parameters" id="refsect1-function.posix-getrlimit-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">resource</code></dt>
     <dd>
      <p class="para">
       If <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong>, all current resource limits will be returned.
       Otherwise, specify the
       <a href="posix.constants.setrlimit.php" class="link">resource limit constant</a>
       to retrieve a specific limit.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.posix-getrlimit-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns an associative <span class="type"><a href="language.types.array.php" class="type array">array</a></span> of elements for each
   limit that is defined. Each limit has a soft and a hard limit.
   <table class="doctable table">
    <caption><strong>List of possible limits returned</strong></caption>
    
     <thead>
      <tr>
       <th>Limit name</th>
       <th>Limit description</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>core</td>
       <td>
        The maximum size of the core file.  When 0, not core files are
        created.  When core files are larger than this size, they will
        be truncated at this size.
       </td>
      </tr>

      <tr>
       <td>totalmem</td>
       <td>
        The maximum size of the memory of the process, in bytes.
       </td>
      </tr>

      <tr>
       <td>virtualmem</td>
       <td>
        The maximum size of the virtual memory for the process, in bytes.
       </td>
      </tr>
 
      <tr>
       <td>data</td>
       <td>
        The maximum size of the data segment for the process, in bytes.
       </td>
      </tr>

      <tr>
       <td>stack</td>
       <td>
        The maximum size of the process stack, in bytes.
       </td>
      </tr>

      <tr>
       <td>rss</td>
       <td>
        The maximum number of virtual pages resident in RAM
       </td>
      </tr>

      <tr>
       <td>maxproc</td>
       <td>
        The maximum number of processes that can be created for the
        real user ID of the calling process.
       </td>
      </tr>

      <tr>
       <td>memlock</td>
       <td>
        The maximum number of bytes of memory that may be locked into RAM.
       </td>
      </tr>

      <tr>
       <td>cpu</td>
       <td>
        The amount of time the process is allowed to use the CPU.
       </td>
      </tr>

      <tr>
       <td>filesize</td>
       <td>
        The maximum size of the data segment for the process, in bytes.
       </td>
      </tr>

      <tr>
       <td>openfiles</td>
       <td>
        One more than the maximum number of open file descriptors.
       </td>
      </tr>

     </tbody>
    
   </table>

   The function returns <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> on failure.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.posix-getrlimit-changelog">
  <h3 class="title">Changelog</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>Version</th>
      <th>Description</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>8.3.0</td>
      <td>
       The optional <code class="parameter">resource</code> parameter has been added.
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-function.posix-getrlimit-examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Example #1 Example use of <span class="function"><strong>posix_getrlimit()</strong></span></strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br />$limits </span><span style="color: #007700">= </span><span style="color: #0000BB">posix_getrlimit</span><span style="color: #007700">();<br /><br /></span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">$limits</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

    <div class="example-contents"><p>The above example will output
something similar to:</p></div>
    <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">Array
(
    [soft core] =&gt; 0
    [hard core] =&gt; unlimited
    [soft data] =&gt; unlimited
    [hard data] =&gt; unlimited
    [soft stack] =&gt; 8388608
    [hard stack] =&gt; unlimited
    [soft totalmem] =&gt; unlimited
    [hard totalmem] =&gt; unlimited
    [soft rss] =&gt; unlimited
    [hard rss] =&gt; unlimited
    [soft maxproc] =&gt; unlimited
    [hard maxproc] =&gt; unlimited
    [soft memlock] =&gt; unlimited
    [hard memlock] =&gt; unlimited
    [soft cpu] =&gt; unlimited
    [hard cpu] =&gt; unlimited
    [soft filesize] =&gt; unlimited
    [hard filesize] =&gt; unlimited
    [soft openfiles] =&gt; 1024
    [hard openfiles] =&gt; 1024
)</pre>
</div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.posix-getrlimit-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li>man page GETRLIMIT(2)</li>
    <li><span class="function"><a href="function.posix-setrlimit.php" class="function" rel="rdfs-seeAlso">posix_setrlimit()</a> - Set system resource limits</span></li>
   </ul>
  </p>
 </div>


</div><?php manual_footer($setup); ?>