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