Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
什么';任务结构的pwd和root-in-struct有什么不同?_C_Linux_Kernel - Fatal编程技术网

什么';任务结构的pwd和root-in-struct有什么不同?

什么';任务结构的pwd和root-in-struct有什么不同?,c,linux,kernel,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 sigact

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*root
struct m_inode*pwd
之间有什么不同
谢谢。

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


pwd是一个齿状结构。dentry将文件名映射到inode编号。pwd只是您所在的当前目录。根是根dentry,所以我假设它是根目录/


此类结构中的pwd表示当前工作目录,通常与Linux中的命令pwd不同


如果您想要一个示例,请使用ps获取终端中正在运行的进程的pid XXX,以及该进程的根目录和cwd(当前工作目录)

此类结构中的pwd表示当前工作目录,通常与Linux中的命令pwd不同


如果您想要一个示例,请使用ps获取终端中正在运行的进程的pid XXX,以及该进程的根目录和cwd(当前工作目录)

cwd
是当前工作目录,您可以使用
chdir()
更改该目录
root
是可以使用
chroot()
更改的根目录(查找chroot)。

cwd
是可以使用
chdir()
更改的当前工作目录
root
是可以使用
chroot()
(查找chroot-jail)更改的根目录。

我们不是在谈论非常早期的linux内核版本吗?不要认为现在使用的是
0.12
。就我所知,甚至在
3.0
3.2
之间也有很多变化。@Uday我是新来的。因此,我从0.12学习内核,也许你应该看看内核版本2.4或更高版本,因为我相信以前的内核版本的文档很难获得,当然,正如Alex所说,有相当多的变化,可能是你可以在这里找到一些旧linux的资源,而不是谈论非常早期的linux内核版本?不是吗认为现在使用的是
0.12
。就我所知,甚至在
3.0
3.2
之间也有很多变化。@Uday我是新来的。因此,我从0.12学习内核,也许你应该看看内核版本2.4或更高版本,因为我相信以前的内核版本的文档很难获得,当然,正如Alex所说,可能有很多变化,你可以在这里找到一些旧linux的资源