NAME
vm_read - allows one task to read another’s memory

SYNOPSIS
#include <mach.h>

kern_return_t vm_read(target_task, address, size, data, data_count)
vm_task_t target_task
vm_address_t address;
vm_size_t size;
pointer_t *data; /* out */
int *data_count; /* out */

ARGUMENTS
target_task Task whose memory is to be read.

address The first address to be read (must be on a page
boundary).

size The number of bytes of data to be read (must be an
integral number of pages).

data The array of data copied from the given task.

data_count The size of the data array in bytes (will be an
integral number of pages).

DESCRIPTION
vm_read allows one task’s virtual memory to be read by another
task. Note that the data array is returned in a newly allocated
region; the task reading the data should vm_deallocate this region
when it is done with the data.

DIAGNOSTICS
KERN_SUCCESS Memory read.

KERN_INVALID_ARGUMENT Either the address does not start on
a page boundary or the size is not an
integral number of pages.

KERN_NO_SPACE There is not enough room in the
callers virtual memory to allocate
space for the data to be returned.

KERN_PROTECTION_FAILURE The address region in the target task
is protected against reading.

KERN_INVALID_ADDRESS Illegal or non-allocated address
specified, or there was not size
bytes of data following that address.

SEE ALSO
vm_read(2), vm_write(2), vm_copy(2), vm_deallocate(2)