PGRAB_CORE(3PROC) | Process Control Library Functions | PGRAB_CORE(3PROC) |
Pgrab_core
, Pfgrab_core
—
#include <libproc.h>
struct ps_prochandle *
Pgrab_core
(const char *core,
const char *aout, int gflag,
int *perr);
struct ps_prochandle *
Pfgrab_core
(int core_fd,
const char *aout, int
*perr);
Pgrab_core
() and
Pfgrab_core
() functions open a core file for
introspection. Unlike live processes, core files cannot have their state
modified; however, all of the functions that iterate or query state will work.
These functions work on all illumos core files and the core files of some
other operating systems. See both core(5)
and the Core Files section of
libproc(3LIB) for more information.
The Pgrab_core
() function attempts to open
the core file specified by core. The system attempts
to determine the path of the original executable. The argument
aout may either be the path to that file, a path to a
directory to search, or the NULL
pointer, if neither
is known. The system will search for it and will supplement information in
the core file with that.
The gflag argument to the
Pgrab_core
() function controls how the file is
opened. If the PGRAB_RDONLY
flag is specified, then
the core file will be opened with the
open(2) flag
O_RDONLY
. Otherwise, it will be opened
O_RDWR
.
The perr argument must be a
non-NULL
pointer which will store a more detailed
error in the event that the Pgrab_core
() function
fails. A human-readable form of the error can be obtained through the
routine
Pgrab_error(3PROC).
The Pfgrab_core
() is similar to the
Pgrab_core
() function. Except, instead of operating
on a path, it opens a handle to the core file referenced by
core_fd. The aout and
perr arguments are identical to those in the
Pgrab_core
() function.
The handle returned, from either function, is valid until it is closed with Prelease(3PROC) or Pfree(3PROC).
Pgrab_core
() and
Pfgrab_core
() functions return a
libproc handle to the core file. Otherwise,
NULL
is returned and perr is
filled in with a more detailed error message.
Pgrab_core
() function will fail if:
G_NOCORE
G_STRANGE
The Pgrab_core
() and
Pfgrab_core
() functions will fail if:
G_ELF
G_FORMAT
G_ISAINVAL
G_LP64
G_NOTE
G_STRANGE
May 11, 2016 | OmniOS |