]> Devi Nivas Git - cs3210-lab0.git/commitdiff
cleaner table
authorrsc <rsc>
Wed, 8 Aug 2007 09:42:36 +0000 (09:42 +0000)
committerrsc <rsc>
Wed, 8 Aug 2007 09:42:36 +0000 (09:42 +0000)
proc.c

diff --git a/proc.c b/proc.c
index 54b6c3dfc09c4875064a01c4ad56afba7d52a6ba..3a19d92525ec5812885c1aa8fd5be4d8c51d61ca 100644 (file)
--- a/proc.c
+++ b/proc.c
@@ -422,12 +422,12 @@ void
 procdump(void)
 {
   static char *states[] = {
-    "unused",
-    "embryo",
-    "sleep ",
-    "runble",
-    "run   ",
-    "zombie"
+  [UNUSED]    "unused",
+  [EMBRYO]    "embryo",
+  [SLEEPING]  "sleep ",
+  [RUNNABLE]  "runble",
+  [RUNNING]   "run   ",
+  [ZOMBIE]    "zombie"
   };
   int i;
   struct proc *p;
@@ -437,10 +437,10 @@ procdump(void)
     p = &proc[i];
     if(p->state == UNUSED)
       continue;
-    if(p->state < 0 || p->state > ZOMBIE)
-      state = "???";
-    else
+    if(p->state >= 0 && p->state < NELEM(states))
       state = states[p->state];
+    else
+      state = "???";
     cprintf("%d %s %s\n", p->pid, state, p->name);
   }
 }