Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/top/machine Handle SONPROC state, and fix buglets in...



details:   https://anonhg.NetBSD.org/src/rev/46736f83fc05
branches:  trunk
changeset: 486578:46736f83fc05
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Fri May 26 00:44:58 2000 +0000

description:
Handle SONPROC state, and fix buglets in state sorting weight.

diffstat:

 usr.bin/top/machine/m_netbsd13.c |  34 ++++++++++++++++++++--------------
 1 files changed, 20 insertions(+), 14 deletions(-)

diffs (101 lines):

diff -r 032f36ec0251 -r 46736f83fc05 usr.bin/top/machine/m_netbsd13.c
--- a/usr.bin/top/machine/m_netbsd13.c  Fri May 26 00:42:34 2000 +0000
+++ b/usr.bin/top/machine/m_netbsd13.c  Fri May 26 00:44:58 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: m_netbsd13.c,v 1.10 2000/04/13 08:34:40 mrg Exp $      */
+/*     $NetBSD: m_netbsd13.c,v 1.11 2000/05/26 00:44:58 thorpej Exp $  */
 
 /*
  * top - a top users display for Unix
@@ -34,7 +34,7 @@
  *             matthew green <mrg%eterna.com.au@localhost>
  *
  *
- * $Id: m_netbsd13.c,v 1.10 2000/04/13 08:34:40 mrg Exp $
+ * $Id: m_netbsd13.c,v 1.11 2000/05/26 00:44:58 thorpej Exp $
  */
 #define UVM
 
@@ -130,12 +130,12 @@
  */
 
 static char header[] =
-  "  PID X        PRI NICE   SIZE   RES STATE   TIME   WCPU    CPU COMMAND";
+  "  PID X        PRI NICE   SIZE   RES STATE     TIME   WCPU    CPU COMMAND";
 /* 0123456   -- field to fill in starts at header+6 */
 #define UNAME_START 6
 
 #define Proc_format \
-       "%5d %-8.8s %3d %4d%7s %5s %-5s%7s %5.2f%% %5.2f%% %.14s"
+       "%5d %-8.8s %3d %4d%7s %5s %-7s%7s %5.2f%% %5.2f%% %.12s"
 
 
 /* process state names for the "STATE" column of the display */
@@ -148,6 +148,9 @@
 #ifdef SDEAD
     , "dead"
 #endif
+#ifdef SONPROC
+    , "onproc"
+#endif
 };
 
 static kvm_t *kd;
@@ -176,10 +179,10 @@
 
 /* these are for detailing the process states */
 
-int process_states[7];
+int process_states[8];
 char *procstatenames[] = {
-    "", " starting, ", " running, ", " sleeping, ", " stopped, ",
-    " zombie, ", " ABANDONED, ",
+    "", " starting, ", " runnable, ", " sleeping, ", " stopped, ",
+    " zombie, ", " dead, ", " on processor, ",
     NULL
 };
 
@@ -491,7 +494,11 @@
                PP(pp, p_stat) != SDEAD &&
 #endif
                (show_idle || (PP(pp, p_pctcpu) != 0) || 
-                (PP(pp, p_stat) == SRUN)) &&
+                (PP(pp, p_stat) == SRUN
+#ifdef SONPROC
+                 || PP(pp, p_stat) == SONPROC
+#endif
+                )) &&
                (!show_uid || EP(pp, e_pcred.p_ruid) == (uid_t)sel->uid))
            {
                *prefp++ = pp;
@@ -560,9 +567,6 @@
     /* calculate the base for cpu percentages */
     pct = pctdouble(PP(pp, p_pctcpu));
 
-#define Proc_format \
-       "%5d %-8.8s %3d %4d%7s %5s %-5s%7s %5.2f%% %5.2f%% %.14s"
-
     /* format this entry */
     sprintf(fmt,
            Proc_format,
@@ -700,15 +704,17 @@
 
 static int sorted_state[] = {
     0, /*  (not used)    ?     */
-    5, /* "start"      SIDL    */
+    6, /* "start"      SIDL    */
     4, /* "run"        SRUN    */
     3, /* "sleep"      SSLEEP  */
     3, /* "stop"       SSTOP   */
+    1, /* "zomb"       SZOMB   */
 #ifdef SDEAD
     2, /* "dead"       SDEAD   */
 #endif
-    1, /* "zomb"       SZOMB   */
-
+#ifdef SONPROC
+    5, /* "onproc"     SONPROC */
+#endif
 };
 
 /* compare_cpu - the comparison function for sorting by cpu percentage */



Home | Main Index | Thread Index | Old Index