Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sbin/savecore elide recently introduced warnings that trigge...
details: https://anonhg.NetBSD.org/src/rev/86de482f844a
branches: trunk
changeset: 846230:86de482f844a
user: mrg <mrg%NetBSD.org@localhost>
date: Wed Nov 06 07:29:08 2019 +0000
description:
elide recently introduced warnings that trigger in normal cases, eg:
savecore: dump_exists:471: kvm_read newdumpmag: _kvm_kvatop(ffffffff8180030c)
diffstat:
sbin/savecore/savecore.c | 18 ++++++++++++------
1 files changed, 12 insertions(+), 6 deletions(-)
diffs (49 lines):
diff -r 716eeb62a92e -r 86de482f844a sbin/savecore/savecore.c
--- a/sbin/savecore/savecore.c Wed Nov 06 07:26:31 2019 +0000
+++ b/sbin/savecore/savecore.c Wed Nov 06 07:29:08 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: savecore.c,v 1.88 2018/12/27 21:25:46 mrg Exp $ */
+/* $NetBSD: savecore.c,v 1.89 2019/11/06 07:29:08 mrg Exp $ */
/*-
* Copyright (c) 1986, 1992, 1993
@@ -39,7 +39,7 @@
#if 0
static char sccsid[] = "@(#)savecore.c 8.5 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: savecore.c,v 1.88 2018/12/27 21:25:46 mrg Exp $");
+__RCSID("$NetBSD: savecore.c,v 1.89 2019/11/06 07:29:08 mrg Exp $");
#endif
#endif /* not lint */
@@ -74,11 +74,17 @@
extern FILE *zopen(const char *fname, const char *mode);
/*
- * Note that KREAD_LOGWARN takes a variable name, not pointer to it, unlike
- * KREAD() itself.
+ * Note that KREAD_LOGWARN and KREAD_ERR take a variable name, not
+ * pointer to it, unlike KREAD() itself.
*/
#define KREAD(kd, addr, p)\
(kvm_read(kd, addr, (char *)(p), sizeof(*(p))) != sizeof(*(p)))
+#define KREAD_ERR(kd, addr, p, err) \
+do { \
+ if (KREAD(kd, addr, &(p)) != 0) { \
+ err; \
+ } \
+} while (0)
#define KREAD_LOGWARN(kd, addr, p, err) \
do { \
if (KREAD(kd, addr, &(p)) != 0) { \
@@ -468,8 +474,8 @@
u_int32_t newdumpmag;
/* Read the dump magic and size. */
- KREAD_LOGWARN(kd_dump, dump_nl[X_DUMPMAG].n_value, newdumpmag, return 0);
- KREAD_LOGWARN(kd_dump, dump_nl[X_DUMPSIZE].n_value, dumpsize, return 0);
+ KREAD_ERR(kd_dump, dump_nl[X_DUMPMAG].n_value, newdumpmag, return 0);
+ KREAD_ERR(kd_dump, dump_nl[X_DUMPSIZE].n_value, dumpsize, return 0);
dumpbytes = (off_t)dumpsize * getpagesize();
Home |
Main Index |
Thread Index |
Old Index