be more descriptive about what failed by printing the errno and the
variable we were trying to fetch.
This commit is contained in:
parent
609617af90
commit
676abde787
|
@ -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);
|
||||
|
|
|
@ -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 <sys/param.h>
|
||||
|
@ -42,17 +42,18 @@ __RCSID("$NetBSD: fetch.c,v 1.11 2003/08/07 11:15:58 agc Exp $");
|
|||
#include <sys/sysctl.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#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);
|
||||
|
|
|
@ -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))
|
||||
|
|
Loading…
Reference in New Issue