From 676abde78705d4a8c7a7ecc22e57a5d7e0d65d0d Mon Sep 17 00:00:00 2001 From: christos Date: Sun, 7 Dec 2003 07:27:09 +0000 Subject: [PATCH] be more descriptive about what failed by printing the errno and the variable we were trying to fetch. --- usr.bin/systat/extern.h | 4 ++-- usr.bin/systat/fetch.c | 11 ++++++----- usr.bin/systat/systat.h | 4 ++-- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/usr.bin/systat/extern.h b/usr.bin/systat/extern.h index 0f5d049d2da4..102aef2e5ffb 100644 --- a/usr.bin/systat/extern.h +++ b/usr.bin/systat/extern.h @@ -1,4 +1,4 @@ -/* $NetBSD: extern.h,v 1.32 2003/09/12 17:32:31 mycroft Exp $ */ +/* $NetBSD: extern.h,v 1.33 2003/12/07 07:27:09 christos Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -129,7 +129,7 @@ void ip_run(char *); void ip_time(char *); void ip_zero(char *); int keyboard(void) __attribute__((__noreturn__)); -ssize_t kvm_ckread(const void *, void *, size_t); +ssize_t kvm_ckread(const void *, void *, size_t, const char *); void labelbufcache(void); void labelicmp(void); void labeliostat(void); diff --git a/usr.bin/systat/fetch.c b/usr.bin/systat/fetch.c index db65a184acda..51d8b3992cef 100644 --- a/usr.bin/systat/fetch.c +++ b/usr.bin/systat/fetch.c @@ -1,4 +1,4 @@ -/* $NetBSD: fetch.c,v 1.11 2003/08/07 11:15:58 agc Exp $ */ +/* $NetBSD: fetch.c,v 1.12 2003/12/07 07:27:09 christos Exp $ */ /*- * Copyright (c) 1980, 1992, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)fetch.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: fetch.c,v 1.11 2003/08/07 11:15:58 agc Exp $"); +__RCSID("$NetBSD: fetch.c,v 1.12 2003/12/07 07:27:09 christos Exp $"); #endif /* not lint */ #include @@ -42,17 +42,18 @@ __RCSID("$NetBSD: fetch.c,v 1.11 2003/08/07 11:15:58 agc Exp $"); #include #include +#include #include "systat.h" #include "extern.h" ssize_t -kvm_ckread(const void *a, void *b, size_t l) +kvm_ckread(const void *a, void *b, size_t l, const char *name) { if (kvm_read(kd, (u_long)a, b, l) != l) { if (verbose) - error("error reading kmem at %lx\n", - (u_long) a); + error("error reading kmem for %s at %p (%s)\n", name, + a, strerror(errno)); return (0); } else return (1); diff --git a/usr.bin/systat/systat.h b/usr.bin/systat/systat.h index 0960b23713e0..13ee514705aa 100644 --- a/usr.bin/systat/systat.h +++ b/usr.bin/systat/systat.h @@ -57,8 +57,8 @@ struct command { #define TCP 0x1 #define UDP 0x2 -#define KREAD(addr, buf, len) kvm_ckread((addr), (buf), (len)) +#define KREAD(addr, buf, len) kvm_ckread((addr), (buf), (len), # addr) #define NVAL(indx) namelist[(indx)].n_value #define NPTR(indx) (void *)NVAL((indx)) -#define NREAD(indx, buf, len) kvm_ckread(NPTR((indx)), (buf), (len)) +#define NREAD(indx, buf, len) kvm_ckread(NPTR((indx)), (buf), (len), # indx) #define LONG (sizeof (long))