KVM_READ(3K)

NAME
kvm_read, kvm_write - copy data to or from a kernel image or running system

SYNOPSIS

#include <kvm.h>

int kvm_read(kd, addr, buf, nbytes)
kvm_t *kd;
unsigned long addr;
char *buf;
unsigned nbytes;

int kvm_write(kd, addr, buf, nbytes)
kvm_t *kd;
unsigned long addr;
char *buf;
unsigned nbytes;

DESCRIPTION

kvm_read() transfers data from the kernel image specified by kd (see kvm_open(3K)) to the address space of the process. nbytes bytes of data are copied from the kernel virtual address given by addr to the buffer pointed to by buf.

kvm_write() is like kvm_read(), except that the direction of data transfer is reversed. In order to use this function, the kvm_open(3K) call that returned kd must have specified write access. If a user virtual address is given, it is resolved in the address space of the process specified in the most recent kvm_getu(3K) call.

RETURN VALUES

On success, kvm_read() and kvm_write() return the number of bytes actually transferred. On failure, they return -1.

SEE ALSO
kvm_getu(3K), kvm_nlist(3K), kvm_open(3K)