1.\" 2.\" This file and its contents are supplied under the terms of the 3.\" Common Development and Distribution License ("CDDL"), version 1.0. 4.\" You may only use this file in accordance with the terms of version 5.\" 1.0 of the CDDL. 6.\" 7.\" A full copy of the text of the CDDL should have accompanied this 8.\" source. A copy of the CDDL is also available via the Internet at 9.\" http://www.illumos.org/license/CDDL. 10.\" 11.\" 12.\" Copyright 2015 Joyent, Inc. 13.\" 14.Dd May 11, 2016 15.Dt PLWP_GETREGS 3PROC 16.Os 17.Sh NAME 18.Nm Plwp_getfpregs , 19.Nm Plwp_setfpregs , 20.Nm Plwp_getregs , 21.Nm Plwp_setregs 22.Nd get and set thread registers 23.Sh SYNOPSIS 24.Lb libproc 25.In libproc.h 26.Ft int 27.Fo Plwp_getfpregs 28.Fa "struct ps_prochandle *P" 29.Fa "lwpid_t lwpid" 30.Fa "prfpregset_t *fpregs" 31.Fc 32.Ft int 33.Fo Plwp_setfpregs 34.Fa "struct ps_prochandle *P" 35.Fa "lwpid_t lwpid" 36.Fa "const prfpregset_t fpregs" 37.Fc 38.Ft int 39.Fo Plwp_getregs 40.Fa "struct ps_prochandle *P" 41.Fa "lwpid_t lwpid" 42.Fa "prpregset_t *gregs" 43.Fc 44.Ft int 45.Fo Plwp_setregs 46.Fa "struct ps_prochandle *P" 47.Fa "lwpid_t lwpid" 48.Fa "const prpregset_t gregs" 49.Fc 50.Sh DESCRIPTION 51The 52.Fn Plwp_getregs , 53.Fn Plwp_setregs , 54.Fn Plwp_getfpregs , 55and 56.Fn Plwp_setfpregs 57functions allow one to get and set the general purpose and floating 58point registers from the thread 59.Fa lwpid 60in the process handle 61.Fa P . 62.Pp 63The 64.Fn Plwp_getfpregs 65function updates the structure pointed to by 66.Fa fpregs 67with the state and values of the floating point registers of the thread 68specified by 69.Fa lwpid . 70.Pp 71The 72.Fn Plwp_setfpregs 73function updates the floating point registers of the thread specified by 74.Fa lwpid 75to the register state contained in 76.Fa fpregs . 77.Pp 78The 79.Fn Plwp_getregs 80function updates the structure pointed to by 81.Fa gregs 82with the state and values of the general purpose registers of the thread 83specified by 84.Fa lwpid. 85.Pp 86The 87.Fn Plwp_setregs 88function updates the general purpose registers of the thread specified 89by 90.Fa lwpid 91to the register state contained in 92.Fa gregs . 93.Pp 94Processes must be stopped before obtaining the register state of 95individual threads. 96Processes may be stopped with 97.Xr Pstop 3PROC . 98The structures used for registers are described in 99.Xr proc 4 100and their defintions may be found in 101.In sys/regset.h . 102The definitions of these structures varies based on the architecture of 103the system and the running process. 104.Pp 105One may not set the register values of a process that is not an active 106process, e.g. a process handle that refers to a file or a core file. 107.Sh RETURN VALUES 108Upon successful completion, the 109.Fn Plwp_getregs , 110.Fn Plwp_setregs , 111.Fn Plwp_getfpregs , 112and 113.Fn Plwp_setfpregs 114functions return 115.Sy 0 116and obtain or set the register state. 117Otherwise, 118.Sy -1 119is returned, 120.Sy errno 121is set to indicate the error, and the register state is not updated nor 122are the data pointers changed. 123.Sh ERRORS 124For a full list of possible errors also see the 125.Sy DIAGNOSTICS 126section in 127.Xr proc 4 . 128.Pp 129The 130.Fn Plwp_getregs , 131.Fn Plwp_setregs , 132.Fn Plwp_getfpregs , 133and 134.Fn Plwp_setfpregs 135will fail if: 136.Bl -tag -width Er 137.It Er EBUSY 138The process handle 139.Fa P 140is not currently stopped. 141.It Er ENOENT 142There is no thread in 143.Fa P 144with id 145.Fa lwpid . 146.El 147.Sh INTERFACE STABILITY 148.Sy Uncommitted 149.Sh MT-LEVEL 150See 151.Sy LOCKING 152in 153.Xr libproc 3LIB . 154.Sh SEE ALSO 155.Xr libproc 3LIB , 156.Xr proc 4 157