<?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 => 'ja',
  ),
  'this' => 
  array (
    0 => 'function.posix-getrlimit.php',
    1 => 'posix_getrlimit',
    2 => 'システムリソース制限に関する情報を返す',
  ),
  'up' => 
  array (
    0 => 'ref.posix.php',
    1 => 'POSIX 関数',
  ),
  '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' => 'ja',
    '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">システムリソース制限に関する情報を返す</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.posix-getrlimit-description">
  <h3 class="title">説明</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> は、
   現在のリソースにおけるソフトリミットおよびハードリミットを配列で返します。
  </p>
  
<p class="para">
  各リソースには、それぞれソフトリミットとハードリミットがあります。
  ソフトリミットとは、そのリソースに対してカーネルが課す制限値のことです。
  ハードリミットとは、ソフトリミットの上限値のことです。
  特権を持たないプロセスは、ソフトリミットの値を 0 からハードリミット値の間で設定することが可能です。
  また、ハードリミットの値を下げることもできます。
</p>

 </div>


 <div class="refsect1 parameters" id="refsect1-function.posix-getrlimit-parameters">
  <h3 class="title">パラメータ</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">resource</code></dt>
     <dd>
      <p class="para">
       <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong> の場合、全てのリソースリミットを取得します。
       <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong> でない場合、特定のリミットを取得するために
       <a href="posix.constants.setrlimit.php" class="link">posix_setrlimit() 定数</a> を指定します。
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.posix-getrlimit-returnvalues">
  <h3 class="title">戻り値</h3>
  <p class="para">
   各リソースに関する制限値を含む連想配列を返します。
   個々のリミット値には、ソフトリミットとハードリミットがあります。
   <table class="doctable table">
    <caption><strong>返される制限の一覧</strong></caption>
    
     <thead>
      <tr>
       <th>制限の名前</th>
       <th>制限についての説明</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>core</td>
       <td>
        コアファイルの最大サイズ。0 の場合はコアファイルを作成しません。
        コアファイルのサイズがこの値を超えると、
        このサイズまで切り詰められます。
       </td>
      </tr>

      <tr>
       <td>totalmem</td>
       <td>
         プロセスのメモリの最大サイズを表すバイト数。
       </td>
      </tr>

      <tr>
       <td>virtualmem</td>
       <td>
        プロセスの仮想メモリの最大サイズを表すバイト数。
       </td>
      </tr>
 
      <tr>
       <td>data</td>
       <td>
        プロセスのデータセグメントの最大サイズを表すバイト数。
       </td>
      </tr>

      <tr>
       <td>stack</td>
       <td>
        プロセスのスタックの最大サイズを表すバイト数。
       </td>
      </tr>

      <tr>
       <td>rss</td>
       <td>
        RAM 上の仮想ページの最大数。
       </td>
      </tr>

      <tr>
       <td>maxproc</td>
       <td>
        呼び出し元のプロセスの実ユーザー ID で作成できるプロセスの最大数。
       </td>
      </tr>

      <tr>
       <td>memlock</td>
       <td>
        RAM 内にロックできるメモリの最大バイト数。
       </td>
      </tr>

      <tr>
       <td>cpu</td>
       <td>
        そのプロセスが使用できる CPU 時間。
       </td>
      </tr>

      <tr>
       <td>filesize</td>
       <td>
        そのプロセスが使用できるデータセグメントの最大サイズを表すバイト数。
       </td>
      </tr>

      <tr>
       <td>openfiles</td>
       <td>
        オープンできるファイル記述子の最大値よりひとつ大きい値。
       </td>
      </tr>

     </tbody>
    
   </table>

   この関数は、失敗時に <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> を返します。
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.posix-getrlimit-changelog">
  <h3 class="title">変更履歴</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>バージョン</th>
      <th>説明</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>8.3.0</td>
      <td>
       オプションの
       <code class="parameter">resource</code> が追加されました。
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-function.posix-getrlimit-examples">
  <h3 class="title">例</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>例1 <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>上の例の出力は、
たとえば以下のようになります。</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">参考</h3>
  <p class="para">
   <ul class="simplelist">
    <li>man ページ GETRLIMIT(2)</li>
    <li><span class="function"><a href="function.posix-setrlimit.php" class="function" rel="rdfs-seeAlso">posix_setrlimit()</a> - システムリソース制限を設定</span></li>
   </ul>
  </p>
 </div>


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