Linux – How is the open file table structured

fileslinux

I'm starting to read Linux Systems Programming, 2nd Ed., and I was curious about the file table that is a "per-process list of open files." Is the file table like a table in a SQL db with the fds used as primary keys? If so, does this mean that the entries are repeated, or is it split into separate tables and normalized?

Or does it work entirely differently since we're dealing with straight C/assembly? If so, what data structures are used?

Where in the source is this subsystem defined? Most of the reason I'm doing this is to understand both C and Linux better. If I know where to find it, that would give me a better idea.

Best Answer

Since this is C, "table" is likely short for "array of structures".

You probably want to read "Understanding the Linux Kernel" or "Linux Kernel Development".

Or do it the hard way and read the source; good places to start might be:
include/linux/fdtable.h and
include/linux/fs.h.

Related Question