xref: /openbsd/lib/libkvm/kvm.3 (revision db3296cf)
1.\"	$OpenBSD: kvm.3,v 1.6 2003/06/02 20:18:40 millert Exp $
2.\"	$NetBSD: kvm.3,v 1.2 1996/03/18 22:33:11 thorpej Exp $
3.\"
4.\" Copyright (c) 1992, 1993
5.\"	The Regents of the University of California.  All rights reserved.
6.\"
7.\" This code is derived from software developed by the Computer Systems
8.\" Engineering group at Lawrence Berkeley Laboratory under DARPA contract
9.\" BG 91-66 and contributed to Berkeley.
10.\"
11.\" Redistribution and use in source and binary forms, with or without
12.\" modification, are permitted provided that the following conditions
13.\" are met:
14.\" 1. Redistributions of source code must retain the above copyright
15.\"    notice, this list of conditions and the following disclaimer.
16.\" 2. Redistributions in binary form must reproduce the above copyright
17.\"    notice, this list of conditions and the following disclaimer in the
18.\"    documentation and/or other materials provided with the distribution.
19.\" 3. Neither the name of the University nor the names of its contributors
20.\"    may be used to endorse or promote products derived from this software
21.\"    without specific prior written permission.
22.\"
23.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33.\" SUCH DAMAGE.
34.\"
35.\"     @(#)kvm.3	8.1 (Berkeley) 6/4/93
36.\"
37.Dd June 4, 1993
38.Dt KVM 3
39.Os
40.Sh NAME
41.Nm kvm
42.Nd kernel memory interface
43.Sh DESCRIPTION
44The
45.Nm kvm
46library provides a uniform interface for accessing kernel virtual memory
47images, including live systems and crash dumps.
48Access to live systems is via
49.Pa /dev/mem
50while crash dumps can be examined via the core file generated by
51.Xr savecore 8 .
52The interface behaves identically in both cases.
53Memory can be read and written, kernel symbol addresses can be
54looked up efficiently, and information about user processes can
55be gathered.
56.Pp
57.Fn kvm_open
58is first called to obtain a descriptor for all subsequent calls.
59.Sh FILES
60.Bl -tag -width /dev/mem -compact
61.It Pa /dev/mem
62interface to physical memory
63.El
64.Sh SEE ALSO
65.Xr kvm_close 3 ,
66.Xr kvm_getargv 3 ,
67.Xr kvm_getenvv 3 ,
68.Xr kvm_geterr 3 ,
69.Xr kvm_getloadavg 3 ,
70.Xr kvm_getprocs 3 ,
71.Xr kvm_nlist 3 ,
72.Xr kvm_open 3 ,
73.Xr kvm_openfiles 3 ,
74.Xr kvm_read 3 ,
75.Xr kvm_write 3
76.Sh STANDARDS
77The kvm interface was first introduced in SunOS.
78A considerable
79number of programs have been developed that use this interface,
80making backward compatibility highly desirable.
81In most respects, the Sun kvm interface is consistent and clean.
82Accordingly, the generic portion of the interface (i.e.,
83.Fn kvm_open ,
84.Fn kvm_close ,
85.Fn kvm_read ,
86.Fn kvm_write ,
87and
88.Fn kvm_nlist )
89has been incorporated into the BSD interface.
90Indeed, many kvm
91applications (i.e., debuggers and statistical monitors) use only
92this subset of the interface.
93.Pp
94The process interface was not kept.
95This is not a portability
96issue since any code that manipulates processes is inherently
97machine dependent.
98.Pp
99Finally, the Sun kvm error reporting semantics are poorly defined.
100The library can be configured either to print errors to stderr automatically,
101or to print no error messages at all.
102In the latter case, the nature of the error cannot be determined.
103To overcome this, the BSD interface includes a
104routine,
105.Xr kvm_geterr 3 ,
106to return (not print out) the error message
107corresponding to the most recent error condition on the
108given descriptor.
109