]>
Commit | Line | Data |
---|---|---|
fea681da MK |
1 | .\" Hey Emacs! This file is -*- nroff -*- source. |
2 | .\" | |
3 | .\" Copyright (C) 1998 Andries Brouwer (aeb@cwi.nl) | |
c11b1abf | 4 | .\" and Copyright (C) 2002 Michael Kerrisk <mtk.manpages@gmail.com> |
af5f9508 | 5 | .\" and Copyright Guillem Jover <guillem@hadrons.org> |
fea681da MK |
6 | .\" |
7 | .\" Permission is granted to make and distribute verbatim copies of this | |
8 | .\" manual provided the copyright notice and this permission notice are | |
9 | .\" preserved on all copies. | |
10 | .\" | |
11 | .\" Permission is granted to copy and distribute modified versions of this | |
12 | .\" manual under the conditions for verbatim copying, provided that the | |
13 | .\" entire resulting derived work is distributed under the terms of a | |
14 | .\" permission notice identical to this one. | |
c13182ef | 15 | .\" |
fea681da MK |
16 | .\" Since the Linux kernel and libraries are constantly changing, this |
17 | .\" manual page may be incorrect or out-of-date. The author(s) assume no | |
18 | .\" responsibility for errors or omissions, or for damages resulting from | |
19 | .\" the use of the information contained herein. The author(s) may not | |
20 | .\" have taken the same level of care in the production of this manual, | |
21 | .\" which is licensed free of charge, as they might when working | |
22 | .\" professionally. | |
c13182ef | 23 | .\" |
fea681da MK |
24 | .\" Formatted or processed versions of this manual, if unaccompanied by |
25 | .\" the source, must acknowledge the copyright and authors of this work. | |
26 | .\" | |
27 | .\" Modified Thu Nov 11 04:19:42 MET 1999, aeb: added PR_GET_PDEATHSIG | |
28 | .\" Modified 27 Jun 02, Michael Kerrisk | |
c13182ef | 29 | .\" Added PR_SET_DUMPABLE, PR_GET_DUMPABLE, |
fea681da | 30 | .\" PR_SET_KEEPCAPS, PR_GET_KEEPCAPS |
e87fdd92 MK |
31 | .\" Modified 2006-08-30 Guillem Jover <guillem@hadrons.org> |
32 | .\" Updated Linux versions where the options where introduced. | |
33 | .\" Added PR_SET_TIMING, PR_GET_TIMING, PR_SET_NAME, PR_GET_NAME, | |
34 | .\" PR_SET_UNALIGN, PR_GET_UNALIGN, PR_SET_FPEMU, PR_GET_FPEMU, | |
35 | .\" PR_SET_FPEXC, PR_GET_FPEXC | |
2be22198 | 36 | .\" FIXME 2.6.26-rc3 has PR_GET_TSC and PR_SET_TSC |
fea681da | 37 | .\" |
a6294408 | 38 | .TH PRCTL 2 2007-07-27 "Linux" "Linux Programmer's Manual" |
fea681da MK |
39 | .SH NAME |
40 | prctl \- operations on a process | |
41 | .SH SYNOPSIS | |
521bf584 | 42 | .nf |
fea681da MK |
43 | .B #include <sys/prctl.h> |
44 | .sp | |
521bf584 MK |
45 | .BI "int prctl(int " option ", unsigned long " arg2 ", unsigned long " arg3 , |
46 | .BI " unsigned long " arg4 ", unsigned long " arg5 ); | |
47 | .fi | |
fea681da | 48 | .SH DESCRIPTION |
e511ffb6 | 49 | .BR prctl () |
fea681da | 50 | is called with a first argument describing what to do |
1a329b56 | 51 | (with values defined in \fI<linux/prctl.h>\fP), and further |
fea681da MK |
52 | parameters with a significance depending on the first one. |
53 | The first argument can be: | |
54 | .TP | |
55 | .B PR_SET_PDEATHSIG | |
56 | (since Linux 2.1.57) | |
57 | Set the parent process death signal | |
64536a1b | 58 | of the calling process to \fIarg2\fP (either a signal value |
fea681da | 59 | in the range 1..maxsig, or 0 to clear). |
64536a1b | 60 | This is the signal that the calling process will get when its |
c13182ef MK |
61 | parent dies. |
62 | This value is cleared upon a | |
0bfa087b | 63 | .BR fork (2). |
fea681da MK |
64 | .TP |
65 | .B PR_GET_PDEATHSIG | |
e87fdd92 | 66 | (Since Linux 2.3.15) |
fea681da MK |
67 | Read the current value of the parent process death signal |
68 | into the (int *) \fIarg2\fP. | |
69 | .TP | |
70 | .B PR_SET_DUMPABLE | |
e87fdd92 | 71 | (Since Linux 2.3.20) |
fea681da | 72 | Set the state of the flag determining whether core dumps are produced |
d9bfdb9c | 73 | for this process upon delivery of a signal whose default behavior is |
fea681da MK |
74 | to produce a core dump. |
75 | (Normally this flag is set for a process by default, but it is cleared | |
c13182ef | 76 | when a set-user-ID or set-group-ID program is executed and also by |
880f5b4b | 77 | various system calls that manipulate process UIDs and GIDs). |
c0dc0445 | 78 | In kernels up to and including 2.6.12, |
fea681da MK |
79 | .I arg2 |
80 | must be either 0 (process is not dumpable) or 1 (process is dumpable). | |
a4775da6 | 81 | Between kernels 2.6.13 and 2.6.17, the value 2 was also permitted, |
c13182ef MK |
82 | which caused any binary which normally would not be dumped |
83 | to be dumped readable by root only; | |
a3b7f00b MK |
84 | for security reasons, this feature has been removed. |
85 | .\" See http://marc.theaimsgroup.com/?l=linux-kernel&m=115270289030630&w=2 | |
86 | .\" Subject: Fix prctl privilege escalation (CVE-2006-2451) | |
87 | .\" From: Marcel Holtmann <marcel () holtmann ! org> | |
88 | .\" Date: 2006-07-12 11:12:00 | |
c13182ef | 89 | (See also the description of |
c0dc0445 MK |
90 | .I /proc/sys/fs/suid_dumpable |
91 | in | |
92 | .BR proc (5).) | |
fea681da MK |
93 | .TP |
94 | .B PR_GET_DUMPABLE | |
e87fdd92 | 95 | (Since Linux 2.3.20) |
fea681da MK |
96 | Return (as the function result) the current state of the calling |
97 | process's dumpable flag. | |
c13182ef | 98 | .\" Since Linux 2.6.13, the dumpable flag can have the value 2, |
b0c93735 | 99 | .\" but in 2.6.13 PR_GET_DUMPABLE simply returns 1 if the dumpable |
eba72288 | 100 | .\" flags has a non-zero value. This was fixed in 2.6.14. |
fea681da MK |
101 | .TP |
102 | .B PR_SET_KEEPCAPS | |
e87fdd92 | 103 | (Since Linux 2.2.18) |
fea681da MK |
104 | Set the state of the process's "keep capabilities" flag, |
105 | which determines whether the process's effective and permitted | |
106 | capability sets are cleared when a change is made to the process's user IDs | |
d9df8ff8 | 107 | such that the process's real UID, effective UID, and saved set-user-ID |
eba72288 | 108 | all become non-zero when at least one of them previously had the value 0. |
fea681da MK |
109 | (By default, these credential sets are cleared). |
110 | .I arg2 | |
111 | must be either 0 (capabilities are cleared) or 1 (capabilities are kept). | |
112 | .TP | |
113 | .B PR_GET_KEEPCAPS | |
e87fdd92 | 114 | (Since Linux 2.2.18) |
fea681da MK |
115 | Return (as the function result) the current state of the calling process's |
116 | "keep capabilities" flag. | |
e87fdd92 MK |
117 | .TP |
118 | .B PR_SET_TIMING | |
119 | (Since Linux 2.6.0-test4) | |
120 | Set whether to use (normal, traditional) statistical process timing or | |
121 | accurate timestamp based process timing, by passing \fBPR_TIMING_STATISTICAL\fP | |
122 | or \fBPR_TIMING_TIMESTAMP\fP to \fIarg2\fP. | |
123 | .TP | |
124 | .B PR_GET_TIMING | |
125 | (Since Linux 2.6.0-test4) | |
126 | Return (as the function result) which process timing method is currently | |
127 | in use. | |
128 | .TP | |
129 | .B PR_SET_NAME | |
130 | (Since Linux 2.6.9) | |
64536a1b | 131 | Set the process name for the calling process to \fIarg2\fP. |
e87fdd92 MK |
132 | .TP |
133 | .B PR_GET_NAME | |
134 | (Since Linux 2.6.11) | |
64536a1b MK |
135 | Get the process name for the calling process from \fIarg2\fP. |
136 | .TP | |
137 | .B PR_GET_ENDIAN | |
138 | (Since Linux 2.6.18, PowerPC only) | |
139 | Return the endian-ness of the calling process. | |
140 | .TP | |
141 | .B PR_SET_ENDIAN | |
142 | (Since Linux 2.6.18, PowerPC only) | |
c13182ef | 143 | Set the endian-ness of the calling process to the value given |
64536a1b MK |
144 | in \fIarg2\fP, which should be one of the following: |
145 | .BR PR_ENDIAN_BIG , | |
146 | .BR PR_ENDIAN_LITTLE , | |
147 | or | |
0daa9e92 | 148 | .B PR_ENDIAN_PPC_LITTLE |
64536a1b | 149 | (PowerPC pseudo little endian). |
e87fdd92 MK |
150 | .TP |
151 | .B PR_SET_UNALIGN | |
20f75f5f | 152 | (Only on: ia64, since Linux 2.3.48; parisc, since Linux 2.6.15; |
eaf7a691 | 153 | PowerPC, since Linux 2.6.18; Alpha, since Linux 2.6.22) |
1c44bd5b MK |
154 | Set unaligned access control bits to \fIarg2\fP. |
155 | Pass | |
156 | \fBPR_UNALIGN_NOPRINT\fP to silently fix up unaligned user accesses, | |
8bd58774 MK |
157 | or \fBPR_UNALIGN_SIGBUS\fP to generate |
158 | .B SIGBUS | |
159 | on unaligned user access. | |
e87fdd92 MK |
160 | .TP |
161 | .B PR_GET_UNALIGN | |
bf1c0ede | 162 | (see |
20f75f5f MK |
163 | .B PR_SET_UNALIGN |
164 | for information on versions and architectures) | |
e87fdd92 MK |
165 | Get unaligned access control bits from \fIarg2\fP. |
166 | .TP | |
167 | .B PR_SET_FPEMU | |
168 | (Since Linux 2.4.18, 2.5.9, only on ia64) | |
169 | Set floating-point emulation control bits to \fIarg2\fP. | |
170 | Pass \fBPR_FPEMU_NOPRINT\fP to silently emulate fp operations accesses, or | |
8bd58774 MK |
171 | \fBPR_FPEMU_SIGFPE\fP to not emulate fp operations and send |
172 | .B SIGFPE | |
173 | instead. | |
e87fdd92 MK |
174 | .TP |
175 | .B PR_GET_FPEMU | |
176 | (Since Linux 2.4.18, 2.5.9, only on ia64) | |
177 | Get floating-point emulation control bits from \fIarg2\fP. | |
178 | .TP | |
179 | .B PR_SET_FPEXC | |
64536a1b | 180 | (Since Linux 2.4.21, 2.5.32, only on PowerPC) |
1c44bd5b MK |
181 | Set floating-point exception mode to \fIarg2\fP. |
182 | Pass \fBPR_FP_EXC_SW_ENABLE\fP to use FPEXC for FP exception enables, | |
e87fdd92 MK |
183 | \fBPR_FP_EXC_DIV\fP for floating point divide by zero, |
184 | \fBPR_FP_EXC_OVF\fP for floating point overflow, | |
185 | \fBPR_FP_EXC_UND\fP for floating point underflow, | |
186 | \fBPR_FP_EXC_RES\fP for floating point inexact result, | |
187 | \fBPR_FP_EXC_INV\fP for floating point invalid operation, | |
188 | \fBPR_FP_EXC_DISABLED\fP for FP exceptions disabled, | |
189 | \fBPR_FP_EXC_NONRECOV\fP for async non-recoverable exception mode, | |
190 | \fBPR_FP_EXC_ASYNC\fP for async recoverable exception mode, | |
191 | \fBPR_FP_EXC_PRECISE\fP for precise exception mode. | |
192 | .TP | |
193 | .B PR_GET_FPEXC | |
64536a1b | 194 | (Since Linux 2.4.21, 2.5.32, only on PowerPC) |
e87fdd92 | 195 | Get floating-point exception mode from \fIarg2\fP. |
fea681da MK |
196 | .SH "RETURN VALUE" |
197 | .B PR_GET_DUMPABLE | |
198 | and | |
199 | .B PR_GET_KEEPCAPS | |
200 | return 0 or 1 on success. | |
201 | All other | |
202 | .I option | |
203 | values return 0 on success. | |
204 | On error, \-1 is returned, and | |
205 | .I errno | |
206 | is set appropriately. | |
207 | .SH ERRORS | |
208 | .TP | |
209 | .B EINVAL | |
210 | The value of | |
211 | .I option | |
212 | is not recognized, or it is | |
213 | .B PR_SET_PDEATHSIG | |
214 | and | |
215 | .I arg2 | |
216 | is not zero or a signal number. | |
a1d5f77c MK |
217 | .SH VERSIONS |
218 | The | |
219 | .BR prctl () | |
220 | system call was introduced in Linux 2.1.57. | |
221 | .\" The library interface was added in glibc 2.0.6 | |
fea681da | 222 | .SH "CONFORMING TO" |
8382f16d | 223 | This call is Linux-specific. |
c13182ef | 224 | IRIX has a |
1e321034 MK |
225 | .BR prctl () |
226 | system call (also introduced in Linux 2.1.44 | |
fea681da MK |
227 | as irix_prctl on the MIPS architecture), |
228 | with prototype | |
229 | .sp | |
230 | .BI "ptrdiff_t prctl(int " option ", int " arg2 ", int " arg3 ); | |
231 | .sp | |
232 | and options to get the maximum number of processes per user, | |
233 | get the maximum number of processors the calling process can use, | |
234 | find out whether a specified process is currently blocked, | |
fba59d25 | 235 | get or set the maximum stack size, etc. |
fea681da | 236 | .SH "SEE ALSO" |
cb1c9135 | 237 | .BR signal (2), |
e1a9bc1b | 238 | .BR core (5) |