summaryrefslogtreecommitdiffstats
path: root/lib/libkvm/kvm.c
diff options
context:
space:
mode:
authormiod <miod@openbsd.org>2009-01-21 22:18:00 +0000
committermiod <miod@openbsd.org>2009-01-21 22:18:00 +0000
commitcbe3564fe3f8ca9c5e3600fe588675960d9215e2 (patch)
tree05036d7fc4a5d53900ca2a2b9ef14f99e708a96a /lib/libkvm/kvm.c
parentReplace timeout_add(msecs * hz / 1000) with timeout_add_msec(msecs). (diff)
downloadwireguard-openbsd-cbe3564fe3f8ca9c5e3600fe588675960d9215e2.tar.xz
wireguard-openbsd-cbe3564fe3f8ca9c5e3600fe588675960d9215e2.zip
All operation on live kernels uses sysctl interface, there is no reason to
access the swap area. Change kvm_open() to no longer require a swap area, and to not consider failure to open() it as fatal. Post-mortem analysis would need an image of the swap area at the time of the crash, anyway.
Diffstat (limited to 'lib/libkvm/kvm.c')
-rw-r--r--lib/libkvm/kvm.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/libkvm/kvm.c b/lib/libkvm/kvm.c
index 393dd5971db..c8b5fd333b4 100644
--- a/lib/libkvm/kvm.c
+++ b/lib/libkvm/kvm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kvm.c,v 1.45 2006/03/31 03:59:40 deraadt Exp $ */
+/* $OpenBSD: kvm.c,v 1.46 2009/01/21 22:18:00 miod Exp $ */
/* $NetBSD: kvm.c,v 1.43 1996/05/05 04:31:59 gwr Exp $ */
/*-
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)kvm.c 8.2 (Berkeley) 2/13/94";
#else
-static char *rcsid = "$OpenBSD: kvm.c,v 1.45 2006/03/31 03:59:40 deraadt Exp $";
+static char *rcsid = "$OpenBSD: kvm.c,v 1.46 2009/01/21 22:18:00 miod Exp $";
#endif
#endif /* LIBC_SCCS and not lint */
@@ -213,8 +213,6 @@ _kvm_open(kvm_t *kd, const char *uf, const char *mf, const char *sf,
}
if (mf == 0)
mf = _PATH_MEM;
- if (sf == 0)
- sf = _PATH_DRUM;
if ((kd->pmfd = open(mf, flag, 0)) < 0) {
_kvm_syserr(kd, kd->program, "%s", mf);
@@ -241,7 +239,7 @@ _kvm_open(kvm_t *kd, const char *uf, const char *mf, const char *sf,
goto failed;
}
kd->alive = 1;
- if ((kd->swfd = open(sf, flag, 0)) < 0) {
+ if (sf != NULL && (kd->swfd = open(sf, flag, 0)) < 0) {
_kvm_syserr(kd, kd->program, "%s", sf);
goto failed;
}