code:struct file - ikarishinjieva/unixV6-code-analyze-chs GitHub Wiki

Source

  • 打开文件结构

5500 /*

5501  * One file structure is allocated

5502  * for each open/creat/pipe call.

5503  * Main use is to hold the read/write

5504  * pointer associated with each open

5505  * file.

5506  */

5507 struct file

5508 {

5509     char f_flag;

  • 标志位
  • 标志常量参看file.h
5510     char f_count; /* reference count */
  • 指向该file结构的进程数
5511     int f_inode; /* pointer to inode structure */
  • 指向 对应的INODE结构
5512     char *f_offset[2]; /* read/write character pointer */
  • 文件的I/O偏移量
5513 } file[NFILE];

5514 /* ------------------------- */

Ref

Caller

⚠️ **GitHub.com Fallback** ⚠️