The /proc filesystem is a special, software-created filesystem that is used by the ker-
nel to export information to the world. Each file under /proc is tied to a kernel func-
tion that generates the file’s “contents” on the fly when the file is read. We have
already seen some of these files in action; /proc/modules, for example, always returns
a list of the currently loaded modules.
/proc is heavily used in the Linux system. Many utilities on a modern Linux distribu-
tion, such as ps, top, and uptime, get their information from /proc. Some device driv-
ers also export information via /proc, and yours can do so as well. The /proc
filesystem is dynamic, so your module can add or remove entries at any time.
Fully featured /proc entries can be complicated beasts; among other things, they can
be written to as well as read from. Most of the time, however, /proc entries are read-
only files.