Linux Kernel Architecture

(Jacob Rumans) #1

Chapter 10: Filesystems without Persistent Storage


❑ System buses
❑ Power management
❑ Terminals

System Control Mechanism


Some of these categories are very different in nature (and the above list is by no means comprehensive)
and share few common features. In the past, this information overload was a latent but ever-present
source of criticism (which occasionally erupted violently) of theprocfilesystem concept. It may well be
useful to provide data by means of a virtual filesystem, but amorestructured approach would have been
appreciated....

The trend in kernel development is away from the provision of information by theprocfilesystem and
toward the exporting of data by a problem-specific but likewise virtual filesystem. A good example of this
is the USB filesystem which is used to export many types of status information on the USB subsystem into
userspace without ‘‘overburdening‘‘/procwith new entries. Additionally, the Sysfs filesystem allows
for presenting a hierarchical view not only of the device tree (bydevice, I mean system buses, PCI devices,
CPUs, etc.), but also of important kernel objects. Sysfs is discussed in Section 10.3.

On the kernel mailing list, the addition of new entries to/procis viewed with deep suspicion and is the
subject of controversial discussion. New code has a far better chance of finding its way into the sources
if it doesnotuse/proc. Of course, this does not mean that theprocfilesystem will gradually become
superfluous. In fact, the opposite is true. Today,/procis as important as ever not only when installing
new distributions, but also to support (automated) system administration.

The following sections give abriefoverview of the various files in/procand the information they con-
tain. Again, I lay no claim to completeness and discuss only the most important elements found on all
supported architectures.

Process-SpecificData


Each system process, regardless of its current state, has a subdirectory (with the same name as the PID)
that contains information on the process. As the name suggests, the original intention of the ‘‘process
data system‘‘ (procfor short) was to deliver process data.

What information is held in the process-specific directories? A simplels -lcommand paints an initial
picture:

wolfgang@meitner>cd /proc/7748
wolfgang@meitner>ls -l
total 0
dr-xr-xr-x 2 wolfgang users 0 2008-02-15 04:22 attr
-r-------- 1 wolfgang users 0 2008-02-15 04:22 auxv
--w------- 1 wolfgang users 0 2008-02-15 04:22 clear_refs
-r--r--r-- 1 wolfgang users 0 2008-02-15 00:37 cmdline
-r--r--r-- 1 wolfgang users 0 2008-02-15 04:22 cpuset
lrwxrwxrwx 1 wolfgang users 0 2008-02-15 04:22 cwd -> /home/wolfgang/wiley_kbook
-r-------- 1 wolfgang users 0 2008-02-15 04:22 environ
lrwxrwxrwx 1 wolfgang users 0 2008-02-15 01:30 exe -> /usr/bin/emacs
dr-x------ 2 wolfgang users 0 2008-02-15 00:56 fd
dr-x------ 2 wolfgang users 0 2008-02-15 04:22 fdinfo
Free download pdf