diff options
Diffstat (limited to 'sysfile.c')
-rw-r--r-- | sysfile.c | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -41,10 +41,11 @@ static int fdalloc(struct file *f) { int fd; + struct proc *curproc = myproc(); for(fd = 0; fd < NOFILE; fd++){ - if(myproc()->ofile[fd] == 0){ - myproc()->ofile[fd] = f; + if(curproc->ofile[fd] == 0){ + curproc->ofile[fd] = f; return fd; } } @@ -373,7 +374,8 @@ sys_chdir(void) { char *path; struct inode *ip; - + struct proc *curproc = myproc(); + begin_op(); if(argstr(0, &path) < 0 || (ip = namei(path)) == 0){ end_op(); @@ -386,9 +388,9 @@ sys_chdir(void) return -1; } iunlock(ip); - iput(myproc()->cwd); + iput(curproc->cwd); end_op(); - myproc()->cwd = ip; + curproc->cwd = ip; return 0; } |