xref: /illumos-gate/usr/src/man/man3proc/pr_settaskid.3proc (revision 1a2d662a91cee3bf82f41cd47c7ae6f3825d9db2)
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_SETTASKID 3PROC
16.Os
17.Sh NAME
18.Nm pr_settaskid
19.Nd inject settaskid system call into victim process
20.Sh LIBRARY
21.Lb libproc
22.Sh SYNOPSIS
23.In libproc.h
24.Ft taskid_t
25.Fo pr_settaskid
26.Fa "struct ps_prochandle *P"
27.Fa "projid_t project"
28.Fa "int flags"
29.Fc
30.Sh DESCRIPTION
31The
32.Fn pr_settaskid
33function injects the
34.Xr settaskid 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 settaskid 2
44on the currently running process.
45.Pp
46The arguments
47.Fa project
48and
49.Fa flags
50have the same meaning as in
51.Xr settaskid 2 .
52See
53.Xr settaskid 2
54for the full description and purpose of the
55.Sy settaskid
56system call and its arguments.
57.Pp
58The
59.Fn pr_settaskid
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_settaskid
66function's return value is that described in
67.Xr settaskid 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 settaskid 2 .
80.Pp
81The
82.Fn pr_settaskid
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 settaskid 2 ,
102.Xr libproc 3LIB ,
103.Xr proc 5
104