diff options
author | Russ Cox <[email protected]> | 2011-02-19 21:17:55 -0500 |
---|---|---|
committer | Russ Cox <[email protected]> | 2011-02-19 21:17:55 -0500 |
commit | cf4b1ad90bcaeeb0c8458098c87948f61d408f94 (patch) | |
tree | b6385b1d72af5a3e634b94b318fb7e43644493af /proc.c | |
parent | 9c4fe7ba105c0430c90179fd1e93c3d439a8cbd5 (diff) | |
download | xv6-labs-cf4b1ad90bcaeeb0c8458098c87948f61d408f94.tar.gz xv6-labs-cf4b1ad90bcaeeb0c8458098c87948f61d408f94.tar.bz2 xv6-labs-cf4b1ad90bcaeeb0c8458098c87948f61d408f94.zip |
xv6: formatting, cleanup, rev5 (take 2)
Diffstat (limited to 'proc.c')
-rw-r--r-- | proc.c | 76 |
1 files changed, 38 insertions, 38 deletions
@@ -25,44 +25,6 @@ pinit(void) initlock(&ptable.lock, "ptable"); } -//PAGEBREAK: 36 -// Print a process listing to console. For debugging. -// Runs when user types ^P on console. -// No lock to avoid wedging a stuck machine further. -void -procdump(void) -{ - static char *states[] = { - [UNUSED] "unused", - [EMBRYO] "embryo", - [SLEEPING] "sleep ", - [RUNNABLE] "runble", - [RUNNING] "run ", - [ZOMBIE] "zombie" - }; - int i; - struct proc *p; - char *state; - uint pc[10]; - - for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ - if(p->state == UNUSED) - continue; - if(p->state >= 0 && p->state < NELEM(states) && states[p->state]) - state = states[p->state]; - else - state = "???"; - cprintf("%d %s %s", p->pid, state, p->name); - if(p->state == SLEEPING){ - getcallerpcs((uint*)p->context->ebp+2, pc); - for(i=0; i<10 && pc[i] != 0; i++) - cprintf(" %p", pc[i]); - } - cprintf("\n"); - } -} - - //PAGEBREAK: 32 // Look in the process table for an UNUSED proc. // If found, change state to EMBRYO and initialize @@ -447,3 +409,41 @@ kill(int pid) return -1; } +//PAGEBREAK: 36 +// Print a process listing to console. For debugging. +// Runs when user types ^P on console. +// No lock to avoid wedging a stuck machine further. +void +procdump(void) +{ + static char *states[] = { + [UNUSED] "unused", + [EMBRYO] "embryo", + [SLEEPING] "sleep ", + [RUNNABLE] "runble", + [RUNNING] "run ", + [ZOMBIE] "zombie" + }; + int i; + struct proc *p; + char *state; + uint pc[10]; + + for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ + if(p->state == UNUSED) + continue; + if(p->state >= 0 && p->state < NELEM(states) && states[p->state]) + state = states[p->state]; + else + state = "???"; + cprintf("%d %s %s", p->pid, state, p->name); + if(p->state == SLEEPING){ + getcallerpcs((uint*)p->context->ebp+2, pc); + for(i=0; i<10 && pc[i] != 0; i++) + cprintf(" %p", pc[i]); + } + cprintf("\n"); + } +} + + |