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