1 PLWP_GETREGS(3PROC) Process Control Library Functions PLWP_GETREGS(3PROC) 2 3 NAME 4 Plwp_getfpregs, Plwp_setfpregs, Plwp_getregs, Plwp_setregs - get and set 5 thread registers 6 7 LIBRARY 8 Process Control Library (libproc, -lproc) 9 10 SYNOPSIS 11 #include <libproc.h> 12 13 int 14 Plwp_getfpregs(struct ps_prochandle *P, lwpid_t lwpid, 15 prfpregset_t *fpregs); 16 17 int 18 Plwp_setfpregs(struct ps_prochandle *P, lwpid_t lwpid, 19 const prfpregset_t fpregs); 20 21 int 22 Plwp_getregs(struct ps_prochandle *P, lwpid_t lwpid, prpregset_t *gregs); 23 24 int 25 Plwp_setregs(struct ps_prochandle *P, lwpid_t lwpid, 26 const prpregset_t gregs); 27 28 DESCRIPTION 29 The Plwp_getregs(), Plwp_setregs(), Plwp_getfpregs(), and 30 Plwp_setfpregs() functions allow one to get and set the general purpose 31 and floating point registers from the thread lwpid in the process handle 32 P. 33 34 The Plwp_getfpregs() function updates the structure pointed to by fpregs 35 with the state and values of the floating point registers of the thread 36 specified by lwpid. 37 38 The Plwp_setfpregs() function updates the floating point registers of the 39 thread specified by lwpid to the register state contained in fpregs. 40 41 The Plwp_getregs() function updates the structure pointed to by gregs 42 with the state and values of the general purpose registers of the thread 43 specified by lwpid. 44 45 The Plwp_setregs() function updates the general purpose registers of the 46 thread specified by lwpid to the register state contained in gregs. 47 48 Processes must be stopped before obtaining the register state of 49 individual threads. Processes may be stopped with Pstop(3PROC). The 50 structures used for registers are described in proc(4) and their 51 defintions may be found in <sys/regset.h>. The definitions of these 52 structures varies based on the architecture of the system and the running 53 process. 54 55 One may not set the register values of a process that is not an active 56 process, e.g. a process handle that refers to a file or a core file. 57 58 RETURN VALUES 59 Upon successful completion, the Plwp_getregs(), Plwp_setregs(), 60 Plwp_getfpregs(), and Plwp_setfpregs() functions return 0 and obtain or 61 set the register state. Otherwise, -1 is returned, errno is set to 62 indicate the error, and the register state is not updated nor are the 63 data pointers changed. 64 65 ERRORS 66 For a full list of possible errors also see the DIAGNOSTICS section in 67 proc(4). 68 69 The Plwp_getregs(), Plwp_setregs(), Plwp_getfpregs(), and 70 Plwp_setfpregs() will fail if: 71 72 EBUSY The process handle P is not currently stopped. 73 74 ENOENT There is no thread in P with id lwpid. 75 76 INTERFACE STABILITY 77 Uncommitted 78 79 MT-LEVEL 80 See LOCKING in libproc(3LIB). 81 82 SEE ALSO 83 libproc(3LIB), proc(4) 84 85 illumos May 11, 2016 illumos