Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/systat Fetch maxslp from the kernel. Only use USPAC...



details:   https://anonhg.NetBSD.org/src/rev/207ece9dfb41
branches:  trunk
changeset: 512707:207ece9dfb41
user:      matt <matt%NetBSD.org@localhost>
date:      Sat Jul 14 07:09:11 2001 +0000

description:
Fetch maxslp from the kernel.  Only use USPACE if it's defined.

diffstat:

 usr.bin/systat/extern.h |   4 ++--
 usr.bin/systat/main.c   |   9 ++++++---
 usr.bin/systat/ps.c     |  10 ++++++----
 3 files changed, 14 insertions(+), 9 deletions(-)

diffs (108 lines):

diff -r a3ebaf075d60 -r 207ece9dfb41 usr.bin/systat/extern.h
--- a/usr.bin/systat/extern.h   Sat Jul 14 06:53:43 2001 +0000
+++ b/usr.bin/systat/extern.h   Sat Jul 14 07:09:11 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: extern.h,v 1.26 2000/12/01 02:19:43 simonb Exp $       */
+/*     $NetBSD: extern.h,v 1.27 2001/07/14 07:09:11 matt Exp $ */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -52,7 +52,7 @@
 extern kvm_t   *kd;
 extern long    ntext, textp;
 extern int     CMDLINE;
-extern int     hz, stathz;
+extern int     hz, stathz, maxslp;
 extern int     naptime, col;
 extern int     nhosts;
 extern int     nports;
diff -r a3ebaf075d60 -r 207ece9dfb41 usr.bin/systat/main.c
--- a/usr.bin/systat/main.c     Sat Jul 14 06:53:43 2001 +0000
+++ b/usr.bin/systat/main.c     Sat Jul 14 07:09:11 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.28 2000/12/01 02:19:44 simonb Exp $ */
+/*     $NetBSD: main.c,v 1.29 2001/07/14 07:09:11 matt Exp $   */
 
 /*-
  * Copyright (c) 1980, 1992, 1993
@@ -40,7 +40,7 @@
 #if 0
 static char sccsid[] = "@(#)main.c     8.1 (Berkeley) 6/6/93";
 #endif
-__RCSID("$NetBSD: main.c,v 1.28 2000/12/01 02:19:44 simonb Exp $");
+__RCSID("$NetBSD: main.c,v 1.29 2001/07/14 07:09:11 matt Exp $");
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -64,6 +64,8 @@
        { "_hz" },
 #define        X_STATHZ                1
        { "_stathz" },
+#define        X_MAXSLP                2
+       { "_maxslp" },
        { "" }
 };
 static int     dellave;
@@ -76,7 +78,7 @@
 int     col;
 int    naptime = 5;
 int     verbose = 1;                    /* to report kvm read errs */
-int     hz, stathz;
+int     hz, stathz, maxslp;
 char    c;
 char    *namp;
 char    hostname[MAXHOSTNAMELEN + 1];
@@ -217,6 +219,7 @@
        hostname[sizeof(hostname) - 1] = '\0';
        NREAD(X_HZ, &hz, sizeof hz);
        NREAD(X_STATHZ, &stathz, sizeof stathz);
+       NREAD(X_MAXSLP, &maxslp, sizeof maxslp);
        (*curmode->c_init)();
        curmode->c_flags |= CF_INIT;
        labels();
diff -r a3ebaf075d60 -r 207ece9dfb41 usr.bin/systat/ps.c
--- a/usr.bin/systat/ps.c       Sat Jul 14 06:53:43 2001 +0000
+++ b/usr.bin/systat/ps.c       Sat Jul 14 07:09:11 2001 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: ps.c,v 1.18 2000/12/20 01:17:49 cgd Exp $  */
+/*      $NetBSD: ps.c,v 1.19 2001/07/14 07:09:11 matt Exp $  */
 
 /*-
  * Copyright (c) 1999
@@ -45,7 +45,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: ps.c,v 1.18 2000/12/20 01:17:49 cgd Exp $");
+__RCSID("$NetBSD: ps.c,v 1.19 2001/07/14 07:09:11 matt Exp $");
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -175,7 +175,7 @@
 
        case SSLEEP:
                if (flag & P_SINTR)     /* interuptable (long) */
-                       *cp = p->p_slptime >= MAXSLP ? 'I' : 'S';
+                       *cp = p->p_slptime >= maxslp ? 'I' : 'S';
                else
                        *cp = 'D';
                break;
@@ -303,15 +303,17 @@
        struct proc *p;
        struct eproc *e; 
        double fracmem;
-       int szptudot;
+       int szptudot = 0;
 
        p = &(kp->kp_proc);
        e = &(kp->kp_eproc);
 
        if ((p->p_flag & P_INMEM) == 0)
                return (0.0);
+#ifdef USPACE
        /* XXX want pmap ptpages, segtab, etc. (per architecture) */
        szptudot = USPACE/getpagesize();
+#endif
        /* XXX don't have info about shared */
        fracmem = ((double)e->e_vm.vm_rssize + szptudot)/mempages;
        return (fracmem >= 0) ? 100.0 * fracmem : 0;



Home | Main Index | Thread Index | Old Index