NAME
cr_read — read from crash dump
SYNOPSIS
#include <libcrash.h>
int cr_read(CRASH *crash_cb, void *buf,
uint64_t mem_page, int *num_pages);
DESCRIPTION
The
cr_read()
function attempts to read the memory area defined by
mem_page
and
num_pages
into the buffer pointed to by
buf
from the crash dump opened using
crash_cb.
The
cr_read()
starts at the position in the crash dump associated with the
physical memory offset given by
mem_page.
If the physical memory page
mem_page
does not exist in the crash dump,
cr_read()
sets
*num_pages
to 0 and returns 0.
No data transfer will occur past a page of memory that does not exist
in the crash dump.
If the starting position,
mem_page,
plus the read length,
*num_pages,
goes past an area of memory that does not exist in the crash dump,
cr_read()
sets
*num_pages
to the number of consecutive pages (starting at
mem_page)
actually read.
RETURN VALUE
Returns zero for success. Other possible return values are described in
libcrash(5).
EXAMPLES
Assuming a process opened a crash dump, the following call to
cr_read(3)
reads the first
CRSIZE
pages from the crash dump into the buffer pointed to by
mybuf:
#include <libcrash.h>
CRASH in_cb;
char mybuf[CRSIZE*NBPG];
int rstat;
int size = CRSIZE;
rstat = cr_read (in_cb, mybuf, 0, &size);
WARNINGS
cr_read()
may return fewer pages than requested due to implementation details.
Always check the number of pages returned. If they are fewer than
requested, issue a new request starting at the first page not returned.
Only if that new request reads zero pages (or returns an error) can you
be sure that the page was not dumped.
AUTHOR
cr_read()
was developed by HP.