[Linux system programming] 13. File descriptors

Table of contents

FILE structure

 

        The PCB process control block is essentially a structure. Members are file description tables. The file description is 0~1023, and the system automatically uses the smallest file descriptor available in the table.

file descriptor :

  • 0:STDIN_FILENO

  • 1:STDOUT_FILENO

  • 2:STDERR_FILENO

FILE structure

struct file {
    ...
    文件的偏移量;
    文件的访问权限;
    文件的打开标志;
    文件内核缓冲区的首地址;
    struct operations * f_op;
    ...
};

Guess you like

Origin blog.csdn.net/CETET/article/details/130065090