up | Inhaltsverzeichniss | Kommentar

Manual page for KVM_OPEN(3K)

kvm_open, kvm_close - specify a kernel to examine

SYNOPSIS

#include <kvm.h>
#include <fcntl.h>

kvm_t *kvm_open(namelist, corefile, swapfile, flag, errstr)
char *namelist, *corefile, *swapfile;
int flag;
char *errstr;

int kvm_close(kd)
kvm_t *kd;

DESCRIPTION

kvm_open() initializes a set of file descriptors to be used in subsequent calls to kernel VM routines. It returns a pointer to a kernel identifier that must be used as the kd argument in subsequent kernel VM function calls.

The namelist argument specifies an unstripped executable file whose symbol table will be used to locate various offsets in corefile. If namelist is NULL, the symbol table of the currently running kernel is used to determine offsets in the core image. In this case, it is up to the implementation to select an appropriate way to resolve symbolic references (for instance, using /vmunix as a default namelist file).

corefile specifies a file that contains an image of physical memory, for instance, a kernel crash dump file (see savecore.8 or the special device /dev/mem. If corefile is NULL, the currently running kernel is accessed (using /dev/mem and /dev/kmem).

swapfile specifies a file that represents the swap device. If both corefile and swapfile are NULL, the swap device of the ``currently running kernel'' is accessed. Otherwise, if swapfile is NULL, kvm_open() may succeed but subsequent kvm_getu.3k function calls may fail if the desired information is swapped out.

flag is used to specify read or write access for corefile and may have one of the following values:

O_RDONLY
open for reading
O_RDWR
open for reading and writing

errstr is used to control error reporting. If it is a NULL pointer, no error messages will be printed. If it is non-NULL, it is assumed to be the address of a string that will be used to prefix error messages generated by kvm_open. Errors are printed to stderr. A useful value to supply for errstr would be argv[0]. This has the effect of printing the process name in front of any error messages.

kvm_close() closes all file descriptors that were associated with kd. These files are also closed on exit.2v and execve.2v kvm_close() also resets the proc pointer associated with kvm_nextproc.3k and flushes any cached kernel data.

RETURN VALUES

kmv_open() returns a non-NULL value suitable for use with subsequent kernel VM function calls. On failure, it returns NULL and no files are opened.

kvm_close() returns:

0
on success.
-1
on failure.

FILES

/vmunix
/dev/kmem
/dev/mem
/dev/drum

SEE ALSO

execve.2v exit.2v kvm_getu.3k kvm_nextproc.3k kvm_nlist.3k kvm_read.3k savecore.8


index | Inhaltsverzeichniss | Kommentar

Created by unroff & hp-tools. © somebody (See intro for details). All Rights Reserved. Last modified 11/5/97