PLWP_GETREGS(3PROC) Process Control Library Functions PLWP_GETREGS(3PROC)
NAME
Plwp_getfpregs,
Plwp_setfpregs,
Plwp_getregs,
Plwp_setregs,
Lgetfpregs,
Lsetfpregs,
Lgetregs,
Lsetregs - get and set thread registers
LIBRARY
Process Control Library (libproc, -lproc)
SYNOPSIS
#include <libproc.h> int Plwp_getfpregs(
struct ps_prochandle *P,
lwpid_t lwpid,
prfpregset_t *fpregs);
int Plwp_setfpregs(
struct ps_prochandle *P,
lwpid_t lwpid,
const prfpregset_t fpregs);
int Plwp_getregs(
struct ps_prochandle *P,
lwpid_t lwpid,
prgregset_t gregs);
int Plwp_setregs(
struct ps_prochandle *P,
lwpid_t lwpid,
const prgregset_t gregs);
int Lgetfpregs(
struct ps_lwphandle *L,
prfpregset_t *fpregs);
int Lsetfpregs(
struct ps_lwphandle *L,
const prfpregset_t *fpregs);
int Lgetregs(
struct ps_lwphandle *L,
prgregset_t gregs);
int Lsetregs(
struct ps_lwphandle *L,
const prgregset_t gregs);
DESCRIPTION
The
Plwp_getregs(),
Plwp_setregs(),
Plwp_getfpregs(), and
Plwp_setfpregs() functions allow one to get and set the general purpose
and floating point registers from the thread
lwpid in the process
handle
P.
The
Plwp_getfpregs() function updates the structure pointed to by
fpregs with the state and values of the floating point registers of the
thread specified by
lwpid.
The
Plwp_setfpregs() function updates the floating point registers of
the thread specified by
lwpid to the register state contained in
fpregs.
The
Plwp_getregs() function updates the structure pointed to by
gregs with the state and values of the general purpose registers of the
thread specified by
lwpid. The
Plwp_setregs() function updates the general purpose registers of
the thread specified by
lwpid to the register state contained in
gregs.
Processes must be stopped before obtaining the register state of
individual threads. Processes may be stopped with
Pstop(3PROC). The
structures used for registers are described in
proc(5) and their
definitions may be found in <
procfs.h>. The definitions of these
structures varies based on the architecture of the system and the
running process.
One may not set the register values of a process that is not an active
process, e.g. a process handle that refers to a file or a core file.
The
Lgetfpregs(),
Lsetfpregs(),
Lgetregs(), and
Lsetregs() functions
behave in a same way as the corresponding process-handle specific
functions, with the following differences:
- Rather than take a specified thread id via
lwpid, they operate on
the thread that the thread-handle,
L, refers to.
- The process-handle functions will require that the entire process
is stopped before performing a set operation. In these cases, only
the specific thread identified by the handle
L must be stopped
through a call to
Lstop(3PROC) or similar. Note, a suspended
thread (
thr_suspend(3C)) is not considered stopped for these
purposes.
RETURN VALUES
Upon successful completion, the
Plwp_getregs(),
Plwp_setregs(),
Plwp_getfpregs(),
Plwp_setfpregs(),
Lgetfpregs(),
Lsetfpregs(),
Lgetregs(), and
Lsetregs() functions return
0 and obtain or set the
register state. Otherwise,
-1 is returned,
errno is set to indicate
the error, and the register state is not updated nor are the data
pointers changed.
ERRORS
The implementations of these functions may use standard system and
library calls that can fail. For a full list of possible errors also
see the
DIAGNOSTICS section in
proc(5).
The
Plwp_getregs(),
Plwp_setregs(),
Plwp_getfpregs(), and
Plwp_setfpregs() will fail if:
EBUSY The process handle
P is not currently stopped.
ENOENT There is no thread in
P with id
lwpid.
The
Lgetfpregs(),
Lsetfpregs(),
Lgetregs(), and
Lsetregs() will fail
if:
EBUSY The thread handle
L is not currently stopped.
INTERFACE STABILITY
UncommittedMT-LEVEL See
LOCKING in
libproc(3LIB).
SEE ALSO
libproc(3LIB),
proc(5)illumos January 19, 2023 illumos