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