c - task_struct 的struct 中的pwd 和root 有什么区别?

标签 c linux kernel

Linux-0.12 中的 sched.h:

struct task_struct {
/* these are hardcoded - don't touch */
        long state;     /* -1 unrunnable, 0 runnable, >0 stopped */
        long counter;
        long priority;
        long signal;
        struct sigaction sigaction[32];
        long blocked;   /* bitmap of masked signals */
/* various fields */
        int exit_code;
        unsigned long start_code,end_code,end_data,brk,start_stack;
        long pid,pgrp,session,leader;
        int     groups[NGROUPS];
        /* 
         * pointers to parent process, youngest child, younger sibling,
         * older sibling, respectively.  (p->father can be replaced with 
         * p->p_pptr->pid)
         */
        struct task_struct      *p_pptr, *p_cptr, *p_ysptr, *p_osptr;
        unsigned short uid,euid,suid;
        unsigned short gid,egid,sgid;
        unsigned long timeout,alarm;
        long utime,stime,cutime,cstime,start_time;
        struct rlimit rlim[RLIM_NLIMITS];
        unsigned int flags;     /* per process flags, defined below */
        unsigned short used_math;
/* file system info */
        int tty;                /* -1 if no tty, so it must be signed */
        unsigned short umask;
        struct m_inode * pwd;
        struct m_inode * root;
        struct m_inode * executable;
        struct m_inode * library;
        unsigned long close_on_exec;
        struct file * filp[NR_OPEN];
/* ldt for this task 0 - zero 1 - cs 2 - ds&ss */
        struct desc_struct ldt[3];
/* tss for this task */
        struct tss_struct tss;
};

struct m_inode * rootstruct m_inode * pwd 有什么区别?
谢谢。

最佳答案

密码是一个目录结构。 dentry 将文件名映射到 inode 编号。 pwd 就是你所在的当前目录。root 是根目录,所以我假设它是根目录/。

http://www.makelinux.net/books/lkd2/ch12lev1sec10

关于c - task_struct 的struct 中的pwd 和root 有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16588207/

相关文章:

c# - C到C#代码转换——数组作为参数

linux - 如何使用 awk getline 清空文件

php - 注意 : Undefined index variable. PHP 脚本适用于 Linux 但不适用于 Windows

c - 使用列表在内核设备中存储值

linux - fatal error : aux. h 没有这样的文件或目录 (Ubuntu)

C 中的 const 给出不可预测的输出

python - 使一个新的字符串变量等于c中的整数变量

c - fork 多个进程时如何使用 wait() 函数?

regex - awk if 条件中的数值表达式

linux-kernel - 为什么我的 printk 消息最近在日志文件中更新了?