xref: /openbsd-src/lib/libkvm/kvm.3 (revision 602083f5e605697798ec8969e2e913f67ca1ab20)
1*602083f5Skn.\"	$OpenBSD: kvm.3,v 1.10 2020/06/25 12:20:17 kn Exp $
215f0ebb0Sderaadt.\"	$NetBSD: kvm.3,v 1.2 1996/03/18 22:33:11 thorpej Exp $
315f0ebb0Sderaadt.\"
4df930be7Sderaadt.\" Copyright (c) 1992, 1993
5df930be7Sderaadt.\"	The Regents of the University of California.  All rights reserved.
6df930be7Sderaadt.\"
7df930be7Sderaadt.\" This code is derived from software developed by the Computer Systems
8df930be7Sderaadt.\" Engineering group at Lawrence Berkeley Laboratory under DARPA contract
9df930be7Sderaadt.\" BG 91-66 and contributed to Berkeley.
10df930be7Sderaadt.\"
11df930be7Sderaadt.\" Redistribution and use in source and binary forms, with or without
12df930be7Sderaadt.\" modification, are permitted provided that the following conditions
13df930be7Sderaadt.\" are met:
14df930be7Sderaadt.\" 1. Redistributions of source code must retain the above copyright
15df930be7Sderaadt.\"    notice, this list of conditions and the following disclaimer.
16df930be7Sderaadt.\" 2. Redistributions in binary form must reproduce the above copyright
17df930be7Sderaadt.\"    notice, this list of conditions and the following disclaimer in the
18df930be7Sderaadt.\"    documentation and/or other materials provided with the distribution.
196580fee3Smillert.\" 3. Neither the name of the University nor the names of its contributors
20df930be7Sderaadt.\"    may be used to endorse or promote products derived from this software
21df930be7Sderaadt.\"    without specific prior written permission.
22df930be7Sderaadt.\"
23df930be7Sderaadt.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24df930be7Sderaadt.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25df930be7Sderaadt.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26df930be7Sderaadt.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27df930be7Sderaadt.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28df930be7Sderaadt.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29df930be7Sderaadt.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30df930be7Sderaadt.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31df930be7Sderaadt.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32df930be7Sderaadt.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33df930be7Sderaadt.\" SUCH DAMAGE.
34df930be7Sderaadt.\"
35df930be7Sderaadt.\"     @(#)kvm.3	8.1 (Berkeley) 6/4/93
36df930be7Sderaadt.\"
37*602083f5Skn.Dd $Mdocdate: June 25 2020 $
38df930be7Sderaadt.Dt KVM 3
39df930be7Sderaadt.Os
40df930be7Sderaadt.Sh NAME
41df930be7Sderaadt.Nm kvm
42df930be7Sderaadt.Nd kernel memory interface
43df930be7Sderaadt.Sh DESCRIPTION
44df930be7SderaadtThe
45cdafad35Sjmc.Nm kvm
46df930be7Sderaadtlibrary provides a uniform interface for accessing kernel virtual memory
47df930be7Sderaadtimages, including live systems and crash dumps.
48df930be7SderaadtAccess to live systems is via
492bb07095Saaron.Pa /dev/mem
50df930be7Sderaadtwhile crash dumps can be examined via the core file generated by
51df930be7Sderaadt.Xr savecore 8 .
52df930be7SderaadtThe interface behaves identically in both cases.
53df930be7SderaadtMemory can be read and written, kernel symbol addresses can be
54df930be7Sderaadtlooked up efficiently, and information about user processes can
55df930be7Sderaadtbe gathered.
56df930be7Sderaadt.Pp
57df930be7Sderaadt.Fn kvm_open
58df930be7Sderaadtis first called to obtain a descriptor for all subsequent calls.
59cdafad35Sjmc.Sh FILES
60cdafad35Sjmc.Bl -tag -width /dev/mem -compact
61cdafad35Sjmc.It Pa /dev/mem
62cdafad35Sjmcinterface to physical memory
63cdafad35Sjmc.El
64cdafad35Sjmc.Sh SEE ALSO
65*602083f5Skn.Xr kvm_dump 3 ,
66cdafad35Sjmc.Xr kvm_geterr 3 ,
67*602083f5Skn.Xr kvm_getfiles 3 ,
68cdafad35Sjmc.Xr kvm_getloadavg 3 ,
69cdafad35Sjmc.Xr kvm_getprocs 3 ,
70cdafad35Sjmc.Xr kvm_nlist 3 ,
71cdafad35Sjmc.Xr kvm_open 3 ,
72376bc393Sjmc.Xr kvm_read 3
73cdafad35Sjmc.Sh STANDARDS
742bb07095SaaronThe kvm interface was first introduced in SunOS.
752bb07095SaaronA considerable
76df930be7Sderaadtnumber of programs have been developed that use this interface,
77df930be7Sderaadtmaking backward compatibility highly desirable.
78df930be7SderaadtIn most respects, the Sun kvm interface is consistent and clean.
79df930be7SderaadtAccordingly, the generic portion of the interface (i.e.,
80df930be7Sderaadt.Fn kvm_open ,
81df930be7Sderaadt.Fn kvm_close ,
82df930be7Sderaadt.Fn kvm_read ,
83df930be7Sderaadt.Fn kvm_write ,
84df930be7Sderaadtand
85df930be7Sderaadt.Fn kvm_nlist )
86720a7a94Sjmchas been incorporated into the
87720a7a94Sjmc.Bx
88720a7a94Sjmcinterface.
892bb07095SaaronIndeed, many kvm
90df930be7Sderaadtapplications (i.e., debuggers and statistical monitors) use only
91df930be7Sderaadtthis subset of the interface.
92df930be7Sderaadt.Pp
932bb07095SaaronThe process interface was not kept.
942bb07095SaaronThis is not a portability
95df930be7Sderaadtissue since any code that manipulates processes is inherently
96df930be7Sderaadtmachine dependent.
97df930be7Sderaadt.Pp
98df930be7SderaadtFinally, the Sun kvm error reporting semantics are poorly defined.
99df930be7SderaadtThe library can be configured either to print errors to stderr automatically,
100df930be7Sderaadtor to print no error messages at all.
101df930be7SderaadtIn the latter case, the nature of the error cannot be determined.
102720a7a94SjmcTo overcome this, the
103720a7a94Sjmc.Bx
104720a7a94Sjmcinterface includes a
105df930be7Sderaadtroutine,
106df930be7Sderaadt.Xr kvm_geterr 3 ,
107df930be7Sderaadtto return (not print out) the error message
108df930be7Sderaadtcorresponding to the most recent error condition on the
109df930be7Sderaadtgiven descriptor.
110