Use pp instead of np to be more consistent
This commit is contained in:
parent
2a391ebc8b
commit
2f0b4d698b
|
@ -390,7 +390,7 @@ exit(int status)
|
||||||
int
|
int
|
||||||
wait(uint64 addr)
|
wait(uint64 addr)
|
||||||
{
|
{
|
||||||
struct proc *np;
|
struct proc *pp;
|
||||||
int havekids, pid;
|
int havekids, pid;
|
||||||
struct proc *p = myproc();
|
struct proc *p = myproc();
|
||||||
|
|
||||||
|
@ -399,27 +399,27 @@ wait(uint64 addr)
|
||||||
for(;;){
|
for(;;){
|
||||||
// Scan through table looking for exited children.
|
// Scan through table looking for exited children.
|
||||||
havekids = 0;
|
havekids = 0;
|
||||||
for(np = proc; np < &proc[NPROC]; np++){
|
for(pp = proc; pp < &proc[NPROC]; pp++){
|
||||||
if(np->parent == p){
|
if(pp->parent == p){
|
||||||
// make sure the child isn't still in exit() or swtch().
|
// make sure the child isn't still in exit() or swtch().
|
||||||
acquire(&np->lock);
|
acquire(&pp->lock);
|
||||||
|
|
||||||
havekids = 1;
|
havekids = 1;
|
||||||
if(np->state == ZOMBIE){
|
if(pp->state == ZOMBIE){
|
||||||
// Found one.
|
// Found one.
|
||||||
pid = np->pid;
|
pid = pp->pid;
|
||||||
if(addr != 0 && copyout(p->pagetable, addr, (char *)&np->xstate,
|
if(addr != 0 && copyout(p->pagetable, addr, (char *)&pp->xstate,
|
||||||
sizeof(np->xstate)) < 0) {
|
sizeof(pp->xstate)) < 0) {
|
||||||
release(&np->lock);
|
release(&pp->lock);
|
||||||
release(&wait_lock);
|
release(&wait_lock);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
freeproc(np);
|
freeproc(pp);
|
||||||
release(&np->lock);
|
release(&pp->lock);
|
||||||
release(&wait_lock);
|
release(&wait_lock);
|
||||||
return pid;
|
return pid;
|
||||||
}
|
}
|
||||||
release(&np->lock);
|
release(&pp->lock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue