PGETAREG(3PROC) | Process Control Library Functions | PGETAREG(3PROC) |
Pgetareg
,
Pputareg
, Lgetareg
,
Lputareg
— set and get a
register from a stopped process or thread
Process Control Library (libproc, -lproc)
#include
<libproc.h>
int
Pgetareg
(struct ps_prochandle
*P, int regno, prgreg_t
*preg);
int
Pputareg
(struct ps_prochandle
*P, int regno, prgreg_t
preg);
int
Lgetareg
(struct ps_lwphandle *L,
int regno, prgreg_t *preg);
int
Lputareg
(struct ps_lwphandle *L,
int regno, prgreg_t preg);
The
Pgetareg
()
and
Pputareg
()
functions read and update the registers of the process handle referred to by
P. The getting and setting of registers of the process
operates on the representative thread (LWP). For more information on how the
representative is chosen, see
proc(5).
To change the registers of a specific thread, use
the
Lgetareg
()
and
Lputareg
()
functions.
The getting and setting of registers only applies to stopped processes. In addition, one may obtain registers from core files, but not set them. To stop a process, see the Pstop(3PROC) function.
The register to get or set is indicated by the
regno argument. For a list of registers, see
<sys/regset.h>
. The set of
registers is specific to each architecture of the system. The
Pgetareg
()
function will fill in the value of preg with the value
of the register regno, while the
Pputareg
()
function will update the value of the register regno
with the value in preg. Updated registers will be set
when the process resumes execution.
The
Lgetareg
()
and
Lputareg
()
functions are equivalent to the Pgetareg
() and
Psetareg
()
functions, except rather than operating on the process and its
representative thread, they instead operate on the thread handle
L.
Upon successful completion, the Pgetareg
()
and Pputareg
() function return 0.
Otherwise, -1 is
returned,
errno is
set, and no registers will have been gotten or updated.
The Pgetareg
() and
Lgetareg
() functions will fail if:
EINVAL
EBUSY
ENODATA
The Pputareg
() and
Lputareg
() functions will fail if:
See LOCKING in libproc(3LIB).
errno(3C), libproc(3LIB), Lgrab(3PROC), Pgrab_file(3PROC), Pstop(3PROC), proc(5)
May 11, 2016 | OmniOS |