1,321 bytes added
, 11:32, 1 December 2014
This is what CRIU does to dump information about opened files.
== Files, descriptors and inodes in Linux ==
When a task opens a file Linux kernel constructs a chain of 3 (well, 3.5) object to serve this.
; Inode
: This is an object which describes file as a couple of meta-data (owner, type, size) and data (the bytes themselves).
; Dentry (directory entry)
: A helper object that kernel uses to resolve file path into Inode object. If a file has hard-links, then one Inode will have several Dentries.
; File
: This one describes how a tasks works with an opened Dentry-Inode pair.
; File descriptor
: It's a number in task's table, that is used to reference the needed File object
So after <code>open()</code> (or some other, see below) system call there will be this chain in the memory
<pre>
+------+
+ Task +-----+
+------+ |
v
+------------------------------+
| File Descriptors Table (FDT) |
+------------------------------+
| | | 2 | ... | |
+------------------------------+
|
|
| +------+ +--------+ +-------+
+----->| File |--->| Dentry |--->| Inode |
+------+ +--------+ +-------+
</pre>