1 .\" Copyright (c) 1992, 1993
2 .\" The Regents of the University of California. All rights reserved.
4 .\" This code is derived from software developed by the Computer Systems
5 .\" Engineering group at Lawrence Berkeley Laboratory under DARPA contract
6 .\" BG 91-66 and contributed to Berkeley.
8 .\" Redistribution and use in source and binary forms, with or without
9 .\" modification, are permitted provided that the following conditions
11 .\" 1. Redistributions of source code must retain the above copyright
12 .\" notice, this list of conditions and the following disclaimer.
13 .\" 2. Redistributions in binary form must reproduce the above copyright
14 .\" notice, this list of conditions and the following disclaimer in the
15 .\" documentation and/or other materials provided with the distribution.
16 .\" 3. All advertising materials mentioning features or use of this software
17 .\" must display the following acknowledgement:
18 .\" This product includes software developed by the University of
19 .\" California, Berkeley and its contributors.
20 .\" 4. Neither the name of the University nor the names of its contributors
21 .\" may be used to endorse or promote products derived from this software
22 .\" without specific prior written permission.
24 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 .\" @(#)kvm_open.3 8.3 (Berkeley) 4/19/94
46 .Nd initialize kernel virtual memory access
53 .Fn kvm_open "const char *execfile" "const char *corefile" "const char *swapfile" "int flags" "const char *errstr"
55 .Fn kvm_openfiles "const char *execfile" "const char *corefile" "const char *swapfile" "int flags" "char *errbuf"
57 .Fn kvm_close "kvm_t *kd"
63 return a descriptor used to access kernel virtual memory
67 Both active kernels and crash dumps are accessible
68 through this interface.
72 argument is the executable image of the kernel being examined.
73 This file must contain a symbol table.
76 the currently running system is assumed,
82 argument is the kernel memory device file.
85 or a crash dump core generated by
91 the default indicated by
96 It can also be set to a special value
100 that do not directly access kernel memory.
104 argument is currently unused.
108 argument indicates read/write access as in
110 and applies only to the core file.
118 There are two open routines which differ only with respect to
120 One provides backward compatibility with the SunOS kvm library, while the
121 other provides an improved error reporting framework.
125 function is the Sun kvm compatible open call.
128 argument indicates how errors should be handled.
131 no errors are reported and the application cannot know the
132 specific nature of the failed kvm call.
135 errors are printed to
139 prepended to the message, as in
141 Normally, the name of the program is used here.
142 The string is assumed to persist at least until the corresponding
150 style error reporting.
151 Here, error messages are not printed out by the library.
152 Instead, the application obtains the error message
153 corresponding to the most recent kvm library call using
157 The results are undefined if the most recent kvm call did not produce
161 requires a kvm descriptor, but the open routines return
165 cannot be used to get the error message if open fails.
168 will place any error message in the
171 This buffer should be _POSIX2_LINE_MAX characters large (from
178 functions both return a descriptor to be used
179 in all subsequent kvm library calls.
180 The library is fully re-entrant.
183 is returned, in which case
185 writes the error message into
190 function returns 0 on success and -1 on failure.
204 There should not be two open calls.
205 The ill-defined error semantics
206 of the Sun library and the desire to have a backward-compatible library