fork/wait/exit work
This commit is contained in:
parent
0f90388c89
commit
2ec1959fd1
30 changed files with 1098 additions and 1863 deletions
12
sysfile.c
12
sysfile.c
|
|
@ -41,11 +41,11 @@ static int
|
|||
fdalloc(struct file *f)
|
||||
{
|
||||
int fd;
|
||||
struct proc *curproc = myproc();
|
||||
struct proc *p = myproc();
|
||||
|
||||
for(fd = 0; fd < NOFILE; fd++){
|
||||
if(curproc->ofile[fd] == 0){
|
||||
curproc->ofile[fd] = f;
|
||||
if(p->ofile[fd] == 0){
|
||||
p->ofile[fd] = f;
|
||||
return fd;
|
||||
}
|
||||
}
|
||||
|
|
@ -374,7 +374,7 @@ sys_chdir(void)
|
|||
{
|
||||
char *path;
|
||||
struct inode *ip;
|
||||
struct proc *curproc = myproc();
|
||||
struct proc *p = myproc();
|
||||
|
||||
begin_op();
|
||||
if(argstr(0, &path) < 0 || (ip = namei(path)) == 0){
|
||||
|
|
@ -388,9 +388,9 @@ sys_chdir(void)
|
|||
return -1;
|
||||
}
|
||||
iunlock(ip);
|
||||
iput(curproc->cwd);
|
||||
iput(p->cwd);
|
||||
end_op();
|
||||
curproc->cwd = ip;
|
||||
p->cwd = ip;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue