VFS与进程关联

进程描述符中与文件系统相关的成员:
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
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值