Debian Codegraph @

upstream/debian-trixie/man2/prctl.2

raw
1 .\" Copyright 1998, Andries Brouwer <[email protected]>
2 .\" Copyright 2002, 2006, 2008, 2012, 2013, 2015, Michael Kerrisk <[email protected]>
3 .\" Copyright, Guillem Jover <[email protected]>
4 .\" Copyright 2010, Andi Kleen <[email protected]>
5 .\" Copyright 2012, Cyrill Gorcunov <[email protected]>
6 .\" Copyright 2014, Dave Hansen / Intel
7 .\" Copyright 2016, Eugene Syromyatnikov <[email protected]>
8 .\" Copyright 2018, Konrad Rzeszutek Wilk <[email protected]>
9 .\" Copyright 2020, Dave Martin <[email protected]>
10 .\" Copyright 2024, Alejandro Colomar <[email protected]>
11 .\"
12 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
13 .\"
14 .TH prctl 2 2024-06-01 "Linux man-pages 6.9.1"
15 .SH NAME
16 prctl
17 \-
18 operations on a process or thread
19 .SH LIBRARY
20 Standard C library
21 .RI ( libc ", " \-lc )
22 .SH SYNOPSIS
23 .nf
24 .BR "#include <linux/prctl.h>" " /* Definition of " PR_* " constants */"
25 .B #include <sys/prctl.h>
26 .P
27 .BI "int prctl(int " op ", ...);"
28 .fi
29 .SH DESCRIPTION
30 .BR prctl ()
31 manipulates various aspects of the behavior
32 of the calling thread or process.
33 .P
34 .BR prctl ()
35 is called with a first argument describing what to do,
36 and further arguments
37 with a significance depending on the first one.
38 The first argument can be:
39 .\"
40 .TP
41 .B PR_CAP_AMBIENT
42 .TQ
43 .B PR_CAPBSET_READ
44 .TQ
45 .B PR_CAPBSET_DROP
46 .TQ
47 .B PR_SET_CHILD_SUBREAPER
48 .TQ
49 .B PR_GET_CHILD_SUBREAPER
50 .TQ
51 .B PR_SET_DUMPABLE
52 .TQ
53 .B PR_GET_DUMPABLE
54 .TQ
55 .B PR_SET_ENDIAN
56 .TQ
57 .B PR_GET_ENDIAN
58 .TQ
59 .B PR_SET_FP_MODE
60 .TQ
61 .B PR_GET_FP_MODE
62 .TQ
63 .B PR_SET_FPEMU
64 .TQ
65 .B PR_GET_FPEMU
66 .TQ
67 .B PR_SET_FPEXC
68 .TQ
69 .B PR_GET_FPEXC
70 .TQ
71 .B PR_SET_IO_FLUSHER
72 .TQ
73 .B PR_GET_IO_FLUSHER
74 .TQ
75 .B PR_SET_KEEPCAPS
76 .TQ
77 .B PR_GET_KEEPCAPS
78 .TQ
79 .B PR_MCE_KILL
80 .TQ
81 .B PR_MCE_KILL_GET
82 .TQ
83 .B PR_SET_MM
84 .TQ
85 .B PR_SET_VMA
86 .TQ
87 .B PR_MPX_ENABLE_MANAGEMENT
88 .TQ
89 .B PR_MPX_DISABLE_MANAGEMENT
90 .TQ
91 .B PR_SET_NAME
92 .TQ
93 .B PR_GET_NAME
94 .TQ
95 .B PR_SET_NO_NEW_PRIVS
96 .TQ
97 .B PR_GET_NO_NEW_PRIVS
98 .TQ
99 .B PR_PAC_RESET_KEYS
100 .TQ
101 .B PR_SET_PDEATHSIG
102 .TQ
103 .B PR_GET_PDEATHSIG
104 .TQ
105 .B PR_SET_PTRACER
106 .TQ
107 .B PR_SET_SECCOMP
108 .TQ
109 .B PR_GET_SECCOMP
110 .TQ
111 .B PR_SET_SECUREBITS
112 .TQ
113 .B PR_GET_SECUREBITS
114 .TQ
115 .B PR_GET_SPECULATION_CTRL
116 .TQ
117 .B PR_SET_SPECULATION_CTRL
118 .TQ
119 .B PR_SVE_SET_VL
120 .TQ
121 .B PR_SVE_GET_VL
122 .TQ
123 .B PR_SET_SYSCALL_USER_DISPATCH
124 .TQ
125 .B PR_SET_TAGGED_ADDR_CTRL
126 .TQ
127 .B PR_GET_TAGGED_ADDR_CTRL
128 .TQ
129 .B PR_TASK_PERF_EVENTS_DISABLE
130 .TQ
131 .B PR_TASK_PERF_EVENTS_ENABLE
132 .TQ
133 .B PR_SET_THP_DISABLE
134 .TQ
135 .B PR_GET_THP_DISABLE
136 .TQ
137 .B PR_GET_TID_ADDRESS
138 .TQ
139 .B PR_SET_TIMERSLACK
140 .TQ
141 .B PR_GET_TIMERSLACK
142 .TQ
143 .B PR_SET_TIMING
144 .TQ
145 .B PR_GET_TIMING
146 .TQ
147 .B PR_SET_TSC
148 .TQ
149 .B PR_GET_TSC
150 .TQ
151 .B PR_SET_UNALIGN
152 .TQ
153 .B PR_GET_UNALIGN
154 .TQ
155 .B PR_GET_AUXV
156 .TQ
157 .B PR_SET_MDWE
158 .TQ
159 .B PR_GET_MDWE
160 .SH RETURN VALUE
161 On success,
162 a nonnegative value is returned.
163 On error, \-1 is returned, and
164 .I errno
165 is set to indicate the error.
166 .SH ERRORS
167 .TP
168 .B EINVAL
169 The value of
170 .I op
171 is not recognized,
172 or not supported on this system.
173 .TP
174 .B EINVAL
175 An unused argument is nonzero.
176 .SH VERSIONS
177 IRIX has a
178 .BR prctl ()
179 system call (also introduced in Linux 2.1.44
180 as irix_prctl on the MIPS architecture),
181 with prototype
182 .P
183 .in +4n
184 .EX
185 .BI "ptrdiff_t prctl(int " op ", int " arg2 ", int " arg3 );
186 .EE
187 .in
188 .P
189 and operations to get the maximum number of processes per user,
190 get the maximum number of processors the calling process can use,
191 find out whether a specified process is currently blocked,
192 get or set the maximum stack size, and so on.
193 .SH STANDARDS
194 Linux.
195 .SH HISTORY
196 Linux 2.1.57,
197 glibc 2.0.6
198 .SH CAVEATS
199 The prototype of the libc wrapper uses a variadic argument list.
200 This makes it necessary to pass the arguments with the right width.
201 When passing numeric constants, such as 0,
202 use a suffix:
203 .BR 0L .
204 .P
205 Careless use of some
206 .BR prctl ()
207 operations can confuse the user-space run-time environment,
208 so these operations should be used with care.
209 .SH SEE ALSO
210 .BR signal (2),
211 .BR PR_CAP_AMBIENT (2const),
212 .BR PR_CAPBSET_READ (2const),
213 .BR PR_CAPBSET_DROP (2const),
214 .BR PR_SET_CHILD_SUBREAPER (2const),
215 .BR PR_GET_CHILD_SUBREAPER (2const),
216 .BR PR_SET_DUMPABLE (2const),
217 .BR PR_GET_DUMPABLE (2const),
218 .BR PR_SET_ENDIAN (2const),
219 .BR PR_GET_ENDIAN (2const),
220 .BR PR_SET_FP_MODE (2const),
221 .BR PR_GET_FP_MODE (2const),
222 .BR PR_SET_FPEMU (2const),
223 .BR PR_GET_FPEMU (2const),
224 .BR PR_SET_FPEXC (2const),
225 .BR PR_GET_FPEXC (2const),
226 .BR PR_SET_IO_FLUSHER (2const),
227 .BR PR_GET_IO_FLUSHER (2const),
228 .BR PR_SET_KEEPCAPS (2const),
229 .BR PR_GET_KEEPCAPS (2const),
230 .BR PR_MCE_KILL (2const),
231 .BR PR_MCE_KILL_GET (2const),
232 .BR PR_SET_MM (2const),
233 .BR PR_SET_VMA (2const),
234 .BR PR_MPX_ENABLE_MANAGEMENT (2const),
235 .BR PR_MPX_DISABLE_MANAGEMENT (2const),
236 .BR PR_SET_NAME (2const),
237 .BR PR_GET_NAME (2const),
238 .BR PR_SET_NO_NEW_PRIVS (2const),
239 .BR PR_GET_NO_NEW_PRIVS (2const),
240 .BR PR_PAC_RESET_KEYS (2const),
241 .BR PR_SET_PDEATHSIG (2const),
242 .BR PR_GET_PDEATHSIG (2const),
243 .BR PR_SET_PTRACER (2const),
244 .BR PR_SET_SECCOMP (2const),
245 .BR PR_GET_SECCOMP (2const),
246 .BR PR_SET_SECUREBITS (2const),
247 .BR PR_GET_SECUREBITS (2const),
248 .BR PR_SET_SPECULATION_CTRL (2const),
249 .BR PR_GET_SPECULATION_CTRL (2const),
250 .BR PR_SVE_SET_VL (2const),
251 .BR PR_SVE_GET_VL (2const),
252 .BR PR_SET_SYSCALL_USER_DISPATCH (2const),
253 .BR PR_SET_TAGGED_ADDR_CTRL (2const),
254 .BR PR_GET_TAGGED_ADDR_CTRL (2const),
255 .BR PR_TASK_PERF_EVENTS_DISABLE (2const),
256 .BR PR_TASK_PERF_EVENTS_ENABLE (2const),
257 .BR PR_SET_THP_DISABLE (2const),
258 .BR PR_GET_THP_DISABLE (2const),
259 .BR PR_GET_TID_ADDRESS (2const),
260 .BR PR_SET_TIMERSLACK (2const),
261 .BR PR_GET_TIMERSLACK (2const),
262 .BR PR_SET_TIMING (2const),
263 .BR PR_GET_TIMING (2const),
264 .BR PR_SET_TSC (2const),
265 .BR PR_GET_TSC (2const),
266 .BR PR_SET_UNALIGN (2const),
267 .BR PR_GET_UNALIGN (2const),
268 .BR PR_GET_AUXV (2const),
269 .BR PR_SET_MDWE (2const),
270 .BR PR_GET_MDWE (2const),
271 .BR core (5)