VFS与进程关联

来源:互联网 发布:c语言写九九乘法表 编辑:程序博客网 时间:2024/05/19 09:50
进程描述符中与文件系统相关的成员:
struct task_struct {
 
/* filesystem information */ struct fs_struct *fs;/* open file information */ struct files_struct *files;/* namespaces */ struct nsproxy *nsproxy;
 
}
进程能看到的文件系统相关成员:
struct fs_struct { int users; spinlock_t lock; seqcount_t seq; int umask; int in_exec; struct path root, pwd;进程当前目录和root目录};
 
进程能看到的打开的文件表:

struct files_struct {  /*   * read mostly part   */ atomic_t count; bool resize_in_progress; wait_queue_head_t resize_wait;

 struct fdtable __rcu *fdt;

 struct fdtable fdtab;  /*   * written part on a separate cache line in SMP   */ spinlock_t file_lock ____cacheline_aligned_in_smp; unsigned int next_fd; unsigned long close_on_exec_init[1]; unsigned long open_fds_init[1]; unsigned long full_fds_bits_init[1]; struct file __rcu * fd_array[NR_OPEN_DEFAULT];};

这个成员是进程所在的命名空间,其影响是全局性的:

struct nsproxy { atomic_t count; struct uts_namespace *uts_ns; struct ipc_namespace *ipc_ns; struct mnt_namespace *mnt_ns; struct pid_namespace *pid_ns_for_children; struct net       *net_ns; struct cgroup_namespace *cgroup_ns;};

 
0 0
原创粉丝点击