Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libkvm add a function to report the name of the file kvm...
details: https://anonhg.NetBSD.org/src/rev/2c61440042bf
branches: trunk
changeset: 769509:2c61440042bf
user: christos <christos%NetBSD.org@localhost>
date: Mon Sep 12 21:11:31 2011 +0000
description:
add a function to report the name of the file kvm_open{,.files} is using.
diffstat:
lib/libkvm/Makefile | 3 ++-
lib/libkvm/kvm.3 | 5 +++--
lib/libkvm/kvm.c | 12 ++++++++++--
lib/libkvm/kvm_open.3 | 5 +++--
lib/libkvm/kvm_private.h | 3 ++-
5 files changed, 20 insertions(+), 8 deletions(-)
diffs (127 lines):
diff -r 0d046de040b6 -r 2c61440042bf lib/libkvm/Makefile
--- a/lib/libkvm/Makefile Mon Sep 12 18:07:29 2011 +0000
+++ b/lib/libkvm/Makefile Mon Sep 12 21:11:31 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.47 2011/02/14 18:27:24 matt Exp $
+# $NetBSD: Makefile,v 1.48 2011/09/12 21:11:31 christos Exp $
# from: @(#)Makefile 8.1 (Berkeley) 6/4/93
USE_FORT?= yes # used primarily by setgid programs
@@ -39,6 +39,7 @@
.endif
MAN= kvm.3 kvm_dump.3 kvm_geterr.3 kvm_getfiles.3 kvm_getloadavg.3 \
+ kvm_getkernelname.3 \
kvm_getprocs.3 kvm_nlist.3 kvm_open.3 kvm_read.3 kvm_getlwps.3
MLINKS+=kvm_getprocs.3 kvm_getargv.3 kvm_getprocs.3 kvm_getenvv.3
diff -r 0d046de040b6 -r 2c61440042bf lib/libkvm/kvm.3
--- a/lib/libkvm/kvm.3 Mon Sep 12 18:07:29 2011 +0000
+++ b/lib/libkvm/kvm.3 Mon Sep 12 21:11:31 2011 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: kvm.3,v 1.11 2003/08/07 16:44:35 agc Exp $
+.\" $NetBSD: kvm.3,v 1.12 2011/09/12 21:11:32 christos Exp $
.\"
.\" Copyright (c) 1992, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -33,7 +33,7 @@
.\"
.\" @(#)kvm.3 8.1 (Berkeley) 6/4/93
.\"
-.Dd August 18, 2002
+.Dd September 14, 2011
.Dt KVM 3
.Os
.Sh NAME
@@ -99,6 +99,7 @@
.Xr kvm_getargv 3 ,
.Xr kvm_getenvv 3 ,
.Xr kvm_geterr 3 ,
+.Xr kvm_getkernelname 3 ,
.Xr kvm_getloadavg 3 ,
.Xr kvm_getlwps 3 ,
.Xr kvm_getprocs 3 ,
diff -r 0d046de040b6 -r 2c61440042bf lib/libkvm/kvm.c
--- a/lib/libkvm/kvm.c Mon Sep 12 18:07:29 2011 +0000
+++ b/lib/libkvm/kvm.c Mon Sep 12 21:11:31 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kvm.c,v 1.97 2010/11/26 22:01:53 dholland Exp $ */
+/* $NetBSD: kvm.c,v 1.98 2011/09/12 21:11:32 christos Exp $ */
/*-
* Copyright (c) 1989, 1992, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)kvm.c 8.2 (Berkeley) 2/13/94";
#else
-__RCSID("$NetBSD: kvm.c,v 1.97 2010/11/26 22:01:53 dholland Exp $");
+__RCSID("$NetBSD: kvm.c,v 1.98 2011/09/12 21:11:32 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -90,6 +90,12 @@
return (kd->errbuf);
}
+const char *
+kvm_getkernelname(kvm_t *kd)
+{
+ return kd->kernelname;
+}
+
/*
* Report an error using printf style arguments. "program" is kd->program
* on hard errors, and 0 on soft errors, so that under sun error emulation,
@@ -336,7 +342,9 @@
_kvm_syserr(kd, kd->program, "%s", uf);
goto failed;
}
+ strlcpy(kd->kernelname, uf, sizeof(kd->kernelname));
} else {
+ strlcpy(kd->kernelname, _PATH_KSYMS, sizeof(kd->kernelname));
/*
* We're here because /dev/ksyms was opened
* successfully. However, we don't want to keep it
diff -r 0d046de040b6 -r 2c61440042bf lib/libkvm/kvm_open.3
--- a/lib/libkvm/kvm_open.3 Mon Sep 12 18:07:29 2011 +0000
+++ b/lib/libkvm/kvm_open.3 Mon Sep 12 21:11:31 2011 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: kvm_open.3,v 1.17 2010/03/22 21:55:06 joerg Exp $
+.\" $NetBSD: kvm_open.3,v 1.18 2011/09/12 21:11:32 christos Exp $
.\"
.\" Copyright (c) 1992, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -33,7 +33,7 @@
.\"
.\" @(#)kvm_open.3 8.3 (Berkeley) 4/19/94
.\"
-.Dd September 14, 2009
+.Dd September 14, 2011
.Dt KVM_OPEN 3
.Os
.Sh NAME
@@ -224,6 +224,7 @@
.Xr kvm_getargv 3 ,
.Xr kvm_getenvv 3 ,
.Xr kvm_geterr 3 ,
+.Xr kvm_getkernelname 3 ,
.Xr kvm_getprocs 3 ,
.Xr kvm_nlist 3 ,
.Xr kvm_read 3 ,
diff -r 0d046de040b6 -r 2c61440042bf lib/libkvm/kvm_private.h
--- a/lib/libkvm/kvm_private.h Mon Sep 12 18:07:29 2011 +0000
+++ b/lib/libkvm/kvm_private.h Mon Sep 12 21:11:31 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kvm_private.h,v 1.19 2010/09/26 22:28:05 jym Exp $ */
+/* $NetBSD: kvm_private.h,v 1.20 2011/09/12 21:11:32 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -90,6 +90,7 @@
size_t fdalign;
uint8_t *iobuf;
size_t iobufsz;
+ char kernelname[MAXPATHLEN];
};
/* Levels of aliveness */
Home |
Main Index |
Thread Index |
Old Index