commit 51db08b3d0d0da3cce35d2a8a226e1b55385083e Author: Douglas Silas dhensley@redhat.com Date: Thu Jun 24 12:37:03 2010 +0200
DG.xml, proc_fs: re-add the proc FS chapter from SAG
Fix BZ#594697: ddomingo and I decided the best place for this chapter is the DG instead of the SAG; therefore, re-adding. Note: chapter is fully updated and has SME sign-off.
en-US/Deployment_Guide.xml | 4 + en-US/The_proc_File_System.xml | 5236 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 5240 insertions(+), 0 deletions(-) --- diff --git a/en-US/Deployment_Guide.xml b/en-US/Deployment_Guide.xml index 5c4b980..088e3f4 100644 --- a/en-US/Deployment_Guide.xml +++ b/en-US/Deployment_Guide.xml @@ -100,6 +100,10 @@ xmlns:xi="http://www.w3.org/2001/XInclude" href="Console_Access.xml" lang="en-US,as-IN,bn-IN,gu-IN,hi-IN,kn-IN,ml-IN,mr-IN,or-IN,pa-IN,si-LK,ta-IN,te-IN,ja-JP,zh-CN,fr-FR,es-ES"/> + <xi:include + xmlns:xi="http://www.w3.org/2001/XInclude" + lang="en-US,as-IN,bn-IN,gu-IN,hi-IN,kn-IN,ml-IN,mr-IN,or-IN,pa-IN,si-LK,ta-IN,te-IN,ja-JP,zh-CN,fr-FR,es-ES" + href="The_proc_File_System.xml" /> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="The_sysconfig_Directory.xml" diff --git a/en-US/The_proc_File_System.xml b/en-US/The_proc_File_System.xml new file mode 100644 index 0000000..e4b8904 --- /dev/null +++ b/en-US/The_proc_File_System.xml @@ -0,0 +1,5236 @@ +<?xml version='1.0'?> +<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ +]> +<chapter + id="ch-proc"> + <title>The <filename>proc</filename> File System</title> + <indexterm + significance="normal"> + <primary> + <filename>proc</filename> file system</primary> + <secondary>introduced</secondary> + </indexterm> + <indexterm + significance="normal"> + <primary> + <filename>/proc/</filename> directory</primary> + <see> + <filename>proc</filename> file system</see> + </indexterm> + + <para> + The Linux kernel has two primary functions: to control access to + physical devices on the computer and to schedule when and how + processes interact with these devices. The <filename>/proc/</filename> directory (also called + the <filename>proc</filename> file system) + contains a hierarchy of special files which represent the current + state of the kernel, allowing applications and users to + peer into the kernel's view of the system. + </para> + + <para> +The <filename>/proc/</filename> directory contains a wealth of information detailing +system hardware and any running processes. In addition, some of the files within +<filename>/proc/</filename> can be manipulated by users and applications to communicate +configuration changes to the kernel. + </para> + + <note> + <para> +Later versions of the 2.6 kernel have made the <filename>/proc/ide/</filename> and <filename>/proc/pci/</filename> obsolete. The <command>/proc/ide/</command> file system is now superseded by files in <command>sysfs</command>; to retrieve information on PCI devices, use <command>lspci</command> instead. For more information on <command>sysfs</command> or <command>lspci</command>, refer to their respective <command>man</command> pages. +</para> + </note> + + <section + id="s1-proc-virtual"> + <title>A Virtual File System</title> + <indexterm + significance="normal"> + <primary>file system</primary> + <secondary>virtual</secondary> + <see> + <filename>proc</filename> file system</see> + </indexterm> + <indexterm + significance="normal"> + <primary>virtual file system</primary> + <see> + <filename>proc</filename> file system</see> + </indexterm> + <indexterm + significance="normal"> + <primary>virtual files</primary> + <see> + <filename>proc</filename> file system</see> + </indexterm> + + <para> + Linux systems store all data as <emphasis>files</emphasis>. Most users are + familiar with the two primary types of files: text and + binary. But the <filename>/proc/</filename> + directory contains another type of file called a + <firstterm>virtual file</firstterm>. As such, + <filename>/proc/</filename> is often referred + to as a <firstterm>virtual file system</firstterm>. + </para> + + <para> +Virtual files have unique qualities. Most of them are + listed as zero bytes in size, but can still contain a large +amount of information when viewed. In addition, most of the + time and date stamps on virtual files reflect the current + time and date, indicative of the fact they are constantly + updated. + </para> + + <para> + Virtual files such as <filename>/proc/interrupts</filename>, <filename>/proc/meminfo</filename>, <filename>/proc/mounts</filename>, and <filename>/proc/partitions</filename> provide an + up-to-the-moment glimpse of the system's hardware. Others, like + the <filename>/proc/filesystems</filename> file + and the <filename>/proc/sys/</filename> + directory provide system configuration information and + interfaces. + </para> + + <para> + For organizational purposes, files containing information on a + similar topic are grouped into virtual directories and + sub-directories. Process directories + contain information about each running process on the system. + </para> + + <remark> +WAS:: + For organizational purposes, files containing information on a + similar topic are grouped into virtual directories and + sub-directories. For instance, <filename>/proc/ide/</filename> contains information for + all physical IDE devices. Likewise, process directories + contain information about each running process on the system. +</remark> + +<!-- BZ#561622, removed /proc/ide and all relevant references + <para> + For organizational purposes, files containing information on a + similar topic are grouped into virtual directories and + sub-directories. For instance, <filename + >/proc/ide/</filename> contains information for + all physical IDE devices. Likewise, process directories + contain information about each running process on the system. + </para> --> + + <section + id="s2-proc-viewing"> + <title>Viewing Virtual Files</title> + <indexterm + significance="normal"> + <primary>files, proc file system</primary> + <secondary>viewing</secondary> + </indexterm> + <indexterm + significance="normal"> + <primary> + <filename>proc</filename> file system</primary> + <secondary>viewing files within</secondary> + </indexterm> + <para> +Most files within <filename>/proc/</filename> files operate +similarly to text files, storing useful system and hardware data +in human-readable text format. As such, you can use <command>cat</command>, <command>more</command>, or <command>less</command> +to view them. For example, to display information about the system's CPU, +run <command>cat /proc/cpuinfo</command>. This will return output similar to the +following: + </para> + + <screen> +processor : 0 +vendor_id : AuthenticAMD +cpu family : 5 +model : 9 +model name : AMD-K6(tm) 3D+ +Processor stepping : 1 cpu +MHz : 400.919 +cache size : 256 KB +fdiv_bug : no +hlt_bug : no +f00f_bug : no +coma_bug : no +fpu : yes +fpu_exception : yes +cpuid level : 1 +wp : yes +flags : fpu vme de pse tsc msr mce cx8 pge mmx syscall 3dnow k6_mtrr +bogomips : 799.53 +</screen> + + + <para> +Some files in <command>/proc/</command> contain information that is not human-readable. +To retrieve information from such files, use tools such as <command>lspci</command>, <command>apm</command>, <command>free</command>, and <command>top</command>. + </para> + + <note> + <title>Note</title> + + <para> + Some of the virtual files in the <filename>/proc/</filename> directory are readable only + by the root user. + </para> + </note> + </section> + + <section + id="s2-proc-change"> + <title>Changing Virtual Files</title> + <indexterm + significance="normal"> + <primary>files, proc file system</primary> + <secondary>changing</secondary> + </indexterm> + <indexterm + significance="normal"> + <primary> + <filename>proc</filename> file system</primary> + <secondary>changing files within</secondary> + </indexterm> + + <para> + As a general rule, most virtual files within the <filename>/proc/</filename> directory are + read-only. However, some can be used to adjust settings in + the kernel. This is especially true for files in the + <filename>/proc/sys/</filename> subdirectory. + </para> + + <para> + To change the value of a virtual file, use the following command: +</para> + + <para> + <command>echo <replaceable>value</replaceable> > /proc/<replaceable>file</replaceable> + </command> + </para> + + <para> +For example, to change the + hostname on the fly, run: + </para> + + + <para> + <command>echo <replaceable>www.example.com</replaceable> > /proc/sys/kernel/hostname </command> + </para> + + <para> + Other files act as binary or Boolean switches. Typing + <command>cat + /proc/sys/net/ipv4/ip_forward</command> returns either a + <computeroutput>0</computeroutput> (off or false) or a + <computeroutput>1</computeroutput> (on or true). A + <computeroutput>0</computeroutput> indicates + that the kernel is not forwarding network packets. +To turn packet forwarding on, run <command>echo 1 > /proc/sys/net/ipv4/ip_forward</command>. + </para> + + <note> + <title>Tip</title> + <para> + Another command used to alter settings in the <filename>/proc/sys/</filename> subdirectory is + <command>/sbin/sysctl</command>. For more + information on this command, refer to <xref + linkend="s1-proc-sysctl"/> + </para> + </note> + + <para> + For a listing of some of the kernel configuration files available in the <filename>/proc/sys/</filename> subdirectory, refer to <xref + linkend="s2-proc-dir-sys"/>. + </para> + </section> + </section> + + <section + id="s1-proc-topfiles"> + <title>Top-level Files within the <filename>proc</filename> File System</title> + <indexterm + significance="normal"> + <primary> + <filename>proc</filename> file system</primary> + <secondary>files within, top-level</secondary> + </indexterm> + + <para> + Below is a list of some of the more useful virtual files in the top-level of the <filename>/proc/</filename> directory. + </para> + + <note> + <title>Note</title> + <para> + In most cases, the content of the files listed in this + section are not the same as those installed on your + machine. This is because much of the information is specific + to the hardware on which Red Hat Enterprise Linux is running + for this documentation effort. + </para> + </note> + <!-- + <section id="s2-proc-apm"> + <title><filename>/proc/apm</filename></title> + <indexterm significance="normal"> + <primary><filename>proc</filename> file system</primary> + <secondary><filename>/proc/apm</filename> + </secondary> + </indexterm> + + <para> + This file provides information about the state of the + <firstterm>Advanced Power Management (APM)</firstterm> system + and is used by the <command>apm</command> + command. If a system with no battery is connected to an AC + power source, this virtual file would look similar to the + following: + </para> + + <screen> + 1.16 1.2 0x07 0x01 0xff 0x80 -1% -1 ? + </screen> + + <para> + Running the <command>apm -v</command> command + on such a system results in output similar to the following: + </para> + + <screen> + APM BIOS 1.2 (kernel driver 1.16ac) AC on-line, no system battery + </screen> + + <para> + For systems which do not use a battery as a power source, + <command>apm</command> is able do little more + than put the machine in standby mode. The <command + >apm</command> command is much more useful on + laptops. For example, the following output is from the + command <command>cat /proc/apm</command> on a + laptop while plugged into a power outlet: + </para> + + <screen> + 1.16 1.2 0x03 0x01 0x03 0x09 100% -1 ? + </screen> + + <para> + When the same laptop is unplugged from its power source for a + few minutes, the content of the <filename + >apm</filename> file changes to something like + the following: + </para> + + <screen> + 1.16 1.2 0x03 0x00 0x00 0x01 99% 1792 min + </screen> + + <para> + The <command>apm -v</command> command now + yields more useful data, such as the following: + </para> + + <screen> + APM BIOS 1.2 (kernel driver 1.16) AC off-line, battery status high: 99% (1 day, 5:52) + </screen> + + </section> + --> + <section + id="s2-proc-buddyinfo"> + <title> + <filename>/proc/buddyinfo</filename> + </title> + <indexterm + significance="normal"> + <primary> + <filename>proc</filename> file system</primary> + <secondary> + <filename>/proc/buddyinfo</filename> + </secondary> + </indexterm> + + <para> + This file is used primarily for diagnosing memory + fragmentation issues. Using the buddy algorithm, each column + represents the number of pages of a certain order (a certain + size) that are available at any given time. For example, for + zone <firstterm>direct memory access</firstterm> (DMA), there are 90 of + 2<superscript>(0*PAGE_SIZE)</superscript> chunks of memory. Similarly, there are 6 of + 2<superscript>(1*PAGE_SIZE)</superscript> chunks, and 2 of 2<superscript>(2*PAGE_SIZE)</superscript> chunks of + memory available. + </para> + + <para> + The <computeroutput>DMA</computeroutput> row references + the first 16 MB on a system, the <computeroutput>HighMem</computeroutput> row references all memory + greater than 4 GB on a system, and the <computeroutput>Normal</computeroutput> row references all memory + in between. + </para> + + <para> + The following is an example of the output typical of + <filename>/proc/buddyinfo</filename>: + </para> + + <screen> +Node 0, zone DMA 90 6 2 1 1 ... +Node 0, zone Normal 1650 310 5 0 0 ... +Node 0, zone HighMem 2 0 0 1 1 ... +</screen> + + </section> + + <section + id="s2-proc-cmdline"> + <title> + <filename>/proc/cmdline</filename> + </title> + <indexterm + significance="normal"> + <primary> + <filename>proc</filename> file system</primary> + <secondary> + <filename>/proc/cmdline</filename> + </secondary> + </indexterm> + + <para> + This file shows the parameters passed to the kernel at the + time it is started. A sample <filename>/proc/cmdline</filename> file looks like the + following: + </para> + + <screen> +ro root=/dev/VolGroup00/LogVol00 rhgb quiet 3 +</screen> + + <para> + This tells us that the kernel is mounted read-only (signified + by <computeroutput>(ro)</computeroutput>), + located on the first logical volume (<computeroutput>LogVol00</computeroutput>) of the first + volume group (<computeroutput>/dev/VolGroup00</computeroutput>). <computeroutput>LogVol00</computeroutput> is the equivalent + of a disk partition in a non-LVM system (Logical Volume + Management), just as <computeroutput>/dev/VolGroup00</computeroutput> is similar + in concept to <filename>/dev/hda1</filename>, + but much more extensible. + </para> + + <para> + For more information on LVM used in Red Hat Enterprise Linux, + refer to <ulink + url="http://www.tldp.org/HOWTO/LVM-HOWTO/index.html%22%3Ehttp://www.tldp.org/HOWT...</ulink>. + </para> + + <para> + Next, <computeroutput>rhgb</computeroutput> + signals that the <filename>rhgb</filename> + package has been installed, and graphical booting is + supported, assuming <filename>/etc/inittab</filename> shows a default + runlevel set to <command>id:5:initdefault:</command>. + </para> + + <para> + Finally, <computeroutput>quiet</computeroutput> indicates all verbose + kernel messages are suppressed at boot time. + </para> + </section> + + <section + id="s2-proc-cpuinfo"> + <title> + <filename>/proc/cpuinfo</filename> + </title> + <indexterm + significance="normal"> + <primary> + <filename>proc</filename> file system</primary> + <secondary> + <filename>/proc/cpuinfo</filename> + </secondary> + </indexterm> + + <para> + This virtual file identifies the type of processor used by + your system. The following is an example of the output + typical of <filename>/proc/cpuinfo</filename>: + </para> + + <screen> +processor : 0 +vendor_id : GenuineIntel +cpu family : 15 +model : 2 +model name : Intel(R) Xeon(TM) CPU 2.40GHz +stepping : 7 cpu +MHz : 2392.371 +cache size : 512 KB +physical id : 0 +siblings : 2 +runqueue : 0 +fdiv_bug : no +hlt_bug : no +f00f_bug : no +coma_bug : no +fpu : yes +fpu_exception : yes +cpuid level : 2 +wp : yes +flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm +bogomips : 4771.02 +</screen> + + <itemizedlist> + <listitem> + <para> + <computeroutput>processor</computeroutput> — + Provides each processor with an identifying number. On + systems that have one processor, only a <computeroutput>0</computeroutput> is present. + </para> + </listitem> + + <listitem> + <para> + <computeroutput>cpu + family</computeroutput> — Authoritatively + identifies the type of processor in the system. For an + Intel-based system, place the number in front of "86" to + determine the value. This is particularly helpful for + those attempting to identify the architecture of an + older system such as a 586, 486, or 386. Because some + RPM packages are compiled for each of these particular + architectures, this value also helps users determine + which packages to install. + </para> + </listitem> + + <listitem> + <para> + <computeroutput>model + name</computeroutput> — Displays the common name + of the processor, including its project name. + </para> + </listitem> + + <listitem> + <para> + <computeroutput>cpu MHz</computeroutput> + — Shows the precise speed in megahertz for the + processor to the thousandths decimal place. + </para> + </listitem> + + <listitem> + <para> + <computeroutput>cache + size</computeroutput> — Displays the amount of + level 2 memory cache available to the processor. + </para> + </listitem> + + <listitem> + <para> + <computeroutput>siblings</computeroutput> — + Displays the number of sibling CPUs on the same physical + CPU for architectures which use hyper-threading. + </para> + </listitem> + + <listitem> + <para> + <computeroutput>flags</computeroutput> + — Defines a number of different qualities about + the processor, such as the presence of a floating point + unit (FPU) and the ability to process MMX instructions. + </para> + </listitem> + </itemizedlist> + </section> + + <section + id="s2-proc-crypto"> + <title> + <filename>/proc/crypto</filename> + </title> + <indexterm + significance="normal"> + <primary> + <filename>proc</filename> file system</primary> + <secondary> + <filename>/proc/crypto</filename> + </secondary> + </indexterm> + <para> + This file lists all installed cryptographic ciphers used by + the Linux kernel, including additional details for each. A + sample <filename>/proc/crypto</filename> file + looks like the following: + </para> + + <screen> +name : sha1 +module : kernel +type : digest +blocksize : 64 +digestsize : 20 +name : md5 +module : md5 +type : digest +blocksize : 64 +digestsize : 16 +</screen> + + </section> + + <section + id="s2-proc-devices"> + <title> + <filename>/proc/devices</filename> + </title> + <indexterm + significance="normal"> + <primary> + <filename>proc</filename> file system</primary> + <secondary> + <filename>/proc/devices</filename> + </secondary> + <tertiary>block devices</tertiary> + </indexterm> + <indexterm + significance="normal"> + <primary> + <filename>proc</filename> file system</primary> + <secondary> + <filename>/proc/devices</filename> + </secondary> + <tertiary>character devices</tertiary> + </indexterm> + <indexterm + significance="normal"> + <primary>character devices</primary> + <secondary>definition of</secondary> + </indexterm> + <indexterm + significance="normal"> + <primary>character devices</primary> + <seealso> + <filename>/proc/devices</filename> + </seealso> + </indexterm> + <indexterm + significance="normal"> + <primary>block devices</primary> + <seealso> + <filename>/proc/devices</filename> + </seealso> + </indexterm> + <indexterm + significance="normal"> + <primary>block devices</primary> + <secondary>definition of</secondary> + </indexterm> + <para> + This file displays the various character and block devices + currently configured (not including devices whose modules are + not loaded). Below is a sample output from this file: + </para> + + <screen> +Character devices: + 1 mem + 4 /dev/vc/0 + 4 tty + 4 ttyS + 5 /dev/tty + 5 /dev/console + 5 /dev/ptmx + 7 vcs + 10 misc + 13 input + 29 fb + 36 netlink + 128 ptm + 136 pts + 180 usb + +Block devices: + 1 ramdisk + 3 ide0 + 9 md + 22 ide1 + 253 device-mapper + 254 mdp +</screen> + + <para> + The output from <filename>/proc/devices</filename> includes the major + number and name of the device, and is broken into two major + sections: <computeroutput>Character + devices</computeroutput> and <computeroutput>Block devices</computeroutput>. + </para> + + <para> + <firstterm>Character devices</firstterm> are similar to + <firstterm>block devices</firstterm>, except for two basic + differences: + </para> + + <orderedlist + inheritnum="ignore" + continuation="restarts"> + <listitem> + <para> + Character devices do not require buffering. Block devices + have a buffer available, allowing them to order requests + before addressing them. This is important for devices + designed to store information — such as hard drives + — because the ability to order the information + before writing it to the device allows it to be placed in + a more efficient order. + </para> + </listitem> + + <listitem> + <para> + Character devices send data with no preconfigured + size. Block devices can send and receive information in + blocks of a size configured per device. + </para> + </listitem> + </orderedlist> + + <para> + For more information about devices refer to the following + installed documentation: + </para> + + <screen> +/usr/share/doc/kernel-doc-<replaceable>version</replaceable>/Documentation/devices.txt +</screen> + + </section> + + <section + id="s2-proc-dma"> + <title> + <filename>/proc/dma</filename> + </title> + <indexterm + significance="normal"> + <primary> + <filename>proc</filename> file system</primary> + <secondary> + <filename>/proc/dma</filename> + </secondary> + </indexterm> + <para> + This file contains a list of the registered ISA DMA channels + in use. A sample <filename>/proc/dma</filename> files looks like the + following: + </para> + <screen> +4: cascade +</screen> + </section> + + <section + id="s2-proc-execdomains"> + <title> + <filename>/proc/execdomains</filename> + </title> + <indexterm + significance="normal"> + <primary> + <filename>proc</filename> file system</primary> + <secondary> + <filename>/proc/execdomains</filename> + </secondary> + </indexterm> + <indexterm + significance="normal"> + <primary>execution domains</primary> + <seealso> + <filename>/proc/execdomains</filename> + </seealso> + </indexterm> + <indexterm + significance="normal"> + <primary>execution domains</primary> + <secondary>definition of</secondary> + </indexterm> + <para> + This file lists the <firstterm>execution domains</firstterm> + currently supported by the Linux kernel, along with the range + of personalities they support. + </para> + + <screen> +0-0 Linux [kernel] +</screen> + + <para> + Think of execution domains as the "personality" for an + operating system. Because other binary formats, such as + Solaris, UnixWare, and FreeBSD, can be used with Linux, + programmers can change the way the operating system treats + system calls from these binaries by changing the personality + of the task. Except for the <computeroutput>PER_LINUX</computeroutput> execution domain, + different personalities can be implemented as dynamically + loadable modules. + </para> + </section> + + <section + id="s2-proc-fb"> + <title> + <filename>/proc/fb</filename> + </title> + <indexterm + significance="normal"> + <primary> + <filename>proc</filename> file system</primary> + <secondary> + <filename>/proc/fb</filename> + </secondary> + </indexterm> + <indexterm + significance="normal"> + <primary>frame buffer device</primary> + <seealso> + <filename>/proc/fb</filename> + </seealso> + </indexterm> + <para> + This file contains a list of frame buffer devices, with the + frame buffer device number and the driver that controls + it. Typical output of <filename>/proc/fb</filename> for systems which contain + frame buffer devices looks similar to the following: + </para> + + <screen> +0 VESA VGA +</screen> + </section> + + <section + id="s2-proc-filesystems"> + <title> + <filename>/proc/filesystems</filename> + </title> + <indexterm + significance="normal"> + <primary> + <filename>proc</filename> file system</primary> + <secondary> + <filename>/proc/filesystems</filename> + </secondary> + </indexterm> + <para> + This file displays a list of the file system types currently + supported by the kernel. Sample output from a generic + <filename>/proc/filesystems</filename> file + looks similar to the following: + </para> + + <screen> +nodev sysfs +nodev rootfs +nodev bdev +nodev proc +nodev sockfs +nodev binfmt_misc +nodev usbfs +nodev usbdevfs +nodev futexfs +nodev tmpfs +nodev pipefs +nodev eventpollfs +nodev devpts + ext2 +nodev ramfs +nodev hugetlbfs + iso9660 +nodev mqueue + ext3 +nodev rpc_pipefs +nodev autofs +</screen> + + <para> + The first column signifies whether the file system is mounted + on a block device. Those beginning with <computeroutput>nodev</computeroutput> are not mounted on a + device. The second column lists the names of the file systems + supported. + </para> + + <para> + The <command>mount</command> command cycles + through the file systems listed here when one is not + specified as an argument. + </para> + </section> + + <section + id="s2-proc-interrupts"> + <title> + <filename>/proc/interrupts</filename> + </title> + <indexterm + significance="normal"> + <primary> + <filename>proc</filename> file system</primary> + <secondary> + <filename>/proc/interrupts</filename> + </secondary> + </indexterm> + <para> + This file records the number of interrupts per IRQ on the x86 + architecture. A standard <filename>/proc/interrupts</filename> looks similar to + the following: + </para> + + <screen> + CPU0 + 0: 80448940 XT-PIC timer + 1: 174412 XT-PIC keyboard + 2: 0 XT-PIC cascade + 8: 1 XT-PIC rtc + 10: 410964 XT-PIC eth0 + 12: 60330 XT-PIC PS/2 Mouse + 14: 1314121 XT-PIC ide0 + 15: 5195422 XT-PIC ide1 +NMI: 0 +ERR: 0 +</screen> + + <para> + For a multi-processor machine, this file may look slightly + different: + </para> + + <screen> + CPU0 CPU1 + 0: 1366814704 0 XT-PIC timer + 1: 128 340 IO-APIC-edge keyboard + 2: 0 0 XT-PIC cascade + 8: 0 1 IO-APIC-edge rtc + 12: 5323 5793 IO-APIC-edge PS/2 Mouse + 13: 1 0 XT-PIC fpu + 16: 11184294 15940594 IO-APIC-level Intel EtherExpress Pro 10/100 Ethernet + 20: 8450043 11120093 IO-APIC-level megaraid + 30: 10432 10722 IO-APIC-level aic7xxx + 31: 23 22 IO-APIC-level aic7xxx +NMI: 0 +ERR: 0 +</screen> + + <para> + The first column refers to the IRQ number. Each CPU in the + system has its own column and its own number of interrupts + per IRQ. The next column reports the type of interrupt, and + the last column contains the name of the device that is + located at that IRQ. + </para> + + <para> + Each of the types of interrupts seen in this file, which + are architecture-specific, mean something different. For + x86 machines, the following values are common: + </para> + + <itemizedlist> + <listitem> + <para> + <computeroutput>XT-PIC</computeroutput> + — This is the old AT computer interrupts. + </para> + </listitem> + + <listitem> + <para> + <computeroutput>IO-APIC-edge</computeroutput> — + The voltage signal on this interrupt transitions from + low to high, creating an <emphasis>edge</emphasis>, + where the interrupt occurs and is only signaled + once. This kind of interrupt, as well as the + <computeroutput>IO-APIC-level</computeroutput> + interrupt, are only seen on systems with processors + from the 586 family and higher. + </para> + </listitem> + + <listitem> + <para> + <computeroutput>IO-APIC-level</computeroutput> — + Generates interrupts when its voltage signal is high + until the signal is low again. + </para> + </listitem> + </itemizedlist> + </section> + + <section + id="s2-proc-iomem"> + <title> + <filename>/proc/iomem</filename> + </title> + <indexterm + significance="normal"> + <primary> + <filename>proc</filename> file system</primary> + <secondary> + <filename>/proc/iomem</filename> + </secondary> + </indexterm> + <para> + This file shows you the current map of the system's memory + for each physical device: + </para> + + <screen> +00000000-0009fbff : System RAM +0009fc00-0009ffff : reserved +000a0000-000bffff : Video RAM area +000c0000-000c7fff : Video ROM +000f0000-000fffff : System ROM +00100000-07ffffff : System RAM +00100000-00291ba8 : Kernel code +00291ba9-002e09cb : Kernel data +e0000000-e3ffffff : VIA Technologies, Inc. VT82C597 [Apollo VP3] e4000000-e7ffffff : PCI Bus #01 +e4000000-e4003fff : Matrox Graphics, Inc. MGA G200 AGP +e5000000-e57fffff : Matrox Graphics, Inc. MGA G200 AGP +e8000000-e8ffffff : PCI Bus #01 +e8000000-e8ffffff : Matrox Graphics, Inc. MGA G200 AGP +ea000000-ea00007f : Digital Equipment Corporation DECchip 21140 [FasterNet] +ea000000-ea00007f : tulip ffff0000-ffffffff : reserved +</screen> + + <para> + The first column displays the memory registers used by each + of the different types of memory. The second column lists the + kind of memory located within those registers and displays + which memory registers are used by the kernel within the + system RAM or, if the network interface card has multiple + Ethernet ports, the memory registers assigned for each port. + </para> + </section> + + <section + id="s2-proc-ioports"> + <title> + <filename>/proc/ioports</filename> + </title> + <indexterm + significance="normal"> + <primary> + <filename>proc</filename> file system</primary> + <secondary> + <filename>/proc/ioports</filename> + </secondary> + </indexterm> + <para> + The output of <filename>/proc/ioports</filename> provides a list of + currently registered port regions used for input or output + communication with a device. This file can be quite long. The + following is a partial listing: + </para> + + <screen> +0000-001f : dma1 +0020-003f : pic1 +0040-005f : timer +0060-006f : keyboard +0070-007f : rtc +0080-008f : dma page reg +00a0-00bf : pic2 +00c0-00df : dma2 +00f0-00ff : fpu +0170-0177 : ide1 +01f0-01f7 : ide0 +02f8-02ff : serial(auto) +0376-0376 : ide1 +03c0-03df : vga+ +03f6-03f6 : ide0 +03f8-03ff : serial(auto) +0cf8-0cff : PCI conf1 +d000-dfff : PCI Bus #01 +e000-e00f : VIA Technologies, Inc. Bus Master IDE +e000-e007 : ide0 +e008-e00f : ide1 +e800-e87f : Digital Equipment Corporation DECchip 21140 [FasterNet] +e800-e87f : tulip +</screen> + + <para> + The first column gives the I/O port address range reserved + for the device listed in the second column. + </para> + </section> + + <section + id="s2-proc-kcore"> + <title> + <filename>/proc/kcore</filename> + </title> + <indexterm + significance="normal"> + <primary> + <filename>proc</filename> file system</primary> + <secondary> + <filename>/proc/kcore</filename> + </secondary> + </indexterm> + <para> + This file represents the physical memory of the system and is + stored in the core file format. Unlike most <filename>/proc/</filename> files, <filename>kcore</filename> displays a size. This value + is given in bytes and is equal to the size of the physical + memory (RAM) used plus 4 KB. + </para> + + <para> + The contents of this file are designed to be examined by a + debugger, such as <command>gdb</command>, and + is not human readable. + </para> + + <warning> + <title>Caution</title> + + <para> + Do not view the <filename>/proc/kcore</filename> virtual file. The + contents of the file scramble text output on the + terminal. If this file is accidentally viewed, press + <keycombo><keycap>Ctrl</keycap> + <keycap>C</keycap> + </keycombo> + to stop the process and then type <command>reset</command> to bring back the command + line prompt. + </para> + </warning> + </section> + + <section + id="s2-proc-kmsg"> + <title> + <filename>/proc/kmsg</filename> + </title> + <indexterm + significance="normal"> + <primary> + <filename>proc</filename> file system</primary> + <secondary> + <filename>/proc/kmsg</filename> + </secondary> + </indexterm> + <para> + This file is used to hold messages generated by the + kernel. These messages are then picked up by other programs, + such as <command>/sbin/klogd</command> or + <command>/bin/dmesg</command>. + </para> + </section> + + <section + id="s2-proc-loadavg"> + <title> + <filename>/proc/loadavg</filename> + </title> + <indexterm + significance="normal"> + <primary> + <filename>proc</filename> file system</primary> + <secondary> + <filename>/proc/loadavg</filename> + </secondary> + </indexterm> + <para> + This file provides a look at the load average in regard to + both the CPU and IO over time, as well as additional data + used by <command>uptime</command> and other + commands. A sample <filename>/proc/loadavg</filename> file looks similar + to the following: + </para> + + <screen> +0.20 0.18 0.12 1/80 11206 +</screen> +<!-- BZ#248718, changes "10 minute periods" to 15 --> + <para> + The first three columns measure CPU and IO utilization of the + last one, five, and 15 minute periods. The fourth column + shows the number of currently running processes and the total + number of processes. The last column displays the last + process ID used. + </para> + + <para>In addition, load average also refers to the number of processes ready to run (i.e. in the run queue, waiting for a CPU share.</para> + </section> + + <section + id="s2-proc-locks"> + <title> + <filename>/proc/locks</filename> + </title> + <indexterm + significance="normal"> + <primary> + <filename>proc</filename> file system</primary> + <secondary> + <filename>/proc/locks</filename> + </secondary> + </indexterm> + <para> + This file displays the files currently locked by the + kernel. The contents of this file contain internal kernel + debugging data and can vary tremendously, depending on the + use of the system. A sample <filename>/proc/locks</filename> file for a lightly + loaded system looks similar to the following: + </para> + + <screen> +1: POSIX ADVISORY WRITE 3568 fd:00:2531452 0 EOF +2: FLOCK ADVISORY WRITE 3517 fd:00:2531448 0 EOF +3: POSIX ADVISORY WRITE 3452 fd:00:2531442 0 EOF +4: POSIX ADVISORY WRITE 3443 fd:00:2531440 0 EOF +5: POSIX ADVISORY WRITE 3326 fd:00:2531430 0 EOF +6: POSIX ADVISORY WRITE 3175 fd:00:2531425 0 EOF +7: POSIX ADVISORY WRITE 3056 fd:00:2548663 0 EOF +</screen> + + <para> + Each lock has its own line which starts with a unique + number. The second column refers to the class of lock used, + with <computeroutput>FLOCK</computeroutput> + signifying the older-style UNIX file locks from a <command>flock</command> system call and + <computeroutput>POSIX</computeroutput> + representing the newer POSIX locks from the <command>lockf</command> system call. + </para> + + <para> + The third column can have two values: <computeroutput>ADVISORY</computeroutput> or <computeroutput>MANDATORY</computeroutput>. <computeroutput>ADVISORY</computeroutput> means that the lock + does not prevent other people from accessing the data; it + only prevents other attempts to lock it. <computeroutput>MANDATORY</computeroutput> means that no + other access to the data is permitted while the lock is + held. The fourth column reveals whether the lock is allowing + the holder <computeroutput>READ</computeroutput> or <computeroutput>WRITE</computeroutput> access to the + file. The fifth column shows the ID of the process holding + the lock. The sixth column shows the ID of the file being + locked, in the format of <computeroutput><replaceable>MAJOR-DEVICE</replaceable>:<replaceable>MINOR-DEVICE</replaceable>:<replaceable>INODE-NUMBER</replaceable> + </computeroutput>. The + seventh and eighth column shows the start and end of the + file's locked region. + </para> + </section> + + <section + id="s2-proc-mdstat"> + <title> + <filename>/proc/mdstat</filename> + </title> + <indexterm + significance="normal"> + <primary> + <filename>proc</filename> file system</primary> + <secondary> + <filename>/proc/mdstat</filename> + </secondary> + </indexterm> + <para> + This file contains the current information for multiple-disk, + RAID configurations. If the system does not contain such a + configuration, then <filename>/proc/mdstat</filename> looks similar to the + following: + </para> + + <screen> +Personalities : read_ahead not set unused devices: <none> +</screen> + + <para> + This file remains in the same state as seen above unless a + software RAID or <filename>md</filename> + device is present. In that case, view <filename>/proc/mdstat</filename> to find the current + status of <filename>md<replaceable>X</replaceable> + </filename> + RAID devices. + </para> + + <para> + The <filename>/proc/mdstat</filename> file + below shows a system with its <filename>md0</filename> configured as a RAID 1 device, + while it is currently re-syncing the disks: + </para> + + <screen> +Personalities : [linear] [raid1] read_ahead 1024 sectors +md0: active raid1 sda2[1] sdb2[0] 9940 blocks [2/2] [UU] resync=1% finish=12.3min algorithm 2 [3/3] [UUU] +unused devices: <none> +</screen> + </section> + + <section + id="s2-proc-meminfo"> + <title> + <filename>/proc/meminfo</filename> + </title> + <indexterm + significance="normal"> + <primary> + <filename>proc</filename> file system</primary> + <secondary> + <filename>/proc/meminfo</filename> + </secondary> + </indexterm> + <para> + This is one of the more commonly used files in the <filename>/proc/</filename> directory, as it reports a + large amount of valuable information about the systems RAM + usage. + </para> + + <para> + The following sample <filename>/proc/meminfo</filename> virtual file is from + a system with 256 MB of RAM and 512 MB of swap space: + </para> + + <screen> +MemTotal: 255908 kB +MemFree: 69936 kB +Buffers: 15812 kB +Cached: 115124 kB +SwapCached: 0 kB +Active: 92700 kB +Inactive: 63792 kB +HighTotal: 0 kB +HighFree: 0 kB +LowTotal: 255908 kB +LowFree: 69936 kB +SwapTotal: 524280 kB +SwapFree: 524280 kB +Dirty: 4 kB +Writeback: 0 kB +Mapped: 42236 kB +Slab: 25912 kB +Committed_AS: 118680 kB +PageTables: 1236 kB +VmallocTotal: 3874808 kB +VmallocUsed: 1416 kB +VmallocChunk: 3872908 kB +HugePages_Total: 0 +HugePages_Free: 0 +Hugepagesize: 4096 kB +</screen> + + <para> + Much of the information here is used by the <command>free</command>, <command>top</command>, and <command>ps</command> commands. In fact, the output of + the <command>free</command> command is + similar in appearance to the contents and structure of + <filename>/proc/meminfo</filename>. But by + looking directly at <filename>/proc/meminfo</filename>, more details are + revealed: + </para> + + <itemizedlist> + <listitem> + <para> + <computeroutput>MemTotal</computeroutput> + — Total amount of physical RAM, in kilobytes. + </para> + </listitem> + + <listitem> + <para> + <computeroutput>MemFree</computeroutput> + — The amount of physical RAM, in kilobytes, left + unused by the system. + </para> + </listitem> + + <listitem> + <para> + <computeroutput>Buffers</computeroutput> + — The amount of physical RAM, in kilobytes, used + for file buffers. + </para> + </listitem> + + <listitem> + <para> + <computeroutput>Cached</computeroutput> + — The amount of physical RAM, in kilobytes, used as + cache memory. + </para> + </listitem> + + <listitem> + <para> + <computeroutput>SwapCached</computeroutput> — The + amount of swap, in kilobytes, used as cache memory. + </para> + </listitem> + + <listitem> + <para> + <computeroutput>Active</computeroutput> + — The total amount of buffer or page cache memory, + in kilobytes, that is in active use. This is memory that + has been recently used and is usually not reclaimed for + other purposes. + </para> + </listitem> + + <listitem> + <para> + <computeroutput>Inactive</computeroutput> + — The total amount of buffer or page cache memory, + in kilobytes, that are free and available. This is memory + that has not been recently used and can be reclaimed for + other purposes. + </para> + </listitem> + + <listitem> + <para> + <computeroutput>HighTotal</computeroutput> and + <computeroutput>HighFree</computeroutput> + — The total and free amount of memory, in + kilobytes, that is not directly mapped into kernel + space. The <computeroutput>HighTotal</computeroutput> value can vary + based on the type of kernel used. + </para> + </listitem> + + <listitem> + <para> + <computeroutput>LowTotal</computeroutput> + and <computeroutput>LowFree</computeroutput> — The + total and free amount of memory, in kilobytes, that is + directly mapped into kernel space. The <computeroutput>LowTotal</computeroutput> value can vary + based on the type of kernel used. + </para> + </listitem> + + <listitem> + <para> + <computeroutput>SwapTotal</computeroutput> — The + total amount of swap available, in kilobytes. + </para> + </listitem> + + <listitem> + <para> + <computeroutput>SwapFree</computeroutput> + — The total amount of swap free, in kilobytes. + </para> + </listitem> + + <listitem> + <para> + <computeroutput>Dirty</computeroutput> + — The total amount of memory, in kilobytes, waiting + to be written back to the disk. + </para> + </listitem> + + <listitem> + <para> + <computeroutput>Writeback</computeroutput> — The + total amount of memory, in kilobytes, actively being + written back to the disk. + </para> + </listitem> + + <listitem> + <para> + <computeroutput>Mapped</computeroutput> + — The total amount of memory, in kilobytes, which + have been used to map devices, files, or libraries using + the <command>mmap</command> command. + </para> + </listitem> + + <listitem> + <para> + <computeroutput>Slab</computeroutput> + — The total amount of memory, in kilobytes, used by + the kernel to cache data structures for its own use. + </para> + </listitem> + + <listitem> + <para> + <computeroutput>Committed_AS</computeroutput> — The + total amount of memory, in kilobytes, estimated to + complete the workload. This value represents the worst + case scenario value, and also includes swap memory. + </para> + </listitem> + + <listitem> + <para> + <computeroutput>PageTables</computeroutput> — The + total amount of memory, in kilobytes, dedicated to the + lowest page table level. + </para> + </listitem> + + <listitem> + <para> + <computeroutput>VMallocTotal</computeroutput> — The + total amount of memory, in kilobytes, of total allocated + virtual address space. + </para> + </listitem> + + <listitem> + <para> + <computeroutput>VMallocUsed</computeroutput> — The + total amount of memory, in kilobytes, of used virtual + address space. + </para> + </listitem> + + <listitem> + <para> + <computeroutput>VMallocChunk</computeroutput> — The + largest contiguous block of memory, in kilobytes, of + available virtual address space. + </para> + </listitem> + + <listitem> + <para> + <computeroutput>HugePages_Total</computeroutput> — + The total number of hugepages for the system. The number + is derived by dividing <computeroutput>Hugepagesize</computeroutput> by the + megabytes set aside for hugepages specified in <filename>/proc/sys/vm/hugetlb_pool</filename>. <emphasis>This + statistic only appears on the x86, Itanium, and AMD64 + architectures.</emphasis> + </para> + </listitem> + + <listitem> + <para> + <computeroutput>HugePages_Free</computeroutput> — + The total number of hugepages available for the + system. <emphasis>This statistic only appears on the x86, + Itanium, and AMD64 architectures.</emphasis> + </para> + </listitem> + + <listitem> + <para> + <computeroutput>Hugepagesize</computeroutput> — The + size for each hugepages unit in kilobytes. By default, + the value is 4096 KB on uniprocessor kernels for 32 bit + architectures. For SMP, hugemem kernels, and AMD64, the + default is 2048 KB. For Itanium architectures, the + default is 262144 KB. <emphasis>This statistic only + appears on the x86, Itanium, and AMD64 + architectures.</emphasis> + </para> + </listitem> + </itemizedlist> + </section> + + <section + id="s2-proc-misc"> + <title> + <filename>/proc/misc</filename> + </title> + <indexterm + significance="normal"> + <primary> + <filename>proc</filename> file system</primary> + <secondary> + <filename>/proc/misc</filename> + </secondary> + </indexterm> + <para> + This file lists miscellaneous drivers registered on the + miscellaneous major device, which is device number 10: + </para> + + <screen> +63 device-mapper 175 agpgart 135 rtc 134 apm_bios +</screen> + + <para> + The first column is the minor number of each device, while + the second column shows the driver in use. + </para> + </section> + + <section + id="s2-proc-modules"> + <title> + <filename>/proc/modules</filename> + </title> + <indexterm + significance="normal"> + <primary> + <filename>proc</filename> file system</primary> + <secondary> + <filename>/proc/modules</filename> + </secondary> + </indexterm> + <para> + This file displays a list of all modules loaded into the + kernel. Its contents vary based on the configuration and use + of your system, but it should be organized in a similar + manner to this sample <filename>/proc/modules</filename> file output: + </para> + + <note> + <title>Note</title> + + <para> + This example has been reformatted into a readable + format. Most of this information can also be viewed via the + <command>/sbin/lsmod</command> command. + </para> + </note> + + + <screen> +nfs 170109 0 - Live 0x129b0000 +lockd 51593 1 nfs, Live 0x128b0000 +nls_utf8 1729 0 - Live 0x12830000 +vfat 12097 0 - Live 0x12823000 +fat 38881 1 vfat, Live 0x1287b000 +autofs4 20293 2 - Live 0x1284f000 +sunrpc 140453 3 nfs,lockd, Live 0x12954000 +3c59x 33257 0 - Live 0x12871000 +uhci_hcd 28377 0 - Live 0x12869000 +md5 3777 1 - Live 0x1282c000 +ipv6 211845 16 - Live 0x128de000 +ext3 92585 2 - Live 0x12886000 +jbd 65625 1 ext3, Live 0x12857000 +dm_mod 46677 3 - Live 0x12833000 +</screen> + + + <para> + The first column contains the name of the module. + </para> + + <para> + The second column refers to the memory size of the module, in + bytes. + </para> + + <para> + The third column lists how many instances of the module are + currently loaded. A value of zero represents an unloaded + module. + </para> + + <para> + The fourth column states if the module depends upon another + module to be present in order to function, and lists those + other modules. + </para> + + <para> + The fifth column lists what load state the module is in: + <command>Live</command>, <command>Loading</command>, or <command>Unloading</command> are the only possible + values. + </para> + + <para> + The sixth column lists the current kernel memory offset for + the loaded module. This information can be useful for + debugging purposes, or for profiling tools such as <filename>oprofile</filename>. + </para> + </section> + + <section + id="s2-proc-mounts"> + <title> + <filename>/proc/mounts</filename> + </title> + <indexterm + significance="normal"> + <primary> + <filename>proc</filename> file system</primary> + <secondary> + <filename>/proc/mounts</filename> + </secondary> + </indexterm> + <para> + This file provides a list of all mounts in use by the system: + </para> + + <screen> +rootfs / rootfs rw 0 0 +/proc /proc proc rw,nodiratime 0 0 none +/dev ramfs rw 0 0 +/dev/mapper/VolGroup00-LogVol00 / ext3 rw 0 0 +none /dev ramfs rw 0 0 +/proc /proc proc rw,nodiratime 0 0 +/sys /sys sysfs rw 0 0 +none /dev/pts devpts rw 0 0 +usbdevfs /proc/bus/usb usbdevfs rw 0 0 +/dev/hda1 /boot ext3 rw 0 0 +none /dev/shm tmpfs rw 0 0 +none /proc/sys/fs/binfmt_misc binfmt_misc rw 0 0 +sunrpc /var/lib/nfs/rpc_pipefs rpc_pipefs rw 0 0 +</screen> +<!-- https://bugzilla.redhat.com/show_bug.cgi?id=561622#c8 +typo corrected + --> + <para> + The output found here is similar to the contents of <filename>/etc/mtab</filename>, except that <filename>/proc/mounts</filename> is more up-to-date. + </para> + + <para> + The first column specifies the device that is mounted, the + second column reveals the mount point, and the third column + tells the file system type, and the fourth column tells you + if it is mounted read-only (<computeroutput>ro</computeroutput>) or read-write + (<computeroutput>rw</computeroutput>). The + fifth and sixth columns are dummy values designed to match + the format used in <filename>/etc/mtab</filename>. + </para> + </section> + + <section + id="s2-proc-mtrr"> + <title> + <filename>/proc/mtrr</filename> + </title> + <indexterm + significance="normal"> + <primary> + <filename>proc</filename> file system</primary> + <secondary> + <filename>/proc/mtrr</filename> + </secondary> + </indexterm> + <para> + This file refers to the current Memory Type Range Registers + (MTRRs) in use with the system. If the system architecture + supports MTRRs, then the <filename>/proc/mtrr</filename> file may look similar + to the following: + </para> + + <screen> +reg00: base=0x00000000 ( 0MB), size= 256MB: write-back, count=1 +reg01: base=0xe8000000 (3712MB), size= 32MB: write-combining, count=1 +</screen> + + <para> + MTRRs are used with the Intel P6 family of processors + (Pentium II and higher) and control processor access to + memory ranges. When using a video card on a PCI or AGP bus, a + properly configured <filename>/proc/mtrr</filename> file can increase + performance more than 150%. + </para> + + <para> + Most of the time, this value is properly configured by + default. More information on manually configuring this file + can be found locally at the following location: + </para> + + <screen> +/usr/share/doc/kernel-doc-<replaceable>version</replaceable>/Documentation/mtrr.txt +</screen> + </section> + + <section + id="s2-proc-partitions"> + <title> + <filename>/proc/partitions</filename> + </title> + <indexterm + significance="normal"> + <primary> + <filename>proc</filename> file system</primary> + <secondary> + <filename>/proc/partitions</filename> + </secondary> + </indexterm> + <para> + This file contains partition block allocation information. A + sampling of this file from a basic system looks similar to + the following: + </para> + + <screen> +major minor #blocks name + 3 0 19531250 hda + 3 1 104391 hda1 + 3 2 19422585 hda2 +253 0 22708224 dm-0 +253 1 524288 dm-1 +</screen> + + <para> + Most of the information here is of little importance to the + user, except for the following columns: + </para> + + <itemizedlist> + <listitem> + <para> + <computeroutput>major</computeroutput> + — The major number of the device with this + partition. The major number in the <filename>/proc/partitions</filename>, + (<computeroutput>3</computeroutput>), + corresponds with the block device <computeroutput>ide0</computeroutput>, in <filename>/proc/devices</filename>. + </para> + </listitem> + + <listitem> + <para> + <computeroutput>minor</computeroutput> + — The minor number of the device with this + partition. This serves to separate the partitions into + different physical devices and relates to the number at + the end of the name of the partition. + </para> + </listitem> + + <listitem> + <para> + <computeroutput>#blocks</computeroutput> + — Lists the number of physical disk blocks + contained in a particular partition. + </para> + </listitem> + + <listitem> + <para> + <computeroutput>name</computeroutput> + — The name of the partition. + </para> + </listitem> + </itemizedlist> + </section> + + <section + id="s2-proc-pci"> + <title> + <filename>/proc/pci</filename> + </title> + <indexterm + significance="normal"> + <primary> + <filename>proc</filename> file system</primary> + <secondary> + <filename>/proc/pci</filename> + </secondary> + <tertiary>viewing using <command>lspci</command> + </tertiary> + </indexterm> + <indexterm + significance="normal"> + <primary> + <command>lspci</command> + </primary> + </indexterm> + <para> + This file contains a full listing of every PCI device on the + system. Depending on the number of PCI devices, <filename>/proc/pci</filename> can be rather long. A + sampling of this file from a basic system looks similar to + the following: + </para> + + + <screen> +Bus 0, device 0, function 0: Host bridge: Intel Corporation 440BX/ZX - 82443BX/ZX Host bridge (rev 3). Master Capable. Latency=64. Prefetchable 32 bit memory at 0xe4000000 [0xe7ffffff]. +Bus 0, device 1, function 0: PCI bridge: Intel Corporation 440BX/ZX - 82443BX/ZX AGP bridge (rev 3). Master Capable. Latency=64. Min Gnt=128. +Bus 0, device 4, function 0: ISA bridge: Intel Corporation 82371AB PIIX4 ISA (rev 2). +Bus 0, device 4, function 1: IDE interface: Intel Corporation 82371AB PIIX4 IDE (rev 1). Master Capable. Latency=32. I/O at 0xd800 [0xd80f]. +Bus 0, device 4, function 2: USB Controller: Intel Corporation 82371AB PIIX4 USB (rev 1). IRQ 5. Master Capable. Latency=32. I/O at 0xd400 [0xd41f]. +Bus 0, device 4, function 3: Bridge: Intel Corporation 82371AB PIIX4 ACPI (rev 2). IRQ 9. +Bus 0, device 9, function 0: Ethernet controller: Lite-On Communications Inc LNE100TX (rev 33). IRQ 5. Master Capable. Latency=32. I/O at 0xd000 [0xd0ff]. +Bus 0, device 12, function 0: VGA compatible controller: S3 Inc. ViRGE/DX or /GX (rev 1). IRQ 11. Master Capable. Latency=32. Min Gnt=4.Max Lat=255. +</screen> + + <para> + This output shows a list of all PCI devices, sorted in the + order of bus, device, and function. Beyond providing the + name and version of the device, this list also gives + detailed IRQ information so an administrator can quickly + look for conflicts. + </para> + + <note> + <title>Tip</title> + <para> + To get a more readable version of this information, type: + </para> + + <screen> +/sbin/lspci -vb +</screen> + </note> + </section> + + <section + id="s2-proc-slabinfo"> + <title> + <filename>/proc/slabinfo</filename> + </title> + <indexterm + significance="normal"> + <primary> + <filename>proc</filename> file system</primary> + <secondary> + <filename>/proc/slabinfo</filename> + </secondary> + </indexterm> + <indexterm + significance="normal"> + <primary>slab pools</primary> + <see> + <filename>/proc/slabinfo</filename> + </see> + </indexterm> + <para> + This file gives full information about memory usage on the + <firstterm>slab</firstterm> level. Linux kernels greater than + version 2.2 use <firstterm>slab pools</firstterm> to manage + memory above the page level. Commonly used objects have their + own slab pools. + </para> + + <para> + Instead of parsing the highly verbose <filename>/proc/slabinfo</filename> file manually, the + <filename>/usr/bin/slabtop</filename> program + displays kernel slab cache information in real time. This + program allows for custom configurations, including column + sorting and screen refreshing. + </para> + + <para> + A sample screen shot of <filename>/usr/bin/slabtop</filename> usually looks + like the following example: + </para> + + <screen> +Active / Total Objects (% used) : 133629 / 147300 (90.7%) +Active / Total Slabs (% used) : 11492 / 11493 (100.0%) +Active / Total Caches (% used) : 77 / 121 (63.6%) +Active / Total Size (% used) : 41739.83K / 44081.89K (94.7%) +Minimum / Average / Maximum Object : 0.01K / 0.30K / 128.00K +OBJS ACTIVE USE OBJ SIZE SLABS OBJ/SLAB CACHE SIZE NAME +44814 43159 96% 0.62K 7469 6 29876K ext3_inode_cache +36900 34614 93% 0.05K 492 75 1968K buffer_head +35213 33124 94% 0.16K 1531 23 6124K dentry_cache +7364 6463 87% 0.27K 526 14 2104K radix_tree_node +2585 1781 68% 0.08K 55 47 220K vm_area_struct +2263 2116 93% 0.12K 73 31 292K size-128 +1904 1125 59% 0.03K 16 119 64K size-32 +1666 768 46% 0.03K 14 119 56K anon_vma +1512 1482 98% 0.44K 168 9 672K inode_cache +1464 1040 71% 0.06K 24 61 96K size-64 +1320 820 62% 0.19K 66 20 264K filp +678 587 86% 0.02K 3 226 12K dm_io +678 587 86% 0.02K 3 226 12K dm_tio +576 574 99% 0.47K 72 8 288K proc_inode_cache +528 514 97% 0.50K 66 8 264K size-512 +492 372 75% 0.09K 12 41 48K bio +465 314 67% 0.25K 31 15 124K size-256 +452 331 73% 0.02K 2 226 8K biovec-1 +420 420 100% 0.19K 21 20 84K skbuff_head_cache +305 256 83% 0.06K 5 61 20K biovec-4 +290 4 1% 0.01K 1 290 4K revoke_table +264 264 100% 4.00K 264 1 1056K size-4096 +260 256 98% 0.19K 13 20 52K biovec-16 +260 256 98% 0.75K 52 5 208K biovec-64 +</screen> + + <para> + Some of the more commonly used statistics in <filename>/proc/slabinfo</filename> that are included + into <filename>/usr/bin/slabtop</filename> + include: + </para> + + <itemizedlist> + <listitem> + <para> + <computeroutput>OBJS</computeroutput> + — The total number of objects (memory blocks), + including those in use (allocated), and some spares not + in use. + </para> + </listitem> + + <listitem> + <para> + <computeroutput>ACTIVE</computeroutput> + — The number of objects (memory blocks) that are + in use (allocated). + </para> + </listitem> + + <listitem> + <para> + <computeroutput>USE</computeroutput> + — Percentage of total objects that are + active. ((ACTIVE/OBJS)(100)) + </para> + </listitem> + + <listitem> + <para> + <computeroutput>OBJ + SIZE</computeroutput> — The size of the objects. + </para> + </listitem> + + <listitem> + <para> + <computeroutput>SLABS</computeroutput> + — The total number of slabs. + </para> + </listitem> + + <listitem> + <para> + <computeroutput>OBJ/SLAB</computeroutput> — The + number of objects that fit into a slab. + </para> + </listitem> + + <listitem> + <para> + <computeroutput>CACHE + SIZE</computeroutput> — The cache size of the + slab. + </para> + </listitem> + + <listitem> + <para> + <computeroutput>NAME</computeroutput> + — The name of the slab. + </para> + </listitem> + </itemizedlist> + + <para> + For more information on the <filename>/usr/bin/slabtop</filename> program, refer + to the <filename>slabtop</filename> man + page. + </para> + </section> + + <section + id="s2-proc-stat"> + <title> + <filename>/proc/stat</filename> + </title> + <indexterm + significance="normal"> + <primary> + <filename>proc</filename> file system</primary> + <secondary> + <filename>/proc/stat</filename> + </secondary> + </indexterm> + <indexterm + significance="normal"> + <primary>epoch</primary> + <secondary>definition of</secondary> + </indexterm> + <indexterm + significance="normal"> + <primary>epoch</primary> + <seealso> + <filename>/proc/stat</filename> + </seealso> + </indexterm> + <para> + This file keeps track of a variety of different statistics + about the system since it was last restarted. The contents + of <filename>/proc/stat</filename>, which + can be quite long, usually begins like the following + example: + </para> + + <screen> +cpu 259246 7001 60190 34250993 137517 772 0 +cpu0 259246 7001 60190 34250993 137517 772 0 +intr 354133732 347209999 2272 0 4 4 0 0 3 1 1249247 0 0 80143 0 422626 5169433 +ctxt 12547729 +btime 1093631447 +processes 130523 +procs_running 1 +procs_blocked 0 +preempt 5651840 +cpu 209841 1554 21720 118519346 72939 154 27168 +cpu0 42536 798 4841 14790880 14778 124 3117 +cpu1 24184 569 3875 14794524 30209 29 3130 +cpu2 28616 11 2182 14818198 4020 1 3493 +cpu3 35350 6 2942 14811519 3045 0 3659 +cpu4 18209 135 2263 14820076 12465 0 3373 +cpu5 20795 35 1866 14825701 4508 0 3615 +cpu6 21607 0 2201 14827053 2325 0 3334 +cpu7 18544 0 1550 14831395 1589 0 3447 +intr 15239682 14857833 6 0 6 6 0 5 0 1 0 0 0 29 0 2 0 0 0 0 0 0 0 94982 0 286812 +ctxt 4209609 +btime 1078711415 +processes 21905 +procs_running 1 +procs_blocked 0 +</screen> + + <para> + Some of the more commonly used statistics include: + </para> + + <itemizedlist> + <listitem> + <para> + <computeroutput>cpu</computeroutput> + — Measures the number of + <firstterm>jiffies</firstterm> (1/100 of a second for + x86 systems) that the system has been in user mode, user + mode with low priority (nice), system mode, idle task, + I/O wait, IRQ (hardirq), and softirq respectively. The + IRQ (hardirq) is the direct response to a hardware + event. The IRQ takes minimal work for queuing the + "heavy" work up for the softirq to execute. The softirq + runs at a lower priority than the IRQ and therefore may + be interrupted more frequently. The total for all CPUs + is given at the top, while each individual CPU is listed + below with its own statistics. The following example is + a 4-way Intel Pentium Xeon configuration with + multi-threading enabled, therefore showing four physical + processors and four virtual processors totaling eight + processors. + </para> + </listitem> + + <listitem> + <para> + <computeroutput>page</computeroutput> + — The number of memory pages the system has + written in and out to disk. + </para> + </listitem> + + <listitem> + <para> + <computeroutput>swap</computeroutput> + — The number of swap pages the system has brought + in and out. + </para> + </listitem> + + <listitem> + <para> + <computeroutput>intr</computeroutput> + — The number of interrupts the system has + experienced. + </para> + </listitem> + + <listitem> + <para> + <computeroutput>btime</computeroutput> + — The boot time, measured in the number of seconds + since January 1, 1970, otherwise known as the + <firstterm>epoch</firstterm>. + </para> + </listitem> + </itemizedlist> + </section> + + <section + id="s2-proc-swaps"> + <title> + <filename>/proc/swaps</filename> + </title> + <indexterm + significance="normal"> + <primary> + <filename>proc</filename> file system</primary> + <secondary> + <filename>/proc/swaps</filename> + </secondary> + </indexterm> + <para> + This file measures swap space and its utilization. For a + system with only one swap partition, the output of <filename>/proc/swaps</filename> may look similar to + the following: + </para> + + <screen> +Filename Type Size Used Priority +/dev/mapper/VolGroup00-LogVol01 partition 524280 0 -1 +</screen> + + <para> + While some of this information can be found in other files + in the <filename>/proc/</filename> + directory, <filename>/proc/swap</filename> + provides a snapshot of every swap file name, the type of + swap space, the total size, and the amount of space in use + (in kilobytes). The priority column is useful when multiple + swap files are in use. The lower the priority, the more + likely the swap file is to be used. + </para> + </section> + + <section + id="s2-proc-sysrq-trigger"> + <title> + <filename>/proc/sysrq-trigger</filename> + </title> + <indexterm + significance="normal"> + <primary> + <filename>proc</filename> file system</primary> + <secondary> + <filename>/proc/sysrq-trigger</filename> + </secondary> + </indexterm> + <para> + Using the <command>echo</command> command to + write to this file, a remote root user can execute most + System Request Key commands remotely as if at the local + terminal. To <command>echo</command> values + to this file, the <filename>/proc/sys/kernel/sysrq</filename> must be + set to a value other than <computeroutput>0</computeroutput>. For more information + about the System Request Key, refer to <xref + linkend="s3-proc-sys-kernel"/>. + </para> + + <para> + Although it is possible to write to this file, it cannot be + read, even by the root user. + </para> + </section> + + <section + id="s2-proc-uptime"> + <title> + <filename>/proc/uptime</filename> + </title> + <indexterm + significance="normal"> + <primary> + <filename>proc</filename> file system</primary> + <secondary> + <filename>/proc/uptime</filename> + </secondary> + </indexterm> + <para> + This file contains information detailing how long the system + has been on since its last restart. The output of <filename>/proc/uptime</filename> is quite minimal: + </para> + + <screen> +350735.47 234388.90 +</screen> + + <para> + The first number is the total number of seconds the system + has been up. The second number is how much of that time the + machine has spent idle, in seconds. + </para> + </section> + + <section + id="s2-proc-version"> + <title> + <filename>/proc/version</filename> + </title> + <indexterm + significance="normal"> + <primary> + <filename>proc</filename> file system</primary> + <secondary> + <filename>/proc/version</filename> + </secondary> + </indexterm> + + <para> +This file specifies the version of the Linux kernel, the version of +<command>gcc</command> used to compile the kernel, and the time of +kernel compilation. It also contains the kernel compiler's user name +(in parentheses). +</para> + + +<!-- https://bugzilla.redhat.com/show_bug.cgi?id=561622#c8 +WRONG. above replaces below +<para> + This file specifies the version of the Linux kernel and + <filename>gcc</filename> in use, as well as + the version of Red Hat Enterprise Linux installed on the + system: + </para> + --> + <screen> +Linux version 2.6.8-1.523 (user@foo.redhat.com) (gcc version 3.4.1 20040714 \ (Red Hat Enterprise Linux 3.4.1-7)) #1 Mon Aug 16 13:27:03 EDT 2004 +</screen> + + + <para> + This information is used for a variety of purposes, + including the version data presented when a user logs in. + </para> + </section> + </section> + <section + id="s1-proc-directories"> + <title>Directories within <filename>/proc/</filename> + </title> + <indexterm + significance="normal"> + <primary> + <filename>proc</filename> file system</primary> + <secondary>subdirectories within</secondary> + </indexterm> + <para> + Common groups of information concerning the kernel are grouped + into directories and subdirectories within the <filename + moreinfo="none">/proc/</filename> directory. + </para> + + <section + id="s2-proc-processdirs"> + <title>Process Directories</title> + <indexterm + significance="normal"> + <primary> + <filename>proc</filename> file system</primary> + <secondary>process directories</secondary> + </indexterm> + <para> + Every <filename>/proc/</filename> directory + contains a number of directories with numerical names. A + listing of them may be similar to the following: + </para> + + + <screen> +dr-xr-xr-x 3 root root 0 Feb 13 01:28 1 +dr-xr-xr-x 3 root root 0 Feb 13 01:28 1010 +dr-xr-xr-x 3 xfs xfs 0 Feb 13 01:28 1087 +dr-xr-xr-x 3 daemon daemon 0 Feb 13 01:28 1123 +dr-xr-xr-x 3 root root 0 Feb 13 01:28 11307 +dr-xr-xr-x 3 apache apache 0 Feb 13 01:28 13660 +dr-xr-xr-x 3 rpc rpc 0 Feb 13 01:28 637 +dr-xr-xr-x 3 rpcuser rpcuser 0 Feb 13 01:28 666 +</screen> + + <para> + These directories are called <firstterm>process + directories</firstterm>, as they are named after a program's + process ID and contain information specific to that + process. The owner and group of each process directory is + set to the user running the process. When the process is + terminated, its <filename>/proc/</filename> + process directory vanishes. + </para> + + <para> + Each process directory contains the following files: + </para> + + <itemizedlist> + <listitem> + <para> + <computeroutput>cmdline</computeroutput> + — Contains the command issued when starting the + process. + </para> + </listitem> + + <listitem> + <para> + <computeroutput>cwd</computeroutput> + — A symbolic link to the current working directory + for the process. + </para> + </listitem> + + <listitem> + <para> + <computeroutput>environ</computeroutput> + — A list of the environment variables for the + process. The environment variable is given in all + upper-case characters, and the value is in lower-case + characters. + </para> + </listitem> + + <listitem> + <para> + <computeroutput>exe</computeroutput> + — A symbolic link to the executable of this + process. + </para> + </listitem> + + <listitem> + <para> + <computeroutput>fd</computeroutput> + — A directory containing all of the file + descriptors for a particular process. These are given in + numbered links: + </para> + + + <screen> +total 0 +lrwx------ 1 root root 64 May 8 11:31 0 -> /dev/null +lrwx------ 1 root root 64 May 8 11:31 1 -> /dev/null +lrwx------ 1 root root 64 May 8 11:31 2 -> /dev/null +lrwx------ 1 root root 64 May 8 11:31 3 -> /dev/ptmx +lrwx------ 1 root root 64 May 8 11:31 4 -> socket:[7774817] +lrwx------ 1 root root 64 May 8 11:31 5 -> /dev/ptmx +lrwx------ 1 root root 64 May 8 11:31 6 -> socket:[7774829] +lrwx------ 1 root root 64 May 8 11:31 7 -> /dev/ptmx +</screen> + </listitem> + + <listitem> + <para> + <computeroutput>maps</computeroutput> + — A list of memory maps to the various executables + and library files associated with this process. This + file can be rather long, depending upon the complexity + of the process, but sample output from the <command>sshd</command> process begins like the + following: + </para> + + <screen> +08048000-08086000 r-xp 00000000 03:03 391479 /usr/sbin/sshd +08086000-08088000 rw-p 0003e000 03:03 391479 /usr/sbin/sshd +08088000-08095000 rwxp 00000000 00:00 0 +40000000-40013000 r-xp 0000000 03:03 293205 /lib/ld-2.2.5.so +40013000-40014000 rw-p 00013000 03:03 293205 /lib/ld-2.2.5.so +40031000-40038000 r-xp 00000000 03:03 293282 /lib/libpam.so.0.75 +40038000-40039000 rw-p 00006000 03:03 293282 /lib/libpam.so.0.75 +40039000-4003a000 rw-p 00000000 00:00 0 +4003a000-4003c000 r-xp 00000000 03:03 293218 /lib/libdl-2.2.5.so +4003c000-4003d000 rw-p 00001000 03:03 293218 /lib/libdl-2.2.5.so +</screen> + </listitem> + + <listitem> + <para> + <computeroutput>mem</computeroutput> + — The memory held by the process. This file cannot + be read by the user. + </para> + </listitem> + + <listitem> + <para> + <computeroutput>root</computeroutput> + — A link to the root directory of the process. + </para> + </listitem> + + <listitem> + <para> + <computeroutput>stat</computeroutput> + — The status of the process. + </para> + </listitem> + + <listitem> + <para> + <computeroutput>statm</computeroutput> + — The status of the memory in use by the + process. Below is a sample <filename>/proc/statm</filename> file: + </para> + + + <screen> +263 210 210 5 0 205 0 +</screen> + + <para> + The seven columns relate to different memory statistics for the process. From left to right, they report the following aspects of the memory used: + </para> + + <orderedlist + inheritnum="ignore" + continuation="restarts"> + <listitem> + <para> + Total program size, in kilobytes. + </para> + </listitem> + + <listitem> + <para> + Size of memory portions, in kilobytes. + </para> + </listitem> + + <listitem> + <para> + Number of pages that are shared. + </para> + </listitem> + + <listitem> + <para> + Number of pages that are code. + </para> + </listitem> + + <listitem> + <para> + Number of pages of data/stack. + </para> + </listitem> + + <listitem> + <para> + Number of library pages. + </para> + </listitem> + + <listitem> + <para> + Number of dirty pages. + </para> + </listitem> + </orderedlist> + </listitem> + + <listitem> + <para> + <computeroutput>status</computeroutput> + — The status of the process in a more readable + form than <filename>stat</filename> or + <filename>statm</filename>. Sample + output for <command>sshd</command> looks + similar to the following: + </para> + + <screen> +Name: sshd +State: S (sleeping) +Tgid: 797 +Pid: 797 +PPid: 1 +TracerPid: 0 +Uid: 0 0 0 0 +Gid: 0 0 0 0 +FDSize: 32 +Groups: +VmSize: 3072 kB +VmLck: 0 kB +VmRSS: 840 kB +VmData: 104 kB +VmStk: 12 kB +VmExe: 300 kB +VmLib: 2528 kB +SigPnd: 0000000000000000 +SigBlk: 0000000000000000 +SigIgn: 8000000000001000 +SigCgt: 0000000000014005 +CapInh: 0000000000000000 +CapPrm: 00000000fffffeff +CapEff: 00000000fffffeff +</screen> + + <para> + The information in this output includes the process name + and ID, the state (such as <computeroutput>S (sleeping)</computeroutput> or + <computeroutput>R + (running)</computeroutput>), user/group ID running the + process, and detailed data regarding memory usage. + </para> + </listitem> + </itemizedlist> + + <section + id="s3-proc-self"> + <title> + <filename>/proc/self/</filename> + </title> + <indexterm + significance="normal"> + <primary> + <filename>proc</filename> file system</primary> + <secondary> + <filename>/proc/self/</filename> directory</secondary> + </indexterm> + <para> + The <filename>/proc/self/</filename> + directory is a link to the currently running process. This + allows a process to look at itself without having to know + its process ID. + </para> + + <para> + Within a shell environment, a listing of the <filename>/proc/self/</filename> directory produces + the same contents as listing the process directory for + that process. + </para> + </section> + </section> + + <section + id="s2-proc-dir-bus"> + <title> + <filename>/proc/bus/</filename> + </title> + <indexterm + significance="normal"> + <primary> + <filename>proc</filename> file system</primary> + <secondary> + <filename>/proc/bus/</filename> directory</secondary> + </indexterm> + <para> + This directory contains information specific to the various + buses available on the system. For example, on a standard + system containing PCI and USB buses, current data on each of + these buses is available within a subdirectory within + <filename>/proc/bus/</filename> by the same + name, such as <filename>/proc/bus/pci/</filename>. + </para> + + <para> + The subdirectories and files available within <filename>/proc/bus/</filename> vary depending on the + devices connected to the system. However, each bus type has + at least one directory. Within these bus directories are + normally at least one subdirectory with a numerical name, + such as <filename>001</filename>, which + contain binary files. + </para> + + <para> + For example, the <filename>/proc/bus/usb/</filename> subdirectory + contains files that track the various devices on any USB + buses, as well as the drivers required for them. The + following is a sample listing of a <filename>/proc/bus/usb/</filename> directory: + </para> + + <screen> +total 0 dr-xr-xr-x 1 root root 0 May 3 16:25 001 +-r--r--r-- 1 root root 0 May 3 16:25 devices +-r--r--r-- 1 root root 0 May 3 16:25 drivers +</screen> + + <para> + The <filename>/proc/bus/usb/001/</filename> + directory contains all devices on the first USB bus and the + <filename>devices</filename> file identifies + the USB root hub on the motherboard. + </para> + + <para> + The following is a example of a <filename>/proc/bus/usb/devices</filename> file: + </para> + + <screen> +T: Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=12 MxCh= 2 +B: Alloc= 0/900 us ( 0%), #Int= 0, #Iso= 0 +D: Ver= 1.00 Cls=09(hub ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1 +P: Vendor=0000 ProdID=0000 Rev= 0.00 +S: Product=USB UHCI Root Hub +S: SerialNumber=d400 +C:* #Ifs= 1 Cfg#= 1 Atr=40 MxPwr= 0mA +I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub +E: Ad=81(I) Atr=03(Int.) MxPS= 8 Ivl=255ms +</screen> + </section> + + <section + id="s2-proc-dir-driver"> + <title> + <filename>/proc/driver/</filename> + </title> + <indexterm + significance="normal"> + <primary> + <filename>proc</filename> file system</primary> + <secondary> + <filename>/proc/driver/</filename> directory</secondary> + </indexterm> + <para> + This directory contains information for specific drivers in + use by the kernel. + </para> + + <para> + A common file found here is <filename>rtc</filename> which provides output from + the driver for the system's <firstterm>Real Time Clock + (RTC)</firstterm>, the device that keeps the time while the + system is switched off. Sample output from <filename>/proc/driver/rtc</filename> looks like the + following: + </para> + + <screen> +rtc_time : 16:21:00 +rtc_date : 2004-08-31 +rtc_epoch : 1900 +alarm : 21:16:27 +DST_enable : no +BCD : yes +24hr : yes +square_wave : no +alarm_IRQ : no +update_IRQ : no +periodic_IRQ : no +periodic_freq : 1024 +batt_status : okay +</screen> + + <para> + For more information about the RTC, refer to the following + installed documentation: + </para> + + <para> + <filename>/usr/share/doc/kernel-doc-<replaceable>version</replaceable>/Documentation/rtc.txt</filename>. + </para> + </section> + + <section + id="s2-proc-dir-fs"> + <title> + <filename>/proc/fs</filename> + </title> + <indexterm + significance="normal"> + <primary> + <filename>proc</filename> file system</primary> + <secondary> + <filename>/proc/fs/</filename> directory</secondary> + </indexterm> + <para> + This directory shows which file systems are exported. If + running an NFS server, typing <command>cat + /proc/fs/nfsd/exports</command> displays the file systems + being shared and the permissions granted for those file + systems. For more on file system sharing with NFS, refer to + the <citetitle pubwork="chapter">Network File System (NFS)</citetitle> chapter of the <citetitle>Storage Administration Guide</citetitle>. + </para> + </section> + + <section + id="s2-proc-dir-irq"> + <title> + <filename>/proc/irq/</filename> + </title> + <indexterm + significance="normal"> + <primary> + <filename>proc</filename> file system</primary> + <secondary> + <filename>/proc/irq/</filename> directory</secondary> + </indexterm> + <para> + This directory is used to set IRQ to CPU affinity, which + allows the system to connect a particular IRQ to only one + CPU. Alternatively, it can exclude a CPU from handling any + IRQs. + </para> + + <para> + Each IRQ has its own directory, allowing for the individual + configuration of each IRQ. The <filename>/proc/irq/prof_cpu_mask</filename> file is a + bitmask that contains the default values for the <filename>smp_affinity</filename> file in the IRQ + directory. The values in <filename>smp_affinity</filename> specify which CPUs + handle that particular IRQ. + </para> + + <para> + For more information about the <filename>/proc/irq/</filename> directory, refer to the + following installed documentation: + </para> + + <screen> +/usr/share/doc/kernel-doc-<replaceable>version</replaceable>/Documentation/filesystems/proc.txt +</screen> + </section> + + <section + id="s2-proc-dir-net"> + <title> + <filename>/proc/net/</filename> + </title> + <indexterm + significance="normal"> + <primary> + <filename>proc</filename> file system</primary> + <secondary> + <filename>/proc/net/</filename> directory</secondary> + </indexterm> + <para> + This directory provides a comprehensive look at various + networking parameters and statistics. Each directory and + virtual file within this directory describes aspects of the + system's network configuration. Below is a partial list of + the <filename>/proc/net/</filename> + directory: + </para> + + <itemizedlist> + <listitem> + <para> + <filename>arp</filename> — Lists + the kernel's ARP table. This file is particularly useful + for connecting a hardware address to an IP address on a + system. + </para> + </listitem> + + <listitem> + <para> + <filename>atm/</filename> directory + — The files within this directory contain + <firstterm>Asynchronous Transfer Mode (ATM)</firstterm> + settings and statistics. This directory is primarily used + with ATM networking and ADSL cards. + </para> + </listitem> + + <listitem> + <para> + <filename>dev</filename> — Lists + the various network devices configured on the system, + complete with transmit and receive statistics. This file + displays the number of bytes each interface has sent and + received, the number of packets inbound and outbound, the + number of errors seen, the number of packets dropped, and + more. + </para> + </listitem> + + <listitem> + <para> + <filename>dev_mcast</filename> — + Lists Layer2 multicast groups on which each device is + listening. + </para> + </listitem> + + <listitem> + <para> + <filename>igmp</filename> — Lists + the IP multicast addresses which this system joined. + </para> + </listitem> + + <listitem> + <para> + <filename>ip_conntrack</filename> — + Lists tracked network connections for machines that are + forwarding IP connections. + </para> + </listitem> + + <listitem> + <para> + <filename>ip_tables_names</filename> + — Lists the types of <command>iptables</command> in use. This file is + only present if <command>iptables</command> is active on the + system and contains one or more of the following values: + <filename>filter</filename>, <filename>mangle</filename>, or <filename>nat</filename>. + </para> + </listitem> + + <listitem> + <para> + <filename>ip_mr_cache</filename> — + Lists the multicast routing cache. + </para> + </listitem> + + <listitem> + <para> + <filename>ip_mr_vif</filename> — + Lists multicast virtual interfaces. + </para> + </listitem> + + <listitem> + <para> + <filename>netstat</filename> — + Contains a broad yet detailed collection of networking + statistics, including TCP timeouts, SYN cookies sent and + received, and much more. + </para> + </listitem> + + <listitem> + <para> + <filename>psched</filename> — Lists + global packet scheduler parameters. + </para> + </listitem> + + <listitem> + <para> + <filename>raw</filename> — Lists + raw device statistics. + </para> + </listitem> + + <listitem> + <para> + <filename>route</filename> — Lists + the kernel's routing table. + </para> + </listitem> + + <listitem> + <para> + <filename>rt_cache</filename> — + Contains the current routing cache. + </para> + </listitem> + + <listitem> + <para> + <filename>snmp</filename> — List of + Simple Network Management Protocol (SNMP) data for + various networking protocols in use. + </para> + </listitem> + + <listitem> + <para> + <filename>sockstat</filename> — + Provides socket statistics. + </para> + </listitem> + + <listitem> + <para> + <filename>tcp</filename> — Contains + detailed TCP socket information. + </para> + </listitem> + + <listitem> + <para> + <filename>tr_rif</filename> — Lists + the token ring RIF routing table. + </para> + </listitem> + + <listitem> + <para> + <filename>udp</filename> — Contains + detailed UDP socket information. + </para> + </listitem> + + <listitem> + <para> + <filename>unix</filename> — Lists + UNIX domain sockets currently in use. + </para> + </listitem> + + <listitem> + <para> + <filename>wireless</filename> — + Lists wireless interface data. + </para> + </listitem> + </itemizedlist> + </section> + + <section + id="s2-proc-dir-scsi"> + <title> + <filename>/proc/scsi/</filename> + </title> + <indexterm + significance="normal"> + <primary> + <filename>proc</filename> file system</primary> + <secondary> + <filename>/proc/scsi/</filename> directory</secondary> + </indexterm> +<!-- BZ#561622, removed /proc/ide and all relevant references + <para> + This directory is analogous to the <filename + >/proc/ide/</filename> directory, but it is + for connected SCSI devices. + </para> --> + + <para> + The primary file in this directory is <filename>/proc/scsi/scsi</filename>, which contains a + list of every recognized SCSI device. From this listing, the + type of device, as well as the model name, vendor, SCSI + channel and ID data is available. + </para> + + <para> + For example, if a system contains a SCSI CD-ROM, a tape + drive, a hard drive, and a RAID controller, this file looks + similar to the following: + </para> + + + <screen> +Attached devices: +Host: scsi1 +Channel: 00 +Id: 05 +Lun: 00 +Vendor: NEC +Model: CD-ROM DRIVE:466 +Rev: 1.06 +Type: CD-ROM +ANSI SCSI revision: 02 +Host: scsi1 +Channel: 00 +Id: 06 +Lun: 00 +Vendor: ARCHIVE +Model: Python 04106-XXX +Rev: 7350 +Type: Sequential-Access +ANSI SCSI revision: 02 +Host: scsi2 +Channel: 00 +Id: 06 +Lun: 00 +Vendor: DELL +Model: 1x6 U2W SCSI BP +Rev: 5.35 +Type: Processor +ANSI SCSI revision: 02 +Host: scsi2 +Channel: 02 +Id: 00 +Lun: 00 +Vendor: MegaRAID +Model: LD0 RAID5 34556R +Rev: 1.01 +Type: Direct-Access +ANSI SCSI revision: 02 +</screen> + + <para> + Each SCSI driver used by the system has its own directory + within <filename>/proc/scsi/</filename>, + which contains files specific to each SCSI controller using + that driver. From the previous example, <filename>aic7xxx/</filename> and <filename>megaraid/</filename> directories are + present, since two drivers are in use. The files in each of + the directories typically contain an I/O address range, IRQ + information, and statistics for the SCSI controller using + that driver. Each controller can report a different type + and amount of information. The Adaptec AIC-7880 Ultra SCSI + host adapter's file in this example system produces the + following output: + </para> + + <screen> +Adaptec AIC7xxx driver version: 5.1.20/3.2.4 +Compile Options: +TCQ Enabled By Default : Disabled +AIC7XXX_PROC_STATS : Enabled +AIC7XXX_RESET_DELAY : 5 +Adapter Configuration: +SCSI Adapter: Adaptec AIC-7880 Ultra SCSI host adapter +Ultra Narrow Controller PCI MMAPed +I/O Base: 0xfcffe000 +Adapter SEEPROM Config: SEEPROM found and used. +Adaptec SCSI BIOS: Enabled +IRQ: 30 +SCBs: Active 0, Max Active 1, Allocated 15, HW 16, Page 255 +Interrupts: 33726 +BIOS Control Word: 0x18a6 +Adapter Control Word: 0x1c5f +Extended Translation: Enabled +Disconnect Enable Flags: 0x00ff +Ultra Enable Flags: 0x0020 +Tag Queue Enable Flags: 0x0000 +Ordered Queue Tag Flags: 0x0000 +Default Tag Queue Depth: 8 +Tagged Queue By Device array for aic7xxx +host instance 1: {255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255} +Actual queue depth per device for aic7xxx host instance 1: {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1} +Statistics: + +(scsi1:0:5:0) Device using Narrow/Sync transfers at 20.0 MByte/sec, offset 15 +Transinfo settings: current(12/15/0/0), goal(12/15/0/0), user(12/15/0/0) +Total transfers 0 (0 reads and 0 writes) + < 2K 2K+ 4K+ 8K+ 16K+ 32K+ 64K+ 128K+ +Reads: 0 0 0 0 0 0 0 0 +Writes: 0 0 0 0 0 0 0 0 + +(scsi1:0:6:0) Device using Narrow/Sync transfers at 10.0 MByte/sec, offset 15 +Transinfo settings: current(25/15/0/0), goal(12/15/0/0), user(12/15/0/0) +Total transfers 132 (0 reads and 132 writes) + < 2K 2K+ 4K+ 8K+ 16K+ 32K+ 64K+ 128K+ +Reads: 0 0 0 0 0 0 0 0 +Writes: 0 0 0 1 131 0 0 0 +</screen> + + <para> + This output reveals the transfer speed to the SCSI + devices connected to the controller based on channel ID, + as well as detailed statistics concerning the amount and + sizes of files read or written by that device. For + example, this controller is communicating with the + CD-ROM at 20 megabytes per second, while the tape drive + is only communicating at 10 megabytes per second. + </para> + </section> + + <section + id="s2-proc-dir-sys"> + <title> + <filename>/proc/sys/</filename> + </title> + <indexterm + significance="normal"> + <primary> + <filename>proc</filename> file system</primary> + <secondary> + <filename>/proc/sys/</filename> directory</secondary> + </indexterm> + <indexterm + significance="normal"> + <primary>system request key</primary> + <secondary>enabling</secondary> + </indexterm> + <indexterm + significance="normal"> + <primary> + <filename>proc</filename> file system</primary> + <secondary> + <filename>/proc/sys/</filename> directory</secondary> + <tertiary>/proc/sys/kernel/sysrq</tertiary> + <see>system request key</see> + </indexterm> + <indexterm + significance="normal"> + <primary> + <filename>proc</filename> file system</primary> + <secondary>changing files within</secondary> + </indexterm> + <indexterm + significance="normal"> + <primary>System Request Key</primary> + <secondary>definition of</secondary> + </indexterm> + <indexterm + significance="normal"> + <primary>SysRq</primary> + <see>system request key</see> + </indexterm> + <para> + The <filename>/proc/sys/</filename> + directory is different from others in <filename>/proc/</filename> because it not only + provides information about the system but also allows + the system administrator to immediately enable and + disable kernel features. + </para> + + <warning> + <title>Caution</title> + + <para> + Use caution when changing settings on a production + system using the various files in the <filename + moreinfo="none">/proc/sys/</filename> + directory. Changing the wrong setting may render the + kernel unstable, requiring a system reboot. + </para> + + <para> + For this reason, be sure the options are valid for + that file before attempting to change any value in + <filename>/proc/sys/</filename>. + </para> + </warning> + + <para> + A good way to determine if a particular file can be + configured, or if it is only designed to provide + information, is to list it with the <option>-l</option> + option at the shell prompt. If the file is writable, it + may be used to configure the kernel. For example, a + partial listing of <filename>/proc/sys/fs</filename> looks like the + following: + </para> +<!-- https://bugzilla.redhat.com/show_bug.cgi?id=561622#c10 +removed dquot-nr entry from screen --> + <screen> +-r--r--r-- 1 root root 0 May 10 16:14 dentry-state +-rw-r--r-- 1 root root 0 May 10 16:14 dir-notify-enable +-rw-r--r-- 1 root root 0 May 10 16:14 file-max +-r--r--r-- 1 root root 0 May 10 16:14 file-nr +</screen> + + <para> + In this listing, the files <filename>dir-notify-enable</filename> and + <filename>file-max</filename> can be + written to and, therefore, can be used to configure the + kernel. The other files only provide feedback on current + settings. + </para> + + <para> + Changing a value within a <filename>/proc/sys/</filename> file is done by + echoing the new value into the file. For example, to + enable the System Request Key on a running kernel, type + the command: + </para> + + <screen> +echo 1 > /proc/sys/kernel/sysrq +</screen> + + <para> + This changes the value for <filename>sysrq</filename> from <computeroutput>0</computeroutput> (off) to + <computeroutput>1</computeroutput> (on). + </para> + + <para> + A few <filename>/proc/sys/</filename> + configuration files contain more than one value. To + correctly send new values to them, place a space + character between each value passed with the <command>echo</command> command, such as is done + in this example: + </para> + + <screen> +echo 4 2 45 > /proc/sys/kernel/acct +</screen> + + <note> + <title>Note</title> + + <para> + Any configuration changes made using the <command + moreinfo="none">echo</command> command disappear when + the system is restarted. To make configuration changes + take effect after the system is rebooted, refer to + <xref + linkend="s1-proc-sysctl"/>. + </para> + </note> + + <para> + The <filename>/proc/sys/</filename> + directory contains several subdirectories controlling + different aspects of a running kernel. + </para> + + <section + id="s3-proc-sys-dev"> + <title> + <filename>/proc/sys/dev/</filename> + </title> + <indexterm + significance="normal"> + <primary> + <filename>proc</filename> file system</primary> + <secondary> + <filename>/proc/sys/</filename> directory</secondary> + <tertiary> + <filename>/proc/sys/dev/</filename> directory</tertiary> + </indexterm> + + <para> + This directory provides parameters for particular + devices on the system. Most systems have at least two + directories, <filename + moreinfo="none">cdrom/</filename> and <filename + moreinfo="none">raid/</filename>. Customized kernels + can have other directories, such as <filename + moreinfo="none">parport/</filename>, which provides + the ability to share one parallel port between + multiple device drivers. + </para> + + <para> + The <filename>cdrom/</filename> + directory contains a file called <filename + moreinfo="none">info</filename>, which reveals a + number of important CD-ROM parameters: + </para> + + + <screen> +CD-ROM information, Id: cdrom.c 3.20 2003/12/17 +drive name: hdc +drive speed: 48 +drive # of slots: 1 +Can close tray: 1 +Can open tray: 1 +Can lock tray: 1 +Can change speed: 1 +Can select disk: 0 +Can read multisession: 1 +Can read MCN: 1 +Reports media changed: 1 +Can play audio: 1 +Can write CD-R: 0 +Can write CD-RW: 0 +Can read DVD: 0 +Can write DVD-R: 0 +Can write DVD-RAM: 0 +Can read MRW: 0 +Can write MRW: 0 +Can write RAM: 0 +</screen> + + <para> + This file can be quickly scanned to discover the + qualities of an unknown CD-ROM. If multiple CD-ROMs + are available on a system, each device is given its + own column of information. + </para> + + <para> + Various files in <filename>/proc/sys/dev/cdrom</filename>, such + as <filename>autoclose</filename> and + <filename>checkmedia</filename>, can + be used to control the system's CD-ROM. Use the + <command>echo</command> command to + enable or disable these features. + </para> + + <para> + If RAID support is compiled into the kernel, a + <filename>/proc/sys/dev/raid/</filename> + directory becomes available with at least two files + in it: <filename>speed_limit_min</filename> and + <filename>speed_limit_max</filename>. These + settings determine the acceleration of RAID devices + for I/O intensive tasks, such as resyncing the disks. + </para> + </section> + + <section + id="s3-proc-sys-fs"> + <title> + <filename>/proc/sys/fs/</filename> + </title> + <indexterm + significance="normal"> + <primary> + <filename>proc</filename> file system</primary> + <secondary> + <filename>/proc/sys/</filename> directory</secondary> + <tertiary> + <filename>/proc/sys/fs/</filename> directory</tertiary> + </indexterm> + <para> + This directory contains an array of options and + information concerning various aspects of the file + system, including quota, file handle, inode, and + dentry information. + </para> + + <para> + The <filename>binfmt_misc/</filename> + directory is used to provide kernel support for + miscellaneous binary formats. + </para> + + <para> + The important files in <filename + moreinfo="none">/proc/sys/fs/</filename> include: + </para> + + <itemizedlist> + <listitem> + <para> + <filename>dentry-state</filename> + — Provides the status of the directory + cache. The file looks similar to the following: + </para> + + + <screen> +57411 52939 45 0 0 0 +</screen> + + + <para> + The first number reveals the total number of + directory cache entries, while the second number + displays the number of unused entries. The third + number tells the number of seconds between when a + directory has been freed and when it can be + reclaimed, and the fourth measures the pages + currently requested by the system. The last two + numbers are not used and display only zeros. + </para> + </listitem> +<!-- https://bugzilla.redhat.com/show_bug.cgi?id=561622#c10 + <listitem> + <para> + <filename>dquot-nr</filename> + — Lists the maximum number of cached disk + quota entries. + </para> + </listitem> --> + + <listitem> + <para> + <filename>file-max</filename> + — Lists the maximum number of file handles + that the kernel allocates. Raising the value in + this file can resolve errors caused by a lack of + available file handles. + </para> + </listitem> + + <listitem> + <para> + <filename>file-nr</filename> + — Lists the number of allocated file + handles, used file handles, and the maximum number + of file handles. + </para> + </listitem> + + <listitem> + <para> + <filename>overflowgid</filename> + and <filename>overflowuid</filename> — + Defines the fixed group ID and user ID, + respectively, for use with file systems that only + support 16-bit group and user IDs. + </para> + </listitem> +<!-- https://bugzilla.redhat.com/show_bug.cgi?id=561622#c10 + <listitem> + <para> + <filename>super-max</filename> + — Controls the maximum number of superblocks + available. + </para> + </listitem> + + <listitem> + <para> + <filename>super-nr</filename> + — Displays the current number of superblocks + in use. + </para> + </listitem> --> + </itemizedlist> + </section> + + <section + id="s3-proc-sys-kernel"> + <title> + <filename>/proc/sys/kernel/</filename> + </title> + <indexterm + significance="normal"> + <primary> + <filename>proc</filename> file system</primary> + <secondary> + <filename>/proc/sys/</filename> directory</secondary> + <tertiary> + <filename>/proc/sys/kernel/</filename> directory</tertiary> + </indexterm> + <indexterm + significance="normal"> + <primary>System Request Key</primary> + <secondary>setting timing for</secondary> + </indexterm> + <indexterm + significance="normal"> + <primary> + <filename>exec-shield</filename> + </primary> + <secondary>enabling</secondary> + </indexterm> + <indexterm + significance="normal"> + <primary> + <filename>exec-shield</filename> + </primary> + <secondary>introducing</secondary> + </indexterm> + <indexterm + significance="normal"> + <primary> + <filename>proc</filename> file system</primary> + <secondary> + <filename>/proc/sys/</filename> directory</secondary> + <tertiary> + <filename>/proc/sys/kernel/exec-shield</filename> + </tertiary> + </indexterm> + <para> + This directory contains a variety of different + configuration files that directly affect the operation + of the kernel. Some of the most important files + include: + </para> + + <itemizedlist> + <listitem> + <para> + <filename>acct</filename> — + Controls the suspension of process accounting + based on the percentage of free space available on + the file system containing the log. By default, + the file looks like the following: + </para> + + <screen> +4 2 30 +</screen> + + <para> + The first value dictates the percentage of free + space required for logging to resume, while the + second value sets the threshold percentage of free + space when logging is suspended. The third value + sets the interval, in seconds, that the kernel + polls the file system to see if logging should be + suspended or resumed. + </para> + </listitem> +<!-- https://bugzilla.redhat.com/show_bug.cgi?id=561622#c10 + <listitem> + <para> + <filename>cap-bound</filename> + — Controls the <firstterm>capability + bounding</firstterm> settings, which provides a + list of capabilities for any process on the + system. If a capability is not listed here, then + no process, no matter how privileged, can do + it. The idea is to make the system more secure by + ensuring that certain things cannot happen, at + least beyond a certain point in the boot process. + </para> + + <para> + For a valid list of values for this virtual file, + refer to the following installed documentation: + </para> + + <para> + <filename + >/lib/modules/<replaceable>kernel-version</replaceable>/build/include/linux/capability.h</filename>. + </para> + </listitem> + --> + <listitem> + <para> + <filename>ctrl-alt-del</filename> + — Controls whether <keycombo><keycap>Ctrl</keycap> + <keycap>Alt</keycap> + <keycap>Delete</keycap> + </keycombo> + gracefully restarts the computer using <command>init</command> (<computeroutput>0</computeroutput>) or forces an + immediate reboot without syncing the dirty buffers + to disk (<computeroutput>1</computeroutput>). + </para> + </listitem> + + <listitem> + <para> + <filename>domainname</filename> + — Configures the system domain name, such as + <computeroutput>example.com</computeroutput>. + </para> + </listitem> + + <listitem> + <para> + <filename>exec-shield</filename> + — Configures the Exec Shield feature of the + kernel. Exec Shield provides protection against + certain types of buffer overflow attacks. + </para> + + <para> + There are two possible values for this virtual + file: + </para> + + <itemizedlist> + <listitem> + <para> + <command>0</command> — + Disables Exec Shield. + </para> + </listitem> + + <listitem> + <para> + <command>1</command> — + Enables Exec Shield. This is the default + value. + </para> + </listitem> + </itemizedlist> + + <important> + <title>Important</title> + + <para> + If a system is running security-sensitive + applications that were started while Exec Shield + was disabled, these applications must be + restarted when Exec Shield is enabled in order + for Exec Shield to take effect. + </para> + </important> + </listitem> +<!-- https://bugzilla.redhat.com/show_bug.cgi?id=561622#c10 + <listitem> + <para> + <filename + >exec-shield-randomize</filename> + — Enables location randomization of various + items in memory. This helps deter potential + attackers from locating programs and daemons in + memory. Each time a program or daemon starts, it + is put into a different memory location each time, + never in a static or absolute memory address. + </para> + + <para> + There are two possible values for this virtual + file: + </para> + + <itemizedlist> + <listitem> + <para> + <command>0</command> — + Disables randomization of Exec Shield. This + may be useful for application debugging + purposes. + </para> + </listitem> + + <listitem> + <para> + <command>1</command> — + Enables randomization of Exec Shield. This is + the default value. Note: The <filename + moreinfo="none">exec-shield</filename> file + must also be set to <command + moreinfo="none">1</command> for <filename + moreinfo="none">exec-shield-randomize</filename> + to be effective. + </para> + </listitem> + </itemizedlist> + </listitem> --> + + <listitem> + <para> + <filename>hostname</filename> + — Configures the system hostname, such as + <computeroutput>www.example.com</computeroutput>. + </para> + </listitem> + + <listitem> + <para> + <filename>hotplug</filename> + — Configures the utility to be used when a + configuration change is detected by the + system. This is primarily used with USB and + Cardbus PCI. The default value of <computeroutput>/sbin/hotplug</computeroutput> + should not be changed unless testing a new program + to fulfill this role. + </para> + </listitem> + + <listitem> + <para> + <filename>modprobe</filename> + — Sets the location of the program used to + load kernel modules. The default value is + <computeroutput>/sbin/modprobe</computeroutput> + which means <command>kmod</command> calls it to load + the module when a kernel thread calls <command>kmod</command>. + </para> + </listitem> + + <listitem> + <para> + <filename>msgmax</filename> + — Sets the maximum size of any message sent + from one process to another and is set to + <computeroutput>8192</computeroutput> bytes by + default. Be careful when raising this value, as + queued messages between processes are stored in + non-swappable kernel memory. Any increase in + <filename>msgmax</filename> would + increase RAM requirements for the system. + </para> + </listitem> + + <listitem> + <para> + <filename>msgmnb</filename> + — Sets the maximum number of bytes in a + single message queue. The default is + <computeroutput + moreinfo="none">16384</computeroutput>. + </para> + </listitem> + + <listitem> + <para> + <filename>msgmni</filename> + — Sets the maximum number of message queue + identifiers. The default is <computeroutput>16</computeroutput>. + </para> + </listitem> + + <listitem> + <para> + <filename>osrelease</filename> + — Lists the Linux kernel release + number. This file can only be altered by changing + the kernel source and recompiling. + </para> + </listitem> + + <listitem> + <para> + <filename>ostype</filename> + — Displays the type of operating system. By + default, this file is set to <computeroutput>Linux</computeroutput>, and this + value can only be changed by changing the kernel + source and recompiling. + </para> + </listitem> + + <listitem> + <para> + <filename>overflowgid</filename> + and <filename>overflowuid</filename> — + Defines the fixed group ID and user ID, + respectively, for use with system calls on + architectures that only support 16-bit group and + user IDs. + </para> + </listitem> + + <listitem> + <para> + <filename>panic</filename> — + Defines the number of seconds the kernel postpones + rebooting when the system experiences a kernel + panic. By default, the value is set to + <computeroutput>0</computeroutput>, which disables + automatic rebooting after a panic. + </para> + </listitem> + + <listitem> + <para> + <filename>printk</filename> + — This file controls a variety of settings + related to printing or logging error + messages. Each error message reported by the + kernel has a <firstterm>loglevel</firstterm> + associated with it that defines the importance of + the message. The loglevel values break down in + this order: + </para> + + <itemizedlist> + <listitem> + <para> + <computeroutput + moreinfo="none">0</computeroutput> — + Kernel emergency. The system is unusable. + </para> + </listitem> + + <listitem> + <para> + <computeroutput + moreinfo="none">1</computeroutput> — + Kernel alert. Action must be taken + immediately. + </para> + </listitem> + + <listitem> + <para> + <computeroutput + moreinfo="none">2</computeroutput> — + Condition of the kernel is considered + critical. + </para> + </listitem> + + <listitem> + <para> + <computeroutput + moreinfo="none">3</computeroutput> — + General kernel error condition. + </para> + </listitem> + + <listitem> + <para> + <computeroutput + moreinfo="none">4</computeroutput> — + General kernel warning condition. + </para> + </listitem> + + <listitem> + <para> + <computeroutput + moreinfo="none">5</computeroutput> — + Kernel notice of a normal but significant + condition. + </para> + </listitem> + + <listitem> + <para> + <computeroutput + moreinfo="none">6</computeroutput> — + Kernel informational message. + </para> + </listitem> + + <listitem> + <para> + <computeroutput + moreinfo="none">7</computeroutput> — + Kernel debug-level messages. + </para> + </listitem> + </itemizedlist> + + <para> + Four values are found in the <filename>printk</filename> file: + </para> + + + <screen> +6 4 1 7 +</screen> + + <para> + Each of these values defines a different rule for + dealing with error messages. The first value, + called the <firstterm>console + loglevel</firstterm>, defines the lowest priority + of messages printed to the console. (Note that, + the lower the priority, the higher the loglevel + number.) The second value sets the default + loglevel for messages without an explicit loglevel + attached to them. The third value sets the lowest + possible loglevel configuration for the console + loglevel. The last value sets the default value + for the console loglevel. + </para> + </listitem> + + <listitem> + <para> + <filename>random/</filename> + directory — Lists a number of values related + to generating random numbers for the kernel. + </para> + </listitem> +<!-- https://bugzilla.redhat.com/show_bug.cgi?id=561622#c10 + <listitem> + <para> + <filename>rtsig-max</filename> + — Configures the maximum number of POSIX + real-time signals that the system may have queued + at any one time. The default value is + <computeroutput + >1024</computeroutput>. + </para> + </listitem> + + <listitem> + <para> + <filename>rtsig-nr</filename> + — Lists the current number of POSIX + real-time signals queued by the kernel. + </para> + </listitem> --> + + <listitem> + <para> + <filename>sem</filename> — + Configures <firstterm>semaphore</firstterm> + settings within the kernel. A semaphore is a + System V IPC object that is used to control + utilization of a particular process. + </para> + </listitem> + + <listitem> + <para> + <filename>shmall</filename> + — Sets the total amount of shared memory + that can be used at one time on the system, in + bytes. By default, this value is <computeroutput>2097152</computeroutput>. + </para> + </listitem> + + <listitem> + <para> + <filename>shmmax</filename> + — Sets the largest shared memory segment + size allowed by the kernel, in bytes. By default, + this value is <computeroutput>33554432</computeroutput>. However, + the kernel supports much larger values than this. + </para> + </listitem> + + <listitem> + <para> + <filename>shmmni</filename> + — Sets the maximum number of shared memory + segments for the whole system, in bytes. By + default, this value is <computeroutput>4096</computeroutput> + </para> + </listitem> + + <listitem> + <para> + <filename>sysrq</filename> — + Activates the System Request Key, if this value is + set to anything other than zero (<computeroutput>0</computeroutput>), the default. + </para> + + <para> + The System Request Key allows immediate input to + the kernel through simple key combinations. For + example, the System Request Key can be used to + immediately shut down or restart a system, sync + all mounted file systems, or dump important + information to the console. To initiate a System + Request Key, type <keycombo><keycap>Alt</keycap> + <keycap>SysRq</keycap> + <keycap> + <replaceable>system request + code</replaceable> + </keycap> + </keycombo> + . Replace <replaceable>system request + code</replaceable> with one of the following + system request codes: + </para> + + <itemizedlist> + <listitem> + <para> + <command>r</command> — + Disables raw mode for the keyboard and sets it + to XLATE (a limited keyboard mode which does + not recognize modifiers such as <keycap + moreinfo="none">Alt</keycap>, <keycap + moreinfo="none">Ctrl</keycap>, or <keycap + moreinfo="none">Shift</keycap> for all keys). + </para> + </listitem> + + <listitem> + <para> + <command>k</command> — + Kills all processes active in a virtual + console. Also called <firstterm>Secure Access + Key</firstterm> (<firstterm>SAK</firstterm>), + it is often used to verify that the login + prompt is spawned from <command + moreinfo="none">init</command> and not a + trojan copy designed to capture usernames and + passwords. + </para> + </listitem> + + <listitem> + <para> + <command>b</command> — + Reboots the kernel without first unmounting + file systems or syncing disks attached to the + system. + </para> + </listitem> + + <listitem> + <para> + <command>c</command> — + Crashes the system without first unmounting + file systems or syncing disks attached to the + system. + </para> + </listitem> + + <listitem> + <para> + <command>o</command> — + Shuts off the system. + </para> + </listitem> + + <listitem> + <para> + <command>s</command> — + Attempts to sync disks attached to the system. + </para> + </listitem> + + <listitem> + <para> + <command>u</command> — + Attempts to unmount and remount all file + systems as read-only. + </para> + </listitem> + + <listitem> + <para> + <command>p</command> — + Outputs all flags and registers to the + console. + </para> + </listitem> + + <listitem> + <para> + <command>t</command> — + Outputs a list of processes to the console. + </para> + </listitem> + + <listitem> + <para> + <command>m</command> + — + Outputs memory statistics to the console. + </para> + </listitem> + + <listitem> + <para> + <command>0</command> through + <command>9</command> — + Sets the log level for the console. + </para> + </listitem> + + <listitem> + <para> + <command>e</command> — + Kills all processes except <command + moreinfo="none">init</command> using SIGTERM. + </para> + </listitem> + + <listitem> + <para> + <command>i</command> — + Kills all processes except <command + moreinfo="none">init</command> using SIGKILL. + </para> + </listitem> + + <listitem> + <para> + <command>l</command> — + Kills all processes using SIGKILL (including + <command>init</command>). <emphasis>The + system is unusable after issuing this System + Request Key code.</emphasis> + </para> + </listitem> + + <listitem> + <para> + <command>h</command> — + Displays help text. + </para> + </listitem> + </itemizedlist> + + <para> + This feature is most beneficial when using a + development kernel or when experiencing system + freezes. + </para> + + <warning> + <title>Caution</title> + + <para> + The System Request Key feature is considered a + security risk because an unattended console + provides an attacker with access to the + system. For this reason, it is turned off by + default. + </para> + </warning> + + <para> + Refer to <filename>/usr/share/doc/kernel-doc-<replaceable>version</replaceable>/Documentation/sysrq.txt</filename> + for more information about the System Request Key. + </para> + </listitem> + +<!-- https://bugzilla.redhat.com/show_bug.cgi?id=561622#c10 + +<listitem> + <para> + <filename>sysrq-key</filename> + — Defines the key code for the System + Request Key (<computeroutput + >84</computeroutput> is the + default). + </para> + </listitem> + + <listitem> + <para> + <filename>sysrq-sticky</filename> + — Defines whether the System Request Key is + a chorded key combination. The accepted values are + as follows: + </para> + + <itemizedlist> + <listitem> + <para> + <computeroutput + moreinfo="none">0</computeroutput> — + <keycombo><keycap + moreinfo="none">Alt</keycap><keycap + moreinfo="none">SysRq</keycap> + </keycombo> + and the system request code must be pressed + simultaneously. This is the default value. + </para> + </listitem> + + <listitem> + <para> + <computeroutput + moreinfo="none">1</computeroutput> — + <keycombo><keycap + >Alt</keycap><keycap + >SysRq</keycap> + </keycombo> + must be pressed simultaneously, but the system + request code can be pressed anytime before the + number of seconds specified in <filename + moreinfo="none">/proc/sys/kernel/sysrq-timer</filename> + elapses. + </para> + </listitem> + </itemizedlist> + </listitem> + + <listitem> + <para> + <filename>sysrq-timer</filename> + — Specifies the number of seconds allowed to + pass before the system request code must be + pressed. The default value is <command + >10</command>. + </para> + </listitem> + --> + <listitem> + <para> + <filename>tainted</filename> + — Indicates whether a non-GPL module is + loaded. + </para> + + <itemizedlist> + <listitem> + <para> + <computeroutput + moreinfo="none">0</computeroutput> — No + non-GPL modules are loaded. + </para> + </listitem> + + <listitem> + <para> + <computeroutput + moreinfo="none">1</computeroutput> — At + least one module without a GPL license + (including modules with no license) is loaded. + </para> + </listitem> + + <listitem> + <para> + <computeroutput>2</computeroutput> + — + At least one module was force-loaded with the + command <command>insmod + -f</command>. + </para> + </listitem> + </itemizedlist> + </listitem> + + <listitem> + <para> + <filename>threads-max</filename> + — Sets the maximum number of threads to be + used by the kernel, with a default value of + <computeroutput>2048</computeroutput>. + </para> + </listitem> + + <listitem> + <para> + <filename>version</filename> + — Displays the date and time the kernel was + last compiled. The first field in this file, such + as <computeroutput>#3</computeroutput>, relates to + the number of times a kernel was built from the + source base. + </para> + </listitem> + </itemizedlist> + </section> + + <section + id="s3-proc-sys-net"> + <title> + <filename>/proc/sys/net/</filename> + </title> + <indexterm + significance="normal"> + <primary> + <filename>proc</filename> file system</primary> + <secondary> + <filename>/proc/sys/</filename> directory</secondary> + <tertiary> + <filename>/proc/sys/net/</filename> directory</tertiary> + </indexterm> + <indexterm + significance="normal"> + <primary>DoS attack</primary> + <see>Denial of Service attack</see> + </indexterm> + <indexterm + significance="normal"> + <primary>Denial of Service attack</primary> + <secondary>definition of</secondary> + </indexterm> + <indexterm + significance="normal"> + <primary>Denial of Service attack</primary> + <seealso> + <filename>/proc/sys/net/</filename> directory</seealso> + </indexterm> + <para> + This directory contains subdirectories concerning + various networking topics. Various configurations at + the time of kernel compilation make different + directories available here, such as <filename + moreinfo="none">ethernet/</filename>, <filename + moreinfo="none">ipv4/</filename>, <filename + moreinfo="none">ipx/</filename>, and <filename + moreinfo="none">ipv6/</filename>. By altering the + files within these directories, system administrators + are able to adjust the network configuration on a + running system. + </para> + + <para> + Given the wide variety of possible networking options + available with Linux, only the most common <filename + moreinfo="none">/proc/sys/net/</filename> directories + are discussed. + </para> + + <para> + The <filename + moreinfo="none">/proc/sys/net/core/</filename> + directory contains a variety of settings that control + the interaction between the kernel and networking + layers. The most important of these files are: + </para> + + <itemizedlist> + <listitem> + <para> + <filename>message_burst</filename> + — Sets the amount of time in tenths of a + second required to write a new warning + message. This setting is used to mitigate + <firstterm>Denial of Service</firstterm> + (<firstterm>DoS</firstterm>) attacks. The default + setting is <computeroutput>50</computeroutput>. + </para> + </listitem> + + <listitem> + <para> + <filename>message_cost</filename> + — Sets a cost on every warning message. The + higher the value of this file (default of + <computeroutput>5</computeroutput>), the more + likely the warning message is ignored. This + setting is used to mitigate DoS attacks. + </para> + + <para> + The idea of a DoS attack is to bombard the + targeted system with requests that generate errors + and fill up disk partitions with log files or + require all of the system's resources to handle + the error logging. The settings in <filename>message_burst</filename> and + <filename>message_cost</filename> + are designed to be modified based on the system's + acceptable risk versus the need for comprehensive + logging. + </para> + </listitem> + + <listitem> + <para> + <filename>netdev_max_backlog</filename> + — Sets the maximum number of packets allowed + to queue when a particular interface receives + packets faster than the kernel can process + them. The default value for this file is + <computeroutput + moreinfo="none">300</computeroutput>. + </para> + </listitem> + + <listitem> + <para> + <filename>optmem_max</filename> + — Configures the maximum ancillary buffer + size allowed per socket. + </para> + </listitem> + + <listitem> + <para> + <filename>rmem_default</filename> + — Sets the receive socket buffer default + size in bytes. + </para> + </listitem> + + <listitem> + <para> + <filename>rmem_max</filename> + — Sets the receive socket buffer maximum + size in bytes. + </para> + </listitem> + + <listitem> + <para> + <filename>wmem_default</filename> + — Sets the send socket buffer default size + in bytes. + </para> + </listitem> + + <listitem> + <para> + <filename>wmem_max</filename> + — Sets the send socket buffer maximum size + in bytes. + </para> + </listitem> + </itemizedlist> + + <para> + The <filename + moreinfo="none">/proc/sys/net/ipv4/</filename> + directory contains additional networking + settings. Many of these settings, used in conjunction + with one another, are useful in preventing attacks on + the system or when using the system to act as a + router. + </para> + + <warning> + <title>Caution</title> + + <para> + An erroneous change to these files may affect remote + connectivity to the system. + </para> + </warning> + + <para> + The following is a list of some of the more important + files within the <filename + moreinfo="none">/proc/sys/net/ipv4/</filename> + directory: + </para> + + <itemizedlist> +<!-- https://bugzilla.redhat.com/show_bug.cgi?id=561622#c10 + <listitem> + <para> + <filename + >icmp_destunreach_rate</filename>, + <filename + >icmp_echoreply_rate</filename>, + <filename + >icmp_paramprob_rate</filename>, + and <filename + >icmp_timeexeed_rate</filename> + — Set the maximum ICMP send packet rate, in + 1/100 of a second, to hosts under certain + conditions. A setting of <computeroutput + >0</computeroutput> removes any + delay and is not a good idea. + </para> + </listitem> --> + + <listitem> + <para> + <filename>icmp_echo_ignore_all</filename> + and <filename>icmp_echo_ignore_broadcasts</filename> + — Allows the kernel to ignore ICMP ECHO + packets from every host or only those originating + from broadcast and multicast addresses, + respectively. A value of <computeroutput>0</computeroutput> allows the + kernel to respond, while a value of + <computeroutput>1</computeroutput> + ignores the packets. + </para> + </listitem> + + <listitem> + <para> + <filename>ip_default_ttl</filename> — + Sets the default <firstterm>Time To Live + (TTL)</firstterm>, which limits the number of hops + a packet may make before reaching its + destination. Increasing this value can diminish + system performance. + </para> + </listitem> + + <listitem> + <para> + <filename>ip_forward</filename> + — Permits interfaces on the system to + forward packets to one other. By default, this + file is set to <computeroutput>0</computeroutput>. Setting this + file to <computeroutput>1</computeroutput> enables network + packet forwarding. + </para> + </listitem> + + <listitem> + <para> + <filename>ip_local_port_range</filename> + — Specifies the range of ports to be used by + TCP or UDP when a local port is needed. The first + number is the lowest port to be used and the + second number specifies the highest port. Any + systems that expect to require more ports than the + default 1024 to 4999 should use a range from 32768 + to 61000. + </para> + </listitem> + + <listitem> + <para> + <filename>tcp_syn_retries</filename> — + Provides a limit on the number of times the system + re-transmits a SYN packet when attempting to make + a connection. + </para> + </listitem> + + <listitem> + <para> + <filename>tcp_retries1</filename> + — Sets the number of permitted + re-transmissions attempting to answer an incoming + connection. Default of <computeroutput>3</computeroutput>. + </para> + </listitem> + + <listitem> + <para> + <filename>tcp_retries2</filename> + — Sets the number of permitted + re-transmissions of TCP packets. Default of + <computeroutput>15</computeroutput>. + </para> + </listitem> + </itemizedlist> + + <para> + The file called + </para> + + <screen> +<filename>/usr/share/doc/kernel-doc-<replaceable>version</replaceable>/Documentation/networking/ip-sysctl.txt</filename> + </screen> + + <para> + contains a complete list of files and options + available in the <filename + moreinfo="none">/proc/sys/net/ipv4/</filename> + directory. + </para> + + <para> + A number of other directories exist within the + <filename + moreinfo="none">/proc/sys/net/ipv4/</filename> + directory and each covers a different aspect of the + network stack. The <filename + moreinfo="none">/proc/sys/net/ipv4/conf/</filename> + directory allows each system interface to be + configured in different ways, including the use of + default settings for unconfigured devices (in the + <filename + moreinfo="none">/proc/sys/net/ipv4/conf/default/</filename> + subdirectory) and settings that override all special + configurations (in the <filename + moreinfo="none">/proc/sys/net/ipv4/conf/all/</filename> + subdirectory). + </para> + + <para> + The <filename + moreinfo="none">/proc/sys/net/ipv4/neigh/</filename> + directory contains settings for communicating with a + host directly connected to the system (called a + network neighbor) and also contains different settings + for systems more than one hop away. + </para> + + <para> + Routing over IPV4 also has its own directory, + <filename + moreinfo="none">/proc/sys/net/ipv4/route/</filename>. Unlike + <filename>conf/</filename> and + <filename>neigh/</filename>, the + <filename + moreinfo="none">/proc/sys/net/ipv4/route/</filename> + directory contains specifications that apply to + routing with any interfaces on the system. Many of + these settings, such as <filename + moreinfo="none">max_size</filename>, <filename + moreinfo="none">max_delay</filename>, and <filename + moreinfo="none">min_delay</filename>, relate to + controlling the size of the routing cache. To clear + the routing cache, write any value to the <filename + moreinfo="none">flush</filename> file. + </para> + + <para> + Additional information about these directories and the + possible values for their configuration files can be + found in: + </para> + + <screen> +/usr/share/doc/kernel-doc-<replaceable>version</replaceable>/Documentation/filesystems/proc.txt +</screen> + + </section> + + <section + id="s3-proc-sys-vm"> + <title> + <filename>/proc/sys/vm/</filename> + </title> + <indexterm + significance="normal"> + <primary> + <filename>proc</filename> file system</primary> + <secondary> + <filename>/proc/sys/</filename> directory</secondary> + <tertiary> + <filename>/proc/sys/vm/</filename> directory</tertiary> + </indexterm> + <indexterm + significance="normal"> + <primary>hugepages</primary> + <secondary>configuration of</secondary> + </indexterm> + <indexterm + significance="normal"> + <primary>TLB cache</primary> + <see>hugepages</see> + </indexterm> + <para> + This directory facilitates the configuration of the Linux + kernel's virtual memory (VM) subsystem. The kernel makes + extensive and intelligent use of virtual memory, which is + commonly referred to as swap space. + </para> + + <para> + The following files are commonly found in the <filename>/proc/sys/vm/</filename> directory: + </para> + + <itemizedlist> + <listitem> + <para> + <filename>block_dump</filename> — + Configures block I/O debugging when enabled. All + read/write and block dirtying operations done to files + are logged accordingly. This can be useful if + diagnosing disk spin up and spin downs for laptop + battery conservation. All output when <filename>block_dump</filename> is enabled can be + retrieved via <command>dmesg</command>. The default value is + <computeroutput>0</computeroutput>. + </para> + <note> + <title>Tip</title> + <para> + If <filename>block_dump</filename> is + enabled at the same time as kernel debugging, it is + prudent to stop the <command>klogd</command> daemon, as it generates + erroneous disk activity caused by <filename>block_dump</filename>. + </para> + </note> + </listitem> + + <listitem> + <para> + <filename>dirty_background_ratio</filename> + — Starts background writeback of dirty data at + this percentage of total memory, via a pdflush + daemon. The default value is <command>10</command>. + </para> + </listitem> + + <listitem> + <para> + <filename>dirty_expire_centisecs</filename> + — Defines when dirty in-memory data is old enough + to be eligible for writeout. Data which has been dirty + in-memory for longer than this interval is written out + next time a pdflush daemon wakes up. The default value + is <command>3000</command>, expressed + in hundredths of a second. + </para> + </listitem> + + <listitem> + <para> + <filename>dirty_ratio</filename> + — Starts active writeback of dirty data at this + percentage of total memory for the generator of dirty + data, via pdflush. The default value is <command>40</command>. + </para> + </listitem> + + <listitem> + <para> + <filename>dirty_writeback_centisecs</filename> + — Defines the interval between pdflush daemon + wakeups, which periodically writes dirty in-memory data + out to disk. The default value is <command>500</command>, expressed in hundredths + of a second. + </para> + </listitem> + + <listitem> + <para> + <filename>laptop_mode</filename> + — Minimizes the number of times that a hard disk + needs to spin up by keeping the disk spun down for as + long as possible, therefore conserving battery power on + laptops. This increases efficiency by combining all + future I/O processes together, reducing the frequency + of spin ups. The default value is <computeroutput>0</computeroutput>, but is + automatically enabled in case a battery on a laptop is + used. + </para> + + <para> + This value is controlled automatically by the acpid + daemon once a user is notified battery power is + enabled. No user modifications or interactions are + necessary if the laptop supports the ACPI (Advanced + Configuration and Power Interface) specification. + </para> + + <para> + For more information, refer to the following installed + documentation: + </para> + + <para> + <filename>/usr/share/doc/kernel-doc-<replaceable>version</replaceable>/Documentation/laptop-mode.txt</filename> + </para> + </listitem> + +<!-- https://bugzilla.redhat.com/show_bug.cgi?id=561622#c10 + +<listitem> + <para> + <filename + >lower_zone_protection</filename> + — Determines how aggressive the kernel is in + defending lower memory allocation zones. This is + effective when utilized with machines configured with + <filename>highmem</filename> memory + space enabled. The default value is <computeroutput + >0</computeroutput>, no protection at + all. All other integer values are in megabytes, and + <filename>lowmem</filename> memory is + therefore protected from being allocated by users. + </para> + + <para> + For more information, refer to the following installed + documentation: + </para> + + <para> + <filename + >/usr/share/doc/kernel-doc-<replaceable>version</replaceable>/Documentation/filesystems/proc.txt</filename> + </para> + </listitem> --> + + <listitem> + <para> + <filename>max_map_count</filename> + — Configures the maximum number of memory map + areas a process may have. In most cases, the default + value of <computeroutput>65536</computeroutput> is appropriate. + </para> + </listitem> + + <listitem> + <para> + <filename>min_free_kbytes</filename> + — Forces the Linux VM (virtual memory manager) to + keep a minimum number of kilobytes free. The VM uses + this number to compute a <filename>pages_min</filename> value for each + <filename>lowmem</filename> zone in the + system. The default value is in respect to the total + memory on the machine. + </para> + </listitem> + + <listitem> + <para> + <filename>nr_hugepages</filename> + — Indicates the current number of configured + <filename>hugetlb</filename> pages in + the kernel. + </para> + + <para> + For more information, refer to the following installed + documentation: + </para> + + <para> + <filename>/usr/share/doc/kernel-doc-<replaceable>version</replaceable>/Documentation/vm/hugetlbpage.txt</filename> + </para> + </listitem> + + <listitem> + <para> + <filename>nr_pdflush_threads</filename> + — + Indicates the number of pdflush daemons that are + currently running. This file is read-only, and should + not be changed by the user. Under heavy I/O loads, the + default value of two is increased by the kernel. + </para> + </listitem> + + <listitem> + <para> + <filename>overcommit_memory</filename> + — Configures the conditions under which a large + memory request is accepted or denied. The following + three modes are available: + </para> + + <itemizedlist> + <listitem> + <para> + <command>0</command> — The + kernel performs heuristic memory over commit + handling by estimating the amount of memory + available and failing requests that are blatantly + invalid. Unfortunately, since memory is allocated + using a heuristic rather than a precise algorithm, + this setting can sometimes allow available memory + on the system to be overloaded. This is the default + setting. + </para> + </listitem> + + <listitem> + <para> + <command>1</command> — The + kernel performs no memory over commit + handling. Under this setting, the potential for + memory overload is increased, but so is performance + for memory intensive tasks (such as those executed + by some scientific software). + </para> + </listitem> + + <listitem> + <para> + <command>2</command> — The + kernel fails requests for memory that add up to all + of swap plus the percent of physical RAM specified + in <filename>/proc/sys/vm/overcommit_ratio</filename>. This + setting is best for those who desire less risk of + memory overcommitment. + </para> + + <note> + <title>Note</title> + + <para> + This setting is only recommended for systems with + swap areas larger than physical memory. + </para> + </note> + </listitem> + </itemizedlist> + </listitem> + + <listitem> + <para> + <filename>overcommit_ratio</filename> + — Specifies the percentage of physical RAM + considered when <filename>/proc/sys/vm/overcommit_memory</filename> + is set to <command>2</command>. The + default value is <command>50</command>. + </para> + </listitem> + + <listitem> + <para> + <filename>page-cluster</filename> + — Sets the number of pages read in a single + attempt. The default value of <computeroutput>3</computeroutput>, which actually + relates to 16 pages, is appropriate for most systems. + </para> + </listitem> + + <listitem> + <para> + <filename>swappiness</filename> — + Determines how much a machine should swap. The higher + the value, the more swapping occurs. The default value, + as a percentage, is set to <computeroutput>60</computeroutput>. + </para> + </listitem> + </itemizedlist> + + <para> + All kernel-based documentation can be found in the + following locally installed location: + </para> + + <para> + <filename>/usr/share/doc/kernel-doc-<replaceable>version</replaceable>/Documentation/</filename>, + which contains additional information. + </para> + </section> + </section> + + <section + id="s2-proc-dir-sysvipc"> + <title> + <filename>/proc/sysvipc/</filename> + </title> + <indexterm + significance="normal"> + <primary> + <filename>proc</filename> file system</primary> + <secondary> + <filename>/proc/sysvipc/</filename> directory</secondary> + </indexterm> + <para> + This directory contains information about System V IPC + resources. The files in this directory relate to System V IPC + calls for messages (<filename>msg</filename>), semaphores (<filename>sem</filename>), and shared memory (<filename>shm</filename>). + </para> + </section> + + <section + id="s2-proc-tty"> + <title> + <filename>/proc/tty/</filename> + </title> + <indexterm + significance="normal"> + <primary> + <filename>proc</filename> file system</primary> + <secondary> + <filename>/proc/tty/</filename> directory</secondary> + </indexterm> + <para> + This directory contains information about the available and + currently used <firstterm>tty devices</firstterm> on the + system. Originally called <firstterm>teletype + devices</firstterm>, any character-based data terminals are + called tty devices. + </para> + + <para> + In Linux, there are three different kinds of tty + devices. <firstterm>Serial devices</firstterm> are used with + serial connections, such as over a modem or using a serial + cable. <firstterm>Virtual terminals</firstterm> create the + common console connection, such as the virtual consoles + available when pressing <keycombo><keycap>Alt</keycap> + <keycap><F-key></keycap> + </keycombo> + at the system console. <firstterm>Pseudo terminals</firstterm> + create a two-way communication that is used by some higher + level applications, such as XFree86. The <filename>drivers</filename> file is a list of the + current tty devices in use, as in the following example: + </para> + + + <screen> +serial /dev/cua 5 64-127 serial:callout +serial /dev/ttyS 4 64-127 serial +pty_slave /dev/pts 136 0-255 pty:slave +pty_master /dev/ptm 128 0-255 pty:master +pty_slave /dev/ttyp 3 0-255 pty:slave +pty_master /dev/pty 2 0-255 pty:master +/dev/vc/0 /dev/vc/0 4 0 system:vtmaster +/dev/ptmx /dev/ptmx 5 2 system +/dev/console /dev/console 5 1 system:console +/dev/tty /dev/tty 5 0 system:/dev/tty +unknown /dev/vc/%d 4 1-63 console +</screen> + + <para> + The <filename>/proc/tty/driver/serial</filename> file lists + the usage statistics and status of each of the serial tty + lines. + </para> + + <para> + In order for tty devices to be used as network devices, the + Linux kernel enforces <firstterm>line discipline</firstterm> + on the device. This allows the driver to place a specific + type of header with every block of data transmitted over the + device, making it possible for the remote end of the + connection to a block of data as just one in a stream of data + blocks. SLIP and PPP are common line disciplines, and each + are commonly used to connect systems to one other over a + serial link. + </para> +<!-- + <para> + Registered line disciplines are stored in the <filename + >ldiscs</filename> file, and more detailed + information is available within the <filename + >ldisc/</filename> directory. + </para> --> + </section> + +<!-- mprpic: Fix BZ#239313 + Note: I used as info sources the OOM section of the + performance guide (http://www.redhat.com/docs/en-US/Red_Hat_Enterprise_MRG/1.0/html/Realtime_Tuning_Guide/sect-Realtime_Tuning_Guide-General_System_Tuning-Swapping_and_Out_Of_Memory_Tips.html ), as well as an article about the OOM killer (http://linux-mm.org/OOM_Killer) --> + <section + id="s2-proc-pid"> + <title> + <filename>/proc/<replaceable>PID</replaceable>/</filename> + </title> + <indexterm + significance="normal"> + <primary> + <filename>proc</filename> file system</primary> + <secondary> + <filename>/proc/<replaceable>PID</replaceable>/</filename> directory</secondary> + </indexterm> + <para> + Out of Memory (OOM) refers to a computing state where all available memory, including swap space, has been allocated. When this situation occurs, it will cause the system to panic and stop functioning as expected. There is a switch that controls OOM behavior in <filename + class="directory">/proc/sys/vm/panic_on_oom</filename>. When set to <filename>1</filename> the kernel will panic on OOM. A setting of <filename>0</filename> instructs the kernel to call a function named <filename>oom_killer</filename> on an OOM. Usually, <filename>oom_killer</filename> can kill rogue processes and the system will survive. + </para> + <para>The easiest way to change this is to echo the new value to <filename + class="directory">/proc/sys/vm/panic_on_oom</filename>.</para> + <screen> +# cat /proc/sys/vm/panic_on_oom +1 + +# echo 0 > /proc/sys/vm/panic_on_oom + +# cat /proc/sys/vm/panic_on_oom +0 + </screen> + <para> + It is also possible to prioritize which processes get killed by adjusting the <filename>oom_killer</filename> score. In <filename + class="directory">/proc/<replaceable>PID</replaceable>/</filename> there are two tools labelled <filename>oom_adj</filename> and <filename>oom_score</filename>. Valid scores for <filename>oom_adj</filename> are in the range -16 to +15. To see the current <filename>oom_killer</filename> score, view the <filename>oom_score</filename> for the process. <filename>oom_killer</filename> will kill processes with the highest scores first. + </para> + <para> +This example adjusts the oom_score of a process with a <replaceable>PID</replaceable> of 12465 to make it less likely that <filename>oom_killer</filename> will kill it. + </para> + <screen> +# cat /proc/12465/oom_score +79872 + +# echo -5 > /proc/12465/oom_adj + +# cat /proc/12465/oom_score +78 + </screen> + <para> + There is also a special value of -17, which disables <filename>oom_killer</filename> for that process. In the example below, <filename>oom_score</filename> returns a value of 0, indicating that this process would not be killed. + </para> + <screen> +# cat /proc/12465/oom_score +78 + +# echo -17 > /proc/12465/oom_adj + +# cat /proc/12465/oom_score +0 + </screen> + <para>A function called <filename>badness()</filename> is used to determine the actual score for each process. This is done by adding up 'points' for each examined process. The process scoring is done in the following way: + </para> + <orderedlist> + <listitem> + <para>The basis of each process's score is its memory size.</para> + </listitem> + <listitem> + <para>The memory size of any of the process's children (not including a kernel thread) is also added to the score</para> + </listitem> + <listitem> + <para> + The process's score is increased for 'niced' processes and decreased for long running processes. + </para> + </listitem> + <listitem> + <para> + Processes with the <filename>CAP_SYS_ADMIN</filename> and <filename>CAP_SYS_RAWIO</filename> capabilities have their scores reduced. + </para> + </listitem> + <listitem> + <para> + The final score is then bitshifted by the value saved in the <filename>oom_adj</filename> file. + </para> + </listitem> + </orderedlist> + <para> + Thus, a process with the highest <filename>oom_score</filename> value will most probably be a non-priviliged, recently started process that, along with its children, uses a large amount of memory, has been 'niced', and handles no raw I/O. + </para> + </section> + </section> + <section + id="s1-proc-sysctl"> + <title>Using the <command>sysctl</command> Command</title> + <indexterm + significance="normal"> + <primary>files, proc file system</primary> + <secondary>changing</secondary> + </indexterm> + <indexterm + significance="normal"> + <primary>files, proc file system</primary> + <secondary>viewing</secondary> + </indexterm> + <indexterm + significance="normal"> + <primary> + <command>sysctl</command> + </primary> + <secondary>controlling <filename>/proc/sys/</filename> + </secondary> + </indexterm> + <indexterm + significance="normal"> + <primary> + <filename>proc</filename> file system</primary> + <secondary> + <filename>/proc/sys/</filename> directory</secondary> + <seealso> + <command>sysctl</command> + </seealso> + </indexterm> + <indexterm + significance="normal"> + <primary> + <filename>proc</filename> file system</primary> + <secondary>changing files within</secondary> + </indexterm> + <indexterm + significance="normal"> + <primary> + <command>sysctl</command> + </primary> + <secondary>configuring with <filename>/etc/sysctl.conf</filename> + </secondary> + </indexterm> + <para> + The <command>/sbin/sysctl</command> command is + used to view, set, and automate kernel settings in the + <filename>/proc/sys/</filename> directory. + </para> + + <para> + For a quick overview of all settings configurable in the + <filename>/proc/sys/</filename> directory, type + the <command>/sbin/sysctl -a</command> command + as root. This creates a large, comprehensive list, a small + portion of which looks something like the following: + </para> + + <screen> +net.ipv4.route.min_delay = 2 kernel.sysrq = 0 kernel.sem = 250 32000 32 128 +</screen> + + <para> + This is the same information seen if each of the files were + viewed individually. The only difference is the file + location. For example, the <filename>/proc/sys/net/ipv4/route/min_delay</filename> + file is listed as <computeroutput>net.ipv4.route.min_delay</computeroutput>, with + the directory slashes replaced by dots and the <computeroutput>proc.sys</computeroutput> portion assumed. + </para> + + <para> + The <command>sysctl</command> command can be + used in place of <command>echo</command> to + assign values to writable files in the <filename>/proc/sys/</filename> directory. For example, + instead of using the command + </para> + + + <screen> +echo 1 > /proc/sys/kernel/sysrq +</screen> + + <para> + use the equivalent <command>sysctl</command> + command as follows: + </para> + + <screen> +sysctl -w kernel.sysrq="1" +kernel.sysrq = 1 +</screen> + + + <para> + While quickly setting single values like this in <filename>/proc/sys/</filename> is helpful during + testing, this method does not work as well on a production + system as special settings within <filename>/proc/sys/</filename> are lost when the machine + is rebooted. To preserve custom settings, add them to the + <filename>/etc/sysctl.conf</filename> file. + </para> + + <para> + Each time the system boots, the <command>init</command> program runs the <filename>/etc/rc.d/rc.sysinit</filename> script. This + script contains a command to execute <command>sysctl</command> using <filename>/etc/sysctl.conf</filename> to determine the + values passed to the kernel. Any values added to <filename>/etc/sysctl.conf</filename> therefore take + effect each time the system boots. + </para> + </section> + <section + id="s1-proc-additional-resources"> +<!-- <title>Additional Resources</title> --> + <title>References</title> + <indexterm + significance="normal"> + <primary> + <filename>proc</filename> file system</primary> + <secondary>additional resources</secondary> + </indexterm> + <para> + Below are additional sources of information about <filename>proc</filename> file system. + </para> + + <simplesect + id="s2-proc-installed-documentation"> + <title>Installed Documentation</title> + <indexterm + significance="normal"> + <primary> + <filename>proc</filename> file system</primary> + <secondary>additional resources</secondary> + <tertiary>installed documentation</tertiary> + </indexterm> + <para> + Some of the best documentation about the <filename>proc</filename> file system is installed on + the system by default. + </para> + + <itemizedlist> + <listitem> + <para> + <filename>/usr/share/doc/kernel-doc-<replaceable>version</replaceable>/Documentation/filesystems/proc.txt</filename> + — Contains assorted, but limited, information about + all aspects of the <filename>/proc/</filename> directory. + </para> + </listitem> + + <listitem> + <para> + <filename>/usr/share/doc/kernel-doc-<replaceable>version</replaceable>/Documentation/sysrq.txt</filename> + — An overview of System Request Key options. + </para> + </listitem> + + <listitem> + <para> + <filename>/usr/share/doc/kernel-doc-<replaceable>version</replaceable>/Documentation/sysctl/</filename> + — A directory containing a variety of <command>sysctl</command> tips, including + modifying values that concern the kernel (<filename>kernel.txt</filename>), accessing file + systems (<filename>fs.txt</filename>), + and virtual memory use (<filename>vm.txt</filename>). + </para> + </listitem> + + <listitem> + <para> + <filename>/usr/share/doc/kernel-doc-<replaceable>version</replaceable>/Documentation/networking/ip-sysctl.txt</filename> + — A detailed overview of IP networking options. + </para> + </listitem> + </itemizedlist> + </simplesect> + + <simplesect + id="s2-proc-useful-websites"> + <title>Useful Websites</title> + <indexterm + significance="normal"> + <primary> + <filename>proc</filename> file system</primary> + <secondary>additional resources</secondary> + <tertiary>useful websites</tertiary> + </indexterm> + <itemizedlist> + <listitem> + <para> + <ulink + url="http://www.linuxhq.com/%22%3Ehttp://www.linuxhq.com/</ulink> + — This website maintains a complete database of + source, patches, and documentation for various versions + of the Linux kernel. + </para> + </listitem> + </itemizedlist> + </simplesect> + </section> +</chapter>