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
之间有什么不同?
谢谢。
答案 0 :(得分:1)
pwd是一个dentry结构。 dentry是将文件名映射到inode号的内容。 pwd只是你当前的目录。根,是root dentry,所以我假设它是根目录/。
答案 1 :(得分:1)
这种结构中的pwd显示当前的工作目录,通常与Linux中的命令pwd不同。
如果你想要一个例子,使用ps来获取终端中正在运行的进程的pid XXX,以及cd / proc / XXX /,进程的root和cwd(当前工作目录)。
答案 2 :(得分:1)
cwd
是您可以使用chdir()
更改的当前工作目录。 root
是可以使用chroot()
更改的根目录(查找chroot jail)。