The fs Directory
File handling is at the core of any Unix system, and the
fs directory in Linux is the fattest of all
directories. It includes all the filesystems supported by the current
Linux version, each in its own subdirectory, as well as the most
important system calls after fork and
exit.
The execve system call lives in
exec.c and relies on the various available binary
formats to actually interpret the binary data found in the executable
files. The most important binary format nowadays is ELF, implemented
by
binfmt_elf.c. binfmt_script.c
supports the execution of interpreted files. After detecting the need
for an interpreter (usually on the #! or “shebang”
line), the file relies on the other binary formats to load the
interpreter.
Miscellaneous binary formats (such as the Java executable format) can
be defined by the user with a /proc interface
defined in binfmt_misc.c. The
misc binary format is able to identify an
interpreted binary format based on the contents of the executable
file, and fire the appropriate interpreter with appropriate
arguments. The tool is configured via
/proc/sys/fs/binfmt_misc.
The fundamental system calls for file access are defined in
open.c and read_write.c. The
former also defines close and several other
file-access system calls (chown, for instance).
select.c implements select
and poll. pipe.c and
fifo.c implement pipes and named pipes.
readdir.c implements the
getdents system call, which is how user-space programs read directories ...