標籤: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;};
與進程聯絡的檔案結構的關係