Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/pstat Don't print swap information when reading fro...



details:   https://anonhg.NetBSD.org/src/rev/5c80c1060a18
branches:  trunk
changeset: 584214:5c80c1060a18
user:      rpaulo <rpaulo%NetBSD.org@localhost>
date:      Sun Sep 11 16:09:51 2005 +0000

description:
Don't print swap information when reading from kernel dumps. Fixes PR
13418 by Andrew Doran <ad%netbsd.org@localhost>.

diffstat:

 usr.sbin/pstat/pstat.c |  11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diffs (46 lines):

diff -r 049d54592628 -r 5c80c1060a18 usr.sbin/pstat/pstat.c
--- a/usr.sbin/pstat/pstat.c    Sun Sep 11 14:30:31 2005 +0000
+++ b/usr.sbin/pstat/pstat.c    Sun Sep 11 16:09:51 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pstat.c,v 1.91 2005/09/02 21:26:47 rpaulo Exp $        */
+/*     $NetBSD: pstat.c,v 1.92 2005/09/11 16:09:51 rpaulo Exp $        */
 
 /*-
  * Copyright (c) 1980, 1991, 1993, 1994
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)pstat.c    8.16 (Berkeley) 5/9/95";
 #else
-__RCSID("$NetBSD: pstat.c,v 1.91 2005/09/02 21:26:47 rpaulo Exp $");
+__RCSID("$NetBSD: pstat.c,v 1.92 2005/09/11 16:09:51 rpaulo Exp $");
 #endif
 #endif /* not lint */
 
@@ -184,7 +184,7 @@
 int
 main(int argc, char *argv[])
 {
-       int ch, i, quit, ret;
+       int ch, i, quit, ret, use_sysctl;
        int fileflag, swapflag, ttyflag, vnodeflag;
        gid_t egid = getegid();
        char buf[_POSIX2_LINE_MAX];
@@ -247,6 +247,8 @@
        else
                (void)setegid(egid);
 
+       use_sysctl = (nlistf == NULL && memf == NULL);
+
        if ((kd = kvm_openfiles(nlistf, memf, NULL, O_RDONLY, buf)) == 0)
                errx(1, "kvm_openfiles: %s", buf);
 
@@ -273,7 +275,8 @@
        if (ttyflag)
                ttymode();
        if (swapflag || totalflag)
-               list_swap(0, kflag, 0, totalflag, 1, hflag);
+               if (use_sysctl)
+                       list_swap(0, kflag, 0, totalflag, 1, hflag);
        exit(0);
 }
 



Home | Main Index | Thread Index | Old Index