| PLWP_GETREGS(3PROC) | Process Control Library Functions | PLWP_GETREGS(3PROC) | 
Plwp_getfpregs,
    Plwp_setfpregs,
    Plwp_getregs, Plwp_setregs,
    Lgetfpregs, Lsetfpregs,
    Lgetregs, Lsetregs —
    get and set thread registers
Process Control Library (libproc, -lproc)
#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);
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:
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.
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:
Lgetfpregs(), Lsetfpregs(),
  Lgetregs(), and Lsetregs()
  will fail if:
EBUSYSee LOCKING in libproc(3LIB).
| January 19, 2023 | illumos |