2 ms·
Yep, this is misleading. "file descriptors" taken _literally_ don't exist (they are just the interface exposed to user space programs). Linux uses `struct file
by codys 9y ago
Yep, this is misleading.
"file descriptors" taken _literally_ don't exist (they are just the interface exposed to user space programs). Linux uses `struct file` internally as the generic file tracking, and multiple file descriptors can refer to a single `struct file`. `struct file` in turn refers to a `struct inode`, which represents an actual "something" on disk. Each file system driver stores a bunch of info in the `struct inode`.
In addition to that tracking, there is generally a bunch of fs-specific data structures to handle lookup of names (in the typical case, these are essentially cached versions of what is stored on disk).