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 PR_GETSOCKOPT 3PROC 16.Os 17.Sh NAME 18.Nm pr_getsockopt 19.Nd inject getsockopt library call call into victim process 20.Sh SYNOPSIS 21.Lb libproc 22.In libproc.h 23.Ft int 24.Fo pr_getsockopt 25.Fa "struct ps_prochandle *P" 26.Fa "int sock" 27.Fa "int level" 28.Fa "int optname" 29.Fa "void *optval" 30.Fa "int *optlen" 31.Fc 32.Sh DESCRIPTION 33The 34.Fn pr_getsockopt 35function injects the 36.Xr getsockopt 3SOCKET 37library call call into the target process 38.Fa P 39by means of the agent lwp. 40If the process handle 41.Fa P 42is the value 43.Dv NULL 44then this will be equivalent to calling 45.Xr getsockopt 3SOCKET 46on the currently running process. 47.Pp 48The arguments 49.Fa sock , 50.Fa level , 51.Fa optname , 52.Fa optval , 53and 54.Fa optlen 55have the same meaning as in 56.Xr getsockopt 3SOCKET , 57see 58.Xr getsockopt 3SOCKET 59for the full description and purpose of the 60.Sy getsockopt 61system call and its arguments. 62.Pp 63The 64.Fn pr_getsockopt 65function only works on active processes. Process handles that correspond 66to core files, zombie processes, or ELF objects do not support system 67call injection. 68.Sh RETURN VALUES 69Upon successful completion, the 70.Fn pr_getsockopt 71function's return value is that described in 72.Xr getsockopt 3SOCKET . 73Otherwise, 74.Sy -1 75is returned and 76.Sy errno 77is set to 78.Er ENOSYS 79to indicate that the system call could not be injected. 80.Sh ERRORS 81For the full list of errors see the 82.Sy ERRORS 83section in 84.Xr getsockopt 3SOCKET . 85.Pp 86The 87.Fn pr_getsockopt 88function will fail if: 89.Bl -tag -width Er 90.It Er ENOSYS 91An error occurred while trying to invoke the agent lwp and inject a 92system call in the process handle 93.Fa P 94or the process handle 95.Fa P 96does not support system call injection. 97.El 98.Sh INTERFACE STABILITY 99.Sy Uncommitted 100.Sh MT-LEVEL 101See 102.Sy LOCKING 103in 104.Xr libproc 3LIB . 105.Sh SEE ALSO 106.Xr libproc 3LIB , 107.Xr getsockopt 3SOCKET , 108.Xr proc 4 109