Module Name: src Committed By: christos Date: Mon Sep 12 21:11:32 UTC 2011
Modified Files: src/lib/libkvm: Makefile kvm.3 kvm.c kvm_open.3 kvm_private.h Log Message: add a function to report the name of the file kvm_open{,.files} is using. To generate a diff of this commit: cvs rdiff -u -r1.47 -r1.48 src/lib/libkvm/Makefile cvs rdiff -u -r1.11 -r1.12 src/lib/libkvm/kvm.3 cvs rdiff -u -r1.97 -r1.98 src/lib/libkvm/kvm.c cvs rdiff -u -r1.17 -r1.18 src/lib/libkvm/kvm_open.3 cvs rdiff -u -r1.19 -r1.20 src/lib/libkvm/kvm_private.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/lib/libkvm/Makefile diff -u src/lib/libkvm/Makefile:1.47 src/lib/libkvm/Makefile:1.48 --- src/lib/libkvm/Makefile:1.47 Mon Feb 14 13:27:24 2011 +++ src/lib/libkvm/Makefile Mon Sep 12 17:11:31 2011 @@ -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 Index: src/lib/libkvm/kvm.3 diff -u src/lib/libkvm/kvm.3:1.11 src/lib/libkvm/kvm.3:1.12 --- src/lib/libkvm/kvm.3:1.11 Thu Aug 7 12:44:35 2003 +++ src/lib/libkvm/kvm.3 Mon Sep 12 17:11:32 2011 @@ -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 , Index: src/lib/libkvm/kvm.c diff -u src/lib/libkvm/kvm.c:1.97 src/lib/libkvm/kvm.c:1.98 --- src/lib/libkvm/kvm.c:1.97 Fri Nov 26 17:01:53 2010 +++ src/lib/libkvm/kvm.c Mon Sep 12 17:11:32 2011 @@ -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 Index: src/lib/libkvm/kvm_open.3 diff -u src/lib/libkvm/kvm_open.3:1.17 src/lib/libkvm/kvm_open.3:1.18 --- src/lib/libkvm/kvm_open.3:1.17 Mon Mar 22 17:55:06 2010 +++ src/lib/libkvm/kvm_open.3 Mon Sep 12 17:11:32 2011 @@ -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 , Index: src/lib/libkvm/kvm_private.h diff -u src/lib/libkvm/kvm_private.h:1.19 src/lib/libkvm/kvm_private.h:1.20 --- src/lib/libkvm/kvm_private.h:1.19 Sun Sep 26 18:28:05 2010 +++ src/lib/libkvm/kvm_private.h Mon Sep 12 17:11:32 2011 @@ -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 */