.\" Copyright (c) 1992 The Regents of the University of California.
.\" This code is derived from software developed by the Computer Systems
.\" Engineering group at Lawrence Berkeley Laboratory under DARPA contract
.\" BG 91-66 and contributed to Berkeley.
.\" %sccs.include.redist.man%
.\" @(#)kvm_open.3 5.5 (Berkeley) %G%
.Nd initialize kernel virtual memory access
.Fn kvm_open "const char *execfile" "const char *corefile" "char *swapfile" "int flags" "const char *errstr"
.Fn kvm_openfiles "const char *execfile" "const char *corefile" "char *swapfile" "int flags" "char *errbuf"
.Fn kvm_close "kvm_t *kd"
return a descriptor used to access kernel virtual memory
library routines. Both active kernels and crash dumps are accessible
is the executable image of the kernel being examined.
This file must contain a symbol table.
the currently running system is assumed,
is the kernel memory device file. It can be either /dev/mem
or a crash dump core generated by
should indicate the swap device. If
argument indicates read/write access as in
and applies to only the core file.
There are two open routines which differ only with respect to
One provides backward compatibility with the SunOS kvm library, while the
other provides an improved error reporting framework.
function is the Sun kvm compatible open call. Here, the
argument indicates how errors should be handled. If it is
no errors are reported and the application cannot know the
specific nature of the failed kvm call.
errors are printed to stderr with
prepended to the message, as in
Normally, the name of the program is used here.
The string is assumed to persist at least until the corresponding
function provides BSD style error reporting.
Here, error messages are not printed out by the library.
Instead, the application obtains the error message
corresponding to the most recent kvm library call using
The results are undefined if the most recent kvm call did not produce
requires a kvm descriptor, but the open routines return
cannot be used to get the error message if open fails.
will place any error message in the
argument. This buffer should be _POSIX2_LINE_MAX characters large (from
functions both return a descriptor to be used
in all subsequent kvm library calls.
The library is fully re-entrant.
is returned, in which case
writes the error message into
function returns 0 on sucess and -1 on failure.
There should not be two open calls. The ill-defined error semantics
of the Sun library and the desire to have a backward-compatible library
for BSD left little choice.