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