File Descriptor and Inode

Unix makes a clear distinction between the contents of a file and the information about a file. With the exception of device and special files, each file consists of a sequence of characters. The file does not include any control information, such as its length or an End-Of-File (EOF) delimiter.

All information needed by the filesystem to handle a file is included in a data structure called an inode. Each file has its own inode, which the filesystem uses to identify the file.

While filesystems and the kernel functions handling them can vary widely from one Unix system to another, they must always provide at least the following attributes, which are specified in the POSIX standard:

• File type (see the previous section)

• Number of hard links associated with the file

• File length in bytes

• Device ID (i.e., an identifier of the device containing the file)

• Inode number that identifies the file within the filesystem

• User ID of the file owner

• Several timestamps that specify the inode status change time, the last access time, and the last modify time

• Access rights and file mode (see the next section)

Continue reading here: File Handling System Calls

Was this article helpful?

+2 -3