與進程聯絡的檔案結構的關係示意圖

來源:互聯網
上載者:User

標籤:style   blog   http   color   os   io   使用   ar   檔案   

與進程聯絡的檔案結構的關係

struct file{ struct list_head        f_list;    /*所有開啟的檔案形成一個鏈表*/ struct dentry           *f_dentry; /*指向相關目錄項的指標*/ struct vfsmount         *f_vfsmnt; /*指向VFS安裝點的指標*/ struct file_operations  *f_op;     /*指向檔案動作表的指標*/  mode_t f_mode;                                  /*檔案的開啟模式*/  loff_t f_pos;                                   /*檔案的當前位置*/   unsigned short f_flags;                         /*開啟檔案時所指定的標誌*/   unsigned short f_count;                           /*使用該結構的進程數*/   unsigned long f_reada, f_ramax, f_raend, f_ralen, f_rawin;   /*預讀標誌、要預讀的最多頁面數、上次預讀後的檔案指標、預讀的位元組數以及    預讀的頁面數*/  int f_owner;                  /* 通過訊號進行非同步I/O資料的傳送*/  unsigned int         f_uid, f_gid;  /*使用者的UID和GID*/  int                 f_error;       /*網路寫操作的錯誤碼*/   unsigned long f_version;           /*版本號碼*/   void *private_data;                      /* tty驅動程式所需 */ };

 

struct files_struct {     atomic_t count;        /* 共用該表的進程數 */     rwlock_t file_lock;     /* 保護以下的所有域,以免在tsk->alloc_lock中的嵌套*/     int max_fds;           /*當前檔案對象的最大數*/     int max_fdset;        /*當前檔案描述符的最大數*/          int next_fd;          /*已指派的檔案描述符加1*/      struct file ** fd;      /* 指向檔案對象指標數組的指標 */      fd_set *close_on_exec;  /*指向執行exec(  )時需要關閉的檔案描述符*/      fd_set *open_fds;     /*指向開啟檔案描述符的指標*/       fd_set close_on_exec_init;/* 執行exec(  )時需要關閉的檔案描述符的初            值集合*/          fd_set open_fds_init;  /*檔案描述符的初值集合*/      struct file * fd_array[32];/* 檔案對象指標的初始化數組*/};

 

struct fs_struct {         atomic_t count;         rwlock_t lock;         int umask;        struct dentry * root, * pwd, * altroot;         struct vfsmount * rootmnt, * pwdmnt, * altrootmnt;};

 

與進程聯絡的檔案結構的關係

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.