static struct proc*
allocproc(void)
{
- int i;
struct proc *p;
acquire(&ptable.lock);
scheduler(void)
{
struct proc *p;
- int i;
for(;;){
// Enable interrupts on this processor, in lieu of saving intena.
{
struct proc *p;
- for(p = proc; p < &proc[NPROC]; p++)
+ for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
if(p->state == SLEEPING && p->chan == chan)
p->state = RUNNABLE;
}
wait(void)
{
struct proc *p;
- int i, havekids, pid;
+ int havekids, pid;
acquire(&ptable.lock);
for(;;){
[RUNNING] "run ",
[ZOMBIE] "zombie"
};
- int i, j;
+ int i;
struct proc *p;
char *state;
uint pc[10];
cprintf("%d %s %s", p->pid, state, p->name);
if(p->state == SLEEPING){
getcallerpcs((uint*)p->context->ebp+2, pc);
- for(j=0; j<10 && pc[j] != 0; j++)
- cprintf(" %p", pc[j]);
+ for(i=0; i<10 && pc[i] != 0; i++)
+ cprintf(" %p", pc[i]);
}
cprintf("\n");
}