<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
  <!ENTITY % general-entities SYSTEM "../general.ent">
  %general-entities;
]>

<sect1 id="ch-system-procps" role="wrap">
  <?dbhtml filename="procps-ng.html"?>

  <sect1info condition="script">
    <productname>procps-ng</productname>
    <productnumber>&procps-ng-version;</productnumber>
    <address>&procps-ng-url;</address>
  </sect1info>

  <title>Procps-ng-&procps-ng-version;</title>

  <indexterm zone="ch-system-procps">
    <primary sortas="a-Procps">Procps-ng</primary>
  </indexterm>

  <sect2 role="package">
    <title/>

    <para>Procps-ng 软件包包含监视进程的程序。</para>

    <segmentedlist>
      <segtitle>&buildtime;</segtitle>
      <segtitle>&diskspace;</segtitle>

      <seglistitem>
        <seg>&procps-ng-ch6-sbu;</seg>
        <seg>&procps-ng-ch6-du;</seg>
      </seglistitem>
    </segmentedlist>

  </sect2>

  <sect2 role="installation">
    <title>安装 Procps-ng</title>

    <para>准备安装 procps-ng：</para>

<screen revision="sysv"><userinput remap="configure">./configure --prefix=/usr                            \
            --exec-prefix=                           \
            --libdir=/usr/lib                        \
            --docdir=/usr/share/doc/procps-ng-&procps-ng-version; \
            --disable-static                         \
            --disable-kill</userinput></screen>

<screen revision="systemd"><userinput remap="configure">./configure --prefix=/usr                            \
            --exec-prefix=                           \
            --libdir=/usr/lib                        \
            --docdir=/usr/share/doc/procps-ng-&procps-ng-version; \
            --disable-static                         \
            --disable-kill                           \
            --with-systemd</userinput></screen>

    <variablelist>
      <title>配置选项的含义：</title>

      <varlistentry>
        <term><parameter>--disable-kill</parameter></term>
        <listitem>
          <para>该选项禁用 <command>kill</command> 命令的构建，
          Util-linux 软件包将安装它。</para>
        </listitem>
      </varlistentry>
    </variablelist>

    <para>编译该软件包：</para>

<screen><userinput remap="make">make</userinput></screen>

    <!--para>The test suite needs some custom modifications for LFS.
    Remove a test that fails when scripting does not use a tty device and
    fix two others.
    To run the test suite, run the following commands:</para-->
    <para>在 LFS 系统上，测试套件需要一些自定义修改。
		删除一个在没有使用 tty 设备输入时会失败的测试，并修正另外两个。
		执行以下命令运行测试套件：</para>

<screen><userinput remap="test">sed -i -r 's|(pmap_initname)\\\$|\1|' testsuite/pmap.test/pmap.exp
sed -i '/set tty/d' testsuite/pkill.test/pkill.exp
rm testsuite/pgrep.test/pgrep.exp
make check</userinput></screen>

    <para>安装该软件包：</para>

<screen><userinput remap="install">make install</userinput></screen>

<para>最后，将必要的库移动到
	<filename class="directory">/usr</filename> 尚未挂载时也能访问的位置：
</para>

<screen><userinput remap="install">mv -v /usr/lib/libprocps.so.* /lib
ln -sfv ../../lib/$(readlink /usr/lib/libprocps.so) /usr/lib/libprocps.so</userinput></screen>

  </sect2>

  <sect2 id="contents-procps" role="content">
    <title>Procps-ng 的内容</title>

    <segmentedlist>
      <segtitle>安装的程序</segtitle>
      <segtitle>安装的库</segtitle>
      <segtitle>安装的目录</segtitle>

      <seglistitem>
        <seg>free, pgrep, pidof, pkill, pmap, ps, pwdx, slabtop,
        sysctl, tload, top, uptime, vmstat, w, 以及 watch</seg>
        <seg>libprocps.so</seg>
        <seg>/usr/include/proc 和 /usr/share/doc/procps-ng-&procps-ng-version;</seg>
      </seglistitem>
    </segmentedlist>

    <variablelist>
      <bridgehead renderas="sect3">简要描述</bridgehead>
      <?dbfo list-presentation="list"?>
      <?dbhtml list-presentation="table"?>

      <varlistentry id="free">
        <term><command>free</command></term>
        <listitem>
          <para>报告系统中可用和已用内存（包括物理内存和交换空间）
          	  的容量</para>
          <indexterm zone="ch-system-procps free">
            <primary sortas="b-free">free</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="pgrep">
        <term><command>pgrep</command></term>
        <listitem>
          <para>根据名称和其他属性查找进程</para>
          <indexterm zone="ch-system-procps pgrep">
            <primary sortas="b-pgrep">pgrep</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="pidof">
        <term><command>pidof</command></term>
        <listitem>
          <para>报告给定程序的 PID</para>
          <indexterm zone="ch-system-procps pidof">
            <primary sortas="b-pidof">pidof</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="pkill">
        <term><command>pkill</command></term>
        <listitem>
          <para>根据名称和其他属性向进程发送信号</para>
          <indexterm zone="ch-system-procps pkill">
            <primary sortas="b-pkill">pkill</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="pmap">
        <term><command>pmap</command></term>
        <listitem>
          <para>报告给定进程的内存映射</para>
          <indexterm zone="ch-system-procps pmap">
            <primary sortas="b-pmap">pmap</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="ps">
        <term><command>ps</command></term>
        <listitem>
          <para>列出正在运行的进程</para>
          <indexterm zone="ch-system-procps ps">
            <primary sortas="b-ps">ps</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="pwdx">
        <term><command>pwdx</command></term>
        <listitem>
          <para>报告一个进程的当前工作目录</para>
          <indexterm zone="ch-system-procps pwdx">
            <primary sortas="b-pwdx">pwdx</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="slabtop">
        <term><command>slabtop</command></term>
        <listitem>
          <para>实时显示内核 slab 缓存详细信息</para>
          <indexterm zone="ch-system-procps slabtop">
            <primary sortas="b-slabtop">slabtop</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="sysctl">
        <term><command>sysctl</command></term>
        <listitem>
          <para>在运行时修改内核参数</para>
          <indexterm zone="ch-system-procps sysctl">
            <primary sortas="b-sysctl">sysctl</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="tload">
        <term><command>tload</command></term>
        <listitem>
          <para>打印当前系统平均负载示意图</para>
          <indexterm zone="ch-system-procps tload">
            <primary sortas="b-tload">tload</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="top">
        <term><command>top</command></term>
        <listitem>
          <para>列出 CPU 占用最大的进程列表；
          	  它实时地提供处理器活动的连续概况</para>
          <indexterm zone="ch-system-procps top">
            <primary sortas="b-top">top</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="uptime">
        <term><command>uptime</command></term>
        <listitem>
          <para>报告系统运行时间、登录用户数目和系统平均负载</para>
          <indexterm zone="ch-system-procps uptime">
            <primary sortas="b-uptime">uptime</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="vmstat">
        <term><command>vmstat</command></term>
        <listitem>
          <para>报告虚拟内存统计，给出进程、内存、分页、块输入输出（IO)、
          陷阱和 CPU 活动信息</para>
          <indexterm zone="ch-system-procps vmstat">
            <primary sortas="b-vmstat">vmstat</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="w">
        <term><command>w</command></term>
        <listitem>
          <para>显示当前登录用户和它们的登录地点、时间</para>
          <indexterm zone="ch-system-procps w">
            <primary sortas="b-w">w</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="watch">
        <term><command>watch</command></term>
        <listitem>
          <para>重复执行给定命令，显示其输出的第一页；
          这使得用户可以观察输出随时间的变化</para>
          <indexterm zone="ch-system-procps watch">
            <primary sortas="b-watch">watch</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="libprocps">
        <term><filename class="libraryfile">libprocps</filename></term>
        <listitem>
          <para>包含该软件包大多数程序使用的函数</para>
          <indexterm zone="ch-system-procps libprocps">
            <primary sortas="c-libprocps">libprocps</primary>
          </indexterm>
        </listitem>
      </varlistentry>

    </variablelist>

  </sect2>

</sect1>
