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. Processes may be stopped with 96.Xr Pstop 3PROC . 97The structures used for registers are described in 98.Xr proc 4 99and their defintions may be found in 100.In sys/regset.h . 101The definitions of these structures varies based on the architecture of 102the system and the running process. 103.Pp 104One may not set the register values of a process that is not an active 105process, e.g. a process handle that refers to a file or a core file. 106.Sh RETURN VALUES 107Upon successful completion, the 108.Fn Plwp_getregs , 109.Fn Plwp_setregs , 110.Fn Plwp_getfpregs , 111and 112.Fn Plwp_setfpregs 113functions return 114.Sy 0 115and obtain or set the register state. Otherwise, 116.Sy -1 117is returned, 118.Sy errno 119is set to indicate the error, and the register state is not updated nor 120are the data pointers changed. 121.Sh ERRORS 122For a full list of possible errors also see the 123.Sy DIAGNOSTICS 124section in 125.Xr proc 4 . 126.Pp 127The 128.Fn Plwp_getregs , 129.Fn Plwp_setregs , 130.Fn Plwp_getfpregs , 131and 132.Fn Plwp_setfpregs 133will fail if: 134.Bl -tag -width Er 135.It Er EBUSY 136The process handle 137.Fa P 138is not currently stopped. 139.It Er ENOENT 140There is no thread in 141.Fa P 142with id 143.Fa lwpid . 144.El 145.Sh INTERFACE STABILITY 146.Sy Uncommitted 147.Sh MT-LEVEL 148See 149.Sy LOCKING 150in 151.Xr libproc 3LIB . 152.Sh SEE ALSO 153.Xr libproc 3LIB , 154.Xr proc 4 155