Debian Codegraph @

upstream/debian-unstable/man2/prctl.2

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