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