Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/vmstat Don't error when tape drives are not configur...



details:   https://anonhg.NetBSD.org/src/rev/1aa1e57a3ca2
branches:  trunk
changeset: 583477:1aa1e57a3ca2
user:      blymn <blymn%NetBSD.org@localhost>
date:      Mon Aug 08 11:31:48 2005 +0000

description:
Don't error when tape drives are not configured on a system.

diffstat:

 usr.bin/vmstat/tpstats.c |  9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diffs (37 lines):

diff -r 645a97643de4 -r 1aa1e57a3ca2 usr.bin/vmstat/tpstats.c
--- a/usr.bin/vmstat/tpstats.c  Mon Aug 08 05:54:07 2005 +0000
+++ b/usr.bin/vmstat/tpstats.c  Mon Aug 08 11:31:48 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tpstats.c,v 1.1 2005/08/07 12:21:46 blymn Exp $        */
+/*     $NetBSD: tpstats.c,v 1.2 2005/08/08 11:31:48 blymn Exp $        */
 
 /*
  * Copyright 2005 Brett Lymn
@@ -163,7 +163,7 @@
 
                size = tp_ndrive * sizeof(struct tape_sysctl);
                if (sysctl(mib, 3, tapes, &size, NULL, 0) < 0)
-                       err(1, "sysctl hw.tapestats failed");
+                       tp_ndrive = 0;
                for (i = 0; i < tp_ndrive; i++) {
                        cur_tape.rxfer[i] = tapes[i].rxfer;
                        cur_tape.wxfer[i] = tapes[i].wxfer;
@@ -206,7 +206,8 @@
                mib[1] = HW_TAPESTATS;
                mib[2] = sizeof(struct tape_sysctl);
                if (sysctl(mib, 3, NULL, &size, NULL, 0) == -1)
-                       err(1, "sysctl hw.tapestats failed");
+                       size = 0;
+
                tp_ndrive = size / sizeof(struct tape_sysctl);
 
                if (size == 0) {
@@ -274,7 +275,7 @@
                mib[1] = HW_TAPESTATS;          /* ... above, but be safe... */
                mib[2] = sizeof(struct tape_sysctl);
                if (sysctl(mib, 3, tapes, &size, NULL, 0) == -1)
-                       err(1, "sysctl hw.tapestats failed");
+                       tp_ndrive = 0;
                for (i = 0; i < tp_ndrive; i++) {
                        cur_tape.name[i] = tapes[i].name;
                        cur_tape.select[i] = selected;



Home | Main Index | Thread Index | Old Index