Module Name: src
Committed By: christos
Date: Sat Dec 25 14:18:38 UTC 2010
Modified Files:
src/usr.bin/vmstat: vmstat.c
Log Message:
Don't crash on old kernels that don't have the new per cpu counters.
To generate a diff of this commit:
cvs rdiff -u -r1.172 -r1.173 src/usr.bin/vmstat/vmstat.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/vmstat/vmstat.c
diff -u src/usr.bin/vmstat/vmstat.c:1.172 src/usr.bin/vmstat/vmstat.c:1.173
--- src/usr.bin/vmstat/vmstat.c:1.172 Fri Dec 24 18:39:19 2010
+++ src/usr.bin/vmstat/vmstat.c Sat Dec 25 09:18:37 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: vmstat.c,v 1.172 2010/12/24 23:39:19 enami Exp $ */
+/* $NetBSD: vmstat.c,v 1.173 2010/12/25 14:18:37 christos Exp $ */
/*-
* Copyright (c) 1998, 2000, 2001, 2007 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
#if 0
static char sccsid[] = "@(#)vmstat.c 8.2 (Berkeley) 3/1/95";
#else
-__RCSID("$NetBSD: vmstat.c,v 1.172 2010/12/24 23:39:19 enami Exp $");
+__RCSID("$NetBSD: vmstat.c,v 1.173 2010/12/25 14:18:37 christos Exp $");
#endif
#endif /* not lint */
@@ -983,7 +983,8 @@
!= sizeof(tci)) {
warnx("Can't read cpu info from %p (%s)",
ci, kvm_geterr(kd));
- continue;
+ (void)memset(cc, 0, sizeof(*cc));
+ return;
}
/* Found the fake element, done */
if (tci.ci_data.cpu_qchain.cqe_prev == NULL)