ioctl_tty.2: Update DTR example
[man-pages.git] / man2 / personality.2
blobb42692896c6b1717a312fbe6eef1e54eac4b0f3e
1 .\" Copyright (C) 1995, Thomas K. Dyas <tdyas@eden.rutgers.edu>
2 .\" and Copyright (C) 2016, Michael Kerrisk <mtk.manpages@gmail.com>
3 .\"
4 .\" %%%LICENSE_START(VERBATIM)
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
8 .\"
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
13 .\"
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein.  The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
20 .\" professionally.
21 .\"
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
24 .\" %%%LICENSE_END
25 .\"
26 .\" Created   Sat Aug 21 1995     Thomas K. Dyas <tdyas@eden.rutgers.edu>
27 .\"
28 .\" typo corrected, aeb, 950825
29 .\" added layout change from joey, 960722
30 .\" changed prototype, documented 0xffffffff, aeb, 030101
31 .\" Modified 2004-11-03 patch from Martin Schulze <joey@infodrom.org>
32 .\"
33 .TH PERSONALITY 2 2021-03-22 "Linux" "Linux Programmer's Manual"
34 .SH NAME
35 personality \- set the process execution domain
36 .SH SYNOPSIS
37 .nf
38 .B #include <sys/personality.h>
39 .PP
40 .BI "int personality(unsigned long " persona );
41 .fi
42 .SH DESCRIPTION
43 Linux supports different execution domains, or personalities, for each
44 process.
45 Among other things, execution domains tell Linux how to map
46 signal numbers into signal actions.
47 The execution domain system allows
48 Linux to provide limited support for binaries compiled under other
49 UNIX-like operating systems.
50 .PP
52 .I persona
53 is not
54 0xffffffff, then
55 .BR personality ()
56 sets the caller's execution domain to the value specified by
57 .IR persona .
58 Specifying
59 .IR persona
60 as 0xffffffff provides a way of retrieving
61 the current persona without changing it.
62 .PP
63 A list of the available execution domains can be found in
64 .IR <sys/personality.h> .
65 The execution domain is a 32-bit value in which the top three
66 bytes are set aside for flags that cause the kernel to modify the
67 behavior of certain system calls so as to emulate historical or
68 architectural quirks.
69 The least significant byte is a value defining the personality
70 the kernel should assume.
71 The flag values are as follows:
72 .TP
73 .BR ADDR_COMPAT_LAYOUT " (since Linux 2.6.9)"
74 With this flag set, provide legacy virtual address space layout.
75 .TP
76 .BR ADDR_NO_RANDOMIZE " (since Linux 2.6.12)"
77 With this flag set, disable address-space-layout randomization.
78 .TP
79 .BR ADDR_LIMIT_32BIT " (since Linux 2.2)"
80 Limit the address space to 32 bits.
81 .TP
82 .BR ADDR_LIMIT_3GB " (since Linux 2.4.0)"
83 With this flag set, use 0xc0000000 as the offset at which to search
84 a virtual memory chunk on
85 .BR mmap (2);
86 otherwise use 0xffffe000.
87 .TP
88 .BR FDPIC_FUNCPTRS " (since Linux 2.6.11)"
89 User-space function pointers to signal handlers point
90 (on certain architectures) to descriptors.
91 .TP
92 .BR MMAP_PAGE_ZERO " (since Linux 2.4.0)"
93 Map page 0 as read-only
94 (to support binaries that depend on this SVr4 behavior).
95 .TP
96 .BR READ_IMPLIES_EXEC " (since Linux 2.6.8)"
97 With this flag set,
98 .BR PROT_READ
99 implies
100 .BR PROT_EXEC
102 .BR mmap (2).
104 .BR SHORT_INODE " (since Linux 2.4.0)"
105 No effects(?).
107 .BR STICKY_TIMEOUTS " (since Linux 1.2.0)"
108 With this flag set,
109 .BR select (2),
110 .BR pselect (2),
112 .BR ppoll (2)
113 do not modify the returned timeout argument when
114 interrupted by a signal handler.
116 .BR UNAME26 " (since Linux 3.1)"
117 Have
118 .BR uname (2)
119 report a 2.6.40+ version number rather than a 3.x version number.
120 Added as a stopgap measure to support broken applications that
121 could not handle the kernel version-numbering switch from 2.6.x to 3.x.
123 .BR WHOLE_SECONDS " (since Linux 1.2.0)"
124 No effects(?).
126 The available execution domains are:
128 .BR PER_BSD " (since Linux 1.2.0)"
129 BSD. (No effects.)
131 .BR PER_HPUX " (since Linux 2.4)"
132 Support for 32-bit HP/UX.
133 This support was never complete, and was dropped so that since Linux 4.0,
134 this value has no effect.
136 .BR PER_IRIX32 " (since Linux 2.2)"
137 IRIX 5 32-bit.
138 Never fully functional; support dropped in Linux 2.6.27.
139 Implies
140 .BR STICKY_TIMEOUTS .
142 .BR PER_IRIX64 " (since Linux 2.2)"
143 IRIX 6 64-bit.
144 Implies
145 .BR STICKY_TIMEOUTS ;
146 otherwise no effects.
148 .BR PER_IRIXN32 " (since Linux 2.2)"
149 IRIX 6 new 32-bit.
150 Implies
151 .BR STICKY_TIMEOUTS ;
152 otherwise no effects.
154 .BR PER_ISCR4 " (since Linux 1.2.0)"
155 Implies
156 .BR STICKY_TIMEOUTS ;
157 otherwise no effects.
159 .BR PER_LINUX " (since Linux 1.2.0)"
160 Linux.
162 .BR PER_LINUX32 " (since Linux 2.2)"
163 [To be documented.]
165 .BR PER_LINUX32_3GB " (since Linux 2.4)"
166 Implies
167 .BR ADDR_LIMIT_3GB .
169 .BR PER_LINUX_32BIT " (since Linux 2.0)"
170 Implies
171 .BR ADDR_LIMIT_32BIT .
173 .BR PER_LINUX_FDPIC " (since Linux 2.6.11)"
174 Implies
175 .BR FDPIC_FUNCPTRS .
177 .BR PER_OSF4 " (since Linux 2.4)"
178 OSF/1 v4.
179 On alpha,
180 .\" Following is from a comment in arch/alpha/kernel/osf_sys.c
181 clear top 32 bits of iov_len in the user's buffer for
182 compatibility with old versions of OSF/1 where iov_len
183 was defined as.
184 .IR int .
186 .BR PER_OSR5 " (since Linux 2.4)"
187 Implies
188 .BR STICKY_TIMEOUTS
190 .BR WHOLE_SECONDS ;
191 otherwise no effects.
193 .BR PER_RISCOS " (since Linux 2.2)"
194 [To be documented.]
196 .BR PER_SCOSVR3 " (since Linux 1.2.0)"
197 Implies
198 .BR STICKY_TIMEOUTS ,
199 .BR WHOLE_SECONDS ,
201 .BR SHORT_INODE ;
202 otherwise no effects.
204 .BR PER_SOLARIS " (since Linux 2.4)"
205 Implies
206 .BR STICKY_TIMEOUTS ;
207 otherwise no effects.
209 .BR PER_SUNOS " (since Linux 2.4.0)"
210 Implies
211 .BR STICKY_TIMEOUTS .
212 Divert library and dynamic linker searches to
213 .IR /usr/gnemul .
214 Buggy, largely unmaintained, and almost entirely unused;
215 support was removed in Linux 2.6.26.
217 .BR PER_SVR3 " (since Linux 1.2.0)"
218 Implies
219 .BR STICKY_TIMEOUTS
221 .BR SHORT_INODE ;
222 otherwise no effects.
224 .BR PER_SVR4 " (since Linux 1.2.0)"
225 Implies
226 .BR STICKY_TIMEOUTS
228 .BR MMAP_PAGE_ZERO ;
229 otherwise no effects.
231 .BR PER_UW7 " (since Linux 2.4)"
232 Implies
233 .BR STICKY_TIMEOUTS
235 .BR MMAP_PAGE_ZERO ;
236 otherwise no effects.
238 .BR PER_WYSEV386 " (since Linux 1.2.0)"
239 Implies
240 .BR STICKY_TIMEOUTS
242 .BR SHORT_INODE ;
243 otherwise no effects.
245 .BR PER_XENIX " (since Linux 1.2.0)"
246 Implies
247 .BR STICKY_TIMEOUTS
249 .BR SHORT_INODE ;
250 otherwise no effects.
251 .SH RETURN VALUE
252 On success, the previous
253 .I persona
254 is returned.
255 On error, \-1 is returned, and
256 .I errno
257 is set to indicate the error.
258 .SH ERRORS
260 .B EINVAL
261 The kernel was unable to change the personality.
262 .SH VERSIONS
263 This system call first appeared in Linux 1.1.20
264 (and thus first in a stable kernel release with Linux 1.2.0);
265 library support was added in glibc 2.3.
266 .\" personality wrapper first appeared in glibc 1.90,
267 .\" <sys/personality.h> was added later in 2.2.91.
268 .SH CONFORMING TO
269 .BR personality ()
270 is Linux-specific and should not be used in programs intended to
271 be portable.
272 .SH SEE ALSO
273 .BR setarch (8)