summaryrefslogtreecommitdiff
path: root/sysfile.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysfile.c')
-rw-r--r--sysfile.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/sysfile.c b/sysfile.c
index 475c907..b5d2337 100644
--- a/sysfile.c
+++ b/sysfile.c
@@ -22,11 +22,11 @@ argfd(int argno, int *pfd, struct file **pf)
{
int fd;
struct file *f;
- struct proc *p = curproc[cpu()];
+ struct proc *cp = curproc[cpu()];
if(argint(argno, &fd) < 0)
return -1;
- if(fd < 0 || fd >= NOFILE || (f=p->ofile[fd]) == 0)
+ if(fd < 0 || fd >= NOFILE || (f=cp->ofile[fd]) == 0)
return -1;
if(pfd)
*pfd = fd;
@@ -41,10 +41,11 @@ static int
fdalloc(struct file *f)
{
int fd;
- struct proc *p = curproc[cpu()];
+ struct proc *cp = curproc[cpu()];
+
for(fd = 0; fd < NOFILE; fd++){
- if(p->ofile[fd] == 0){
- p->ofile[fd] = f;
+ if(cp->ofile[fd] == 0){
+ cp->ofile[fd] = f;
return fd;
}
}
@@ -57,7 +58,7 @@ sys_pipe(void)
int *fd;
struct file *rf = 0, *wf = 0;
int fd0, fd1;
- struct proc *p = curproc[cpu()];
+ struct proc *cp = curproc[cpu()];
if(argptr(0, (void*)&fd, 2*sizeof fd[0]) < 0)
return -1;
@@ -66,7 +67,7 @@ sys_pipe(void)
fd0 = -1;
if((fd0 = fdalloc(rf)) < 0 || (fd1 = fdalloc(wf)) < 0){
if(fd0 >= 0)
- p->ofile[fd0] = 0;
+ cp->ofile[fd0] = 0;
fileclose(rf);
fileclose(wf);
return -1;
@@ -241,7 +242,7 @@ sys_mkdir(void)
int
sys_chdir(void)
{
- struct proc *p = curproc[cpu()];
+ struct proc *cp = curproc[cpu()];
struct inode *ip;
char *path;
@@ -261,9 +262,9 @@ sys_chdir(void)
return -1;
}
- idecref(p->cwd);
- p->cwd = ip;
- iunlock(p->cwd);
+ idecref(cp->cwd);
+ cp->cwd = ip;
+ iunlock(cp->cwd);
return 0;
}