Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libkvm Define KREAD() inside kvm_private.h, for reusabil...
details: https://anonhg.NetBSD.org/src/rev/f8264c3f84b0
branches: trunk
changeset: 757843:f8264c3f84b0
user: jym <jym%NetBSD.org@localhost>
date: Sun Sep 26 22:28:05 2010 +0000
description:
Define KREAD() inside kvm_private.h, for reusability.
diffstat:
lib/libkvm/kvm_file.c | 12 +++++-------
lib/libkvm/kvm_getloadavg.c | 6 ++----
lib/libkvm/kvm_m68k_cmn.c | 7 ++-----
lib/libkvm/kvm_private.h | 5 ++++-
lib/libkvm/kvm_proc.c | 7 ++-----
5 files changed, 15 insertions(+), 22 deletions(-)
diffs (149 lines):
diff -r 1baea1def130 -r f8264c3f84b0 lib/libkvm/kvm_file.c
--- a/lib/libkvm/kvm_file.c Sun Sep 26 21:12:23 2010 +0000
+++ b/lib/libkvm/kvm_file.c Sun Sep 26 22:28:05 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kvm_file.c,v 1.27 2010/09/19 02:07:00 jym Exp $ */
+/* $NetBSD: kvm_file.c,v 1.28 2010/09/26 22:28:05 jym Exp $ */
/*-
* Copyright (c) 1989, 1992, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)kvm_file.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: kvm_file.c,v 1.27 2010/09/19 02:07:00 jym Exp $");
+__RCSID("$NetBSD: kvm_file.c,v 1.28 2010/09/26 22:28:05 jym Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -72,9 +72,6 @@
#include "kvm_private.h"
-#define KREAD(kd, addr, obj) \
- (kvm_read(kd, (u_long) addr, obj, sizeof(*obj)) != sizeof(*obj))
-
static int
kvm_deadfiles(kvm_t *, int, int, long, int);
@@ -94,7 +91,7 @@
* first copyout filehead
*/
if (buflen < sizeof(fhead) ||
- KREAD(kd, ofhead, &fhead)) {
+ KREAD(kd, (u_long)ofhead, &fhead)) {
_kvm_err(kd, kd->program, "can't read filehead");
return (0);
}
@@ -107,7 +104,8 @@
*/
for (fp = fhead.lh_first; fp != 0; fp = fp->f_list.le_next) {
if (buflen > sizeof(struct file)) {
- if (KREAD(kd, (long)fp, ((struct file *)(void *)where))) {
+ if (KREAD(kd, (u_long)fp,
+ ((struct file *)(void *)where))) {
_kvm_err(kd, kd->program, "can't read kfp");
return (0);
}
diff -r 1baea1def130 -r f8264c3f84b0 lib/libkvm/kvm_getloadavg.c
--- a/lib/libkvm/kvm_getloadavg.c Sun Sep 26 21:12:23 2010 +0000
+++ b/lib/libkvm/kvm_getloadavg.c Sun Sep 26 22:28:05 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kvm_getloadavg.c,v 1.9 2010/09/19 02:07:00 jym Exp $ */
+/* $NetBSD: kvm_getloadavg.c,v 1.10 2010/09/26 22:28:05 jym Exp $ */
/*-
* Copyright (c) 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)kvm_getloadavg.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: kvm_getloadavg.c,v 1.9 2010/09/19 02:07:00 jym Exp $");
+__RCSID("$NetBSD: kvm_getloadavg.c,v 1.10 2010/09/26 22:28:05 jym Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -86,8 +86,6 @@
return (-1);
}
-#define KREAD(kd, addr, obj) \
- (kvm_read(kd, addr, (void *)(obj), sizeof(*obj)) != sizeof(*obj))
if (KREAD(kd, nl[X_AVERUNNABLE].n_value, &loadinfo)) {
_kvm_err(kd, kd->program, "can't read averunnable");
return (-1);
diff -r 1baea1def130 -r f8264c3f84b0 lib/libkvm/kvm_m68k_cmn.c
--- a/lib/libkvm/kvm_m68k_cmn.c Sun Sep 26 21:12:23 2010 +0000
+++ b/lib/libkvm/kvm_m68k_cmn.c Sun Sep 26 22:28:05 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kvm_m68k_cmn.c,v 1.15 2010/09/20 23:23:16 jym Exp $ */
+/* $NetBSD: kvm_m68k_cmn.c,v 1.16 2010/09/26 22:28:05 jym Exp $ */
/*-
* Copyright (c) 1989, 1992, 1993
@@ -74,7 +74,7 @@
#if 0
static char sccsid[] = "@(#)kvm_hp300.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: kvm_m68k_cmn.c,v 1.15 2010/09/20 23:23:16 jym Exp $");
+__RCSID("$NetBSD: kvm_m68k_cmn.c,v 1.16 2010/09/26 22:28:05 jym Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -116,9 +116,6 @@
#define _kvm_btop(v, a) (((unsigned)(a)) >> (v)->pgshift)
-#define KREAD(kd, addr, p)\
- (kvm_read(kd, addr, (char *)(p), sizeof(*(p))) != sizeof(*(p)))
-
void
_kvm_cmn_freevtop(kvm_t *kd)
{
diff -r 1baea1def130 -r f8264c3f84b0 lib/libkvm/kvm_private.h
--- a/lib/libkvm/kvm_private.h Sun Sep 26 21:12:23 2010 +0000
+++ b/lib/libkvm/kvm_private.h Sun Sep 26 22:28:05 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kvm_private.h,v 1.18 2010/09/20 23:23:16 jym Exp $ */
+/* $NetBSD: kvm_private.h,v 1.19 2010/09/26 22:28:05 jym Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -119,6 +119,9 @@
__attribute__((__format__(__printf__, 3, 4)));
ssize_t _kvm_pread(kvm_t *, int, void *, size_t, off_t);
+#define KREAD(kd, addr, obj) \
+ (kvm_read(kd, addr, (obj), sizeof(*obj)) != sizeof(*obj))
+
#define KVM_ALLOC(kd, member, size) \
do { \
if (kd->member == NULL) \
diff -r 1baea1def130 -r f8264c3f84b0 lib/libkvm/kvm_proc.c
--- a/lib/libkvm/kvm_proc.c Sun Sep 26 21:12:23 2010 +0000
+++ b/lib/libkvm/kvm_proc.c Sun Sep 26 22:28:05 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kvm_proc.c,v 1.86 2010/09/20 23:23:16 jym Exp $ */
+/* $NetBSD: kvm_proc.c,v 1.87 2010/09/26 22:28:05 jym Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
#if 0
static char sccsid[] = "@(#)kvm_proc.c 8.3 (Berkeley) 9/23/93";
#else
-__RCSID("$NetBSD: kvm_proc.c,v 1.86 2010/09/20 23:23:16 jym Exp $");
+__RCSID("$NetBSD: kvm_proc.c,v 1.87 2010/09/26 22:28:05 jym Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -170,9 +170,6 @@
specificdata_reference cr_sd; /* specific data */
};
-#define KREAD(kd, addr, obj) \
- (kvm_read(kd, addr, (obj), sizeof(*obj)) != sizeof(*obj))
-
/* XXX: What uses these two functions? */
char *_kvm_uread(kvm_t *, const struct proc *, u_long, u_long *);
ssize_t kvm_uread(kvm_t *, const struct proc *, u_long, char *,
Home |
Main Index |
Thread Index |
Old Index