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