OSDN Git Service

(split) LDP: Update POT and ja.po to LDP v3.38.
[linuxjm/LDP_man-pages.git] / po4a / memory / po / memory.pot
1 # SOME DESCRIPTIVE TITLE
2 # Copyright (C) YEAR Free Software Foundation, Inc.
3 # This file is distributed under the same license as the PACKAGE package.
4 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5 #
6 #, fuzzy
7 msgid ""
8 msgstr ""
9 "Project-Id-Version: PACKAGE VERSION\n"
10 "POT-Creation-Date: 2012-04-23 07:53+0900\n"
11 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
12 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13 "Language-Team: LANGUAGE <LL@li.org>\n"
14 "Language: \n"
15 "MIME-Version: 1.0\n"
16 "Content-Type: text/plain; charset=UTF-8\n"
17 "Content-Transfer-Encoding: 8bit\n"
18
19 #. type: TH
20 #: build/C/man2/alloc_hugepages.2:25
21 #, no-wrap
22 msgid "ALLOC_HUGEPAGES"
23 msgstr ""
24
25 #. type: TH
26 #: build/C/man2/alloc_hugepages.2:25
27 #, no-wrap
28 msgid "2007-05-31"
29 msgstr ""
30
31 #. type: TH
32 #: build/C/man2/alloc_hugepages.2:25 build/C/man2/cacheflush.2:24 build/C/man2/fallocate.2:8 build/C/man2/madvise.2:35 build/C/man3/mallopt.3:24 build/C/man2/mlock.2:27 build/C/man2/mmap.2:40 build/C/man2/mmap2.2:29 build/C/man2/mprotect.2:32 build/C/man2/mremap.2:31 build/C/man2/msync.2:25 build/C/man2/posix_fadvise.2:27 build/C/man2/readahead.2:28 build/C/man2/remap_file_pages.2:26 build/C/man3/shm_open.3:26 build/C/man7/shm_overview.7:27 build/C/man2/shmctl.2:43 build/C/man2/shmget.2:36 build/C/man2/shmop.2:39 build/C/man2/subpage_prot.2:28 build/C/man2/sync_file_range.2:30
33 #, no-wrap
34 msgid "Linux"
35 msgstr ""
36
37 #. type: TH
38 #: build/C/man2/alloc_hugepages.2:25 build/C/man3/alloca.3:41 build/C/man2/cacheflush.2:24 build/C/man2/fallocate.2:8 build/C/man2/madvise.2:35 build/C/man3/malloc_hook.3:6 build/C/man3/mallopt.3:24 build/C/man2/mlock.2:27 build/C/man2/mmap.2:40 build/C/man2/mmap2.2:29 build/C/man2/mprotect.2:32 build/C/man2/mremap.2:31 build/C/man2/msync.2:25 build/C/man3/mtrace.3:23 build/C/man2/posix_fadvise.2:27 build/C/man3/posix_fallocate.3:23 build/C/man3/posix_memalign.3:28 build/C/man2/readahead.2:28 build/C/man2/remap_file_pages.2:26 build/C/man3/shm_open.3:26 build/C/man7/shm_overview.7:27 build/C/man2/shmctl.2:43 build/C/man2/shmget.2:36 build/C/man2/shmop.2:39 build/C/man2/subpage_prot.2:28 build/C/man2/sync_file_range.2:30
39 #, no-wrap
40 msgid "Linux Programmer's Manual"
41 msgstr ""
42
43 #. type: SH
44 #: build/C/man2/alloc_hugepages.2:26 build/C/man3/alloca.3:42 build/C/man2/cacheflush.2:25 build/C/man2/fallocate.2:9 build/C/man2/madvise.2:36 build/C/man3/malloc_hook.3:7 build/C/man3/mallopt.3:25 build/C/man2/mlock.2:28 build/C/man2/mmap.2:41 build/C/man2/mmap2.2:30 build/C/man2/mprotect.2:33 build/C/man2/mremap.2:32 build/C/man2/msync.2:26 build/C/man3/mtrace.3:24 build/C/man2/posix_fadvise.2:28 build/C/man3/posix_fallocate.3:24 build/C/man3/posix_memalign.3:29 build/C/man2/readahead.2:29 build/C/man2/remap_file_pages.2:27 build/C/man3/shm_open.3:27 build/C/man7/shm_overview.7:28 build/C/man2/shmctl.2:44 build/C/man2/shmget.2:37 build/C/man2/shmop.2:40 build/C/man2/subpage_prot.2:29 build/C/man2/sync_file_range.2:31
45 #, no-wrap
46 msgid "NAME"
47 msgstr ""
48
49 #. type: Plain text
50 #: build/C/man2/alloc_hugepages.2:28
51 msgid "alloc_hugepages, free_hugepages - allocate or free huge pages"
52 msgstr ""
53
54 #. type: SH
55 #: build/C/man2/alloc_hugepages.2:28 build/C/man3/alloca.3:44 build/C/man2/cacheflush.2:27 build/C/man2/fallocate.2:11 build/C/man2/madvise.2:38 build/C/man3/malloc_hook.3:11 build/C/man3/mallopt.3:27 build/C/man2/mlock.2:30 build/C/man2/mmap.2:43 build/C/man2/mmap2.2:32 build/C/man2/mprotect.2:35 build/C/man2/mremap.2:34 build/C/man2/msync.2:28 build/C/man3/mtrace.3:26 build/C/man2/posix_fadvise.2:30 build/C/man3/posix_fallocate.3:26 build/C/man3/posix_memalign.3:31 build/C/man2/readahead.2:31 build/C/man2/remap_file_pages.2:29 build/C/man3/shm_open.3:29 build/C/man2/shmctl.2:46 build/C/man2/shmget.2:39 build/C/man2/shmop.2:42 build/C/man2/subpage_prot.2:31 build/C/man2/sync_file_range.2:33
56 #, no-wrap
57 msgid "SYNOPSIS"
58 msgstr ""
59
60 #.  asmlinkage unsigned long sys_alloc_hugepages(int key, unsigned long addr,
61 #.  unsigned long len, int prot, int flag);
62 #. type: Plain text
63 #: build/C/man2/alloc_hugepages.2:34
64 #, no-wrap
65 msgid ""
66 "B<void *alloc_hugepages(int >I<key>B<, void *>I<addr>B<, size_t "
67 ">I<len>B<,>\n"
68 "B<                      int >I<prot>B<, int >I<flag>B<);>\n"
69 msgstr ""
70
71 #.  asmlinkage int sys_free_hugepages(unsigned long addr);
72 #. type: Plain text
73 #: build/C/man2/alloc_hugepages.2:37
74 #, no-wrap
75 msgid "B<int free_hugepages(void *>I<addr>B<);>\n"
76 msgstr ""
77
78 #. type: SH
79 #: build/C/man2/alloc_hugepages.2:38 build/C/man3/alloca.3:48 build/C/man2/cacheflush.2:33 build/C/man2/fallocate.2:19 build/C/man2/madvise.2:50 build/C/man3/malloc_hook.3:29 build/C/man3/mallopt.3:31 build/C/man2/mlock.2:40 build/C/man2/mmap.2:52 build/C/man2/mmap2.2:39 build/C/man2/mprotect.2:41 build/C/man2/mremap.2:43 build/C/man2/msync.2:32 build/C/man3/mtrace.3:32 build/C/man2/posix_fadvise.2:49 build/C/man3/posix_fallocate.3:44 build/C/man3/posix_memalign.3:83 build/C/man2/readahead.2:38 build/C/man2/remap_file_pages.2:37 build/C/man3/shm_open.3:41 build/C/man7/shm_overview.7:30 build/C/man2/shmctl.2:54 build/C/man2/shmget.2:47 build/C/man2/shmop.2:51 build/C/man2/subpage_prot.2:36 build/C/man2/sync_file_range.2:41
80 #, no-wrap
81 msgid "DESCRIPTION"
82 msgstr ""
83
84 #. type: Plain text
85 #: build/C/man2/alloc_hugepages.2:49
86 msgid ""
87 "The system calls B<alloc_hugepages>()  and B<free_hugepages>()  were "
88 "introduced in Linux 2.5.36 and removed again in 2.5.54.  They existed only "
89 "on i386 and ia64 (when built with B<CONFIG_HUGETLB_PAGE>).  In Linux 2.4.20 "
90 "the syscall numbers exist, but the calls fail with the error B<ENOSYS>."
91 msgstr ""
92
93 #. type: Plain text
94 #: build/C/man2/alloc_hugepages.2:57
95 msgid ""
96 "On i386 the memory management hardware knows about ordinary pages (4 KiB)  "
97 "and huge pages (2 or 4 MiB).  Similarly ia64 knows about huge pages of "
98 "several sizes.  These system calls serve to map huge pages into the "
99 "process's memory or to free them again.  Huge pages are locked into memory, "
100 "and are not swapped."
101 msgstr ""
102
103 #. type: Plain text
104 #: build/C/man2/alloc_hugepages.2:66
105 msgid ""
106 "The I<key> argument is an identifier.  When zero the pages are private, and "
107 "not inherited by children.  When positive the pages are shared with other "
108 "applications using the same I<key>, and inherited by child processes."
109 msgstr ""
110
111 #. type: Plain text
112 #: build/C/man2/alloc_hugepages.2:81
113 msgid ""
114 "The I<addr> argument of B<free_hugepages>()  tells which page is being "
115 "freed: it was the return value of a call to B<alloc_hugepages>().  (The "
116 "memory is first actually freed when all users have released it.)  The "
117 "I<addr> argument of B<alloc_hugepages>()  is a hint, that the kernel may or "
118 "may not follow.  Addresses must be properly aligned."
119 msgstr ""
120
121 #. type: Plain text
122 #: build/C/man2/alloc_hugepages.2:86
123 msgid ""
124 "The I<len> argument is the length of the required segment.  It must be a "
125 "multiple of the huge page size."
126 msgstr ""
127
128 #. type: Plain text
129 #: build/C/man2/alloc_hugepages.2:94
130 msgid ""
131 "The I<prot> argument specifies the memory protection of the segment.  It is "
132 "one of B<PROT_READ>, B<PROT_WRITE>, B<PROT_EXEC>."
133 msgstr ""
134
135 #. type: Plain text
136 #: build/C/man2/alloc_hugepages.2:109
137 msgid ""
138 "The I<flag> argument is ignored, unless I<key> is positive.  In that case, "
139 "if I<flag> is B<IPC_CREAT>, then a new huge page segment is created when "
140 "none with the given key existed.  If this flag is not set, then B<ENOENT> is "
141 "returned when no segment with the given key exists."
142 msgstr ""
143
144 #. type: SH
145 #: build/C/man2/alloc_hugepages.2:109 build/C/man3/alloca.3:58 build/C/man2/cacheflush.2:52 build/C/man2/fallocate.2:109 build/C/man2/madvise.2:250 build/C/man3/mallopt.3:377 build/C/man2/mlock.2:117 build/C/man2/mmap.2:373 build/C/man2/mmap2.2:50 build/C/man2/mprotect.2:72 build/C/man2/mremap.2:128 build/C/man2/msync.2:68 build/C/man2/posix_fadvise.2:86 build/C/man3/posix_fallocate.3:64 build/C/man3/posix_memalign.3:141 build/C/man2/readahead.2:65 build/C/man2/remap_file_pages.2:122 build/C/man3/shm_open.3:169 build/C/man2/shmctl.2:272 build/C/man2/shmget.2:178 build/C/man2/shmop.2:169 build/C/man2/subpage_prot.2:61 build/C/man2/sync_file_range.2:141
146 #, no-wrap
147 msgid "RETURN VALUE"
148 msgstr ""
149
150 #. type: Plain text
151 #: build/C/man2/alloc_hugepages.2:118
152 msgid ""
153 "On success, B<alloc_hugepages>()  returns the allocated virtual address, and "
154 "B<free_hugepages>()  returns zero.  On error, -1 is returned, and I<errno> "
155 "is set appropriately."
156 msgstr ""
157
158 #. type: SH
159 #: build/C/man2/alloc_hugepages.2:118 build/C/man2/cacheflush.2:58 build/C/man2/fallocate.2:112 build/C/man2/madvise.2:257 build/C/man3/mallopt.3:382 build/C/man2/mlock.2:123 build/C/man2/mmap.2:390 build/C/man2/mmap2.2:57 build/C/man2/mprotect.2:79 build/C/man2/mremap.2:136 build/C/man2/msync.2:73 build/C/man2/posix_fadvise.2:89 build/C/man3/posix_fallocate.3:70 build/C/man3/posix_memalign.3:155 build/C/man2/readahead.2:71 build/C/man2/remap_file_pages.2:129 build/C/man3/shm_open.3:178 build/C/man2/shmctl.2:294 build/C/man2/shmget.2:182 build/C/man2/shmop.2:183 build/C/man2/subpage_prot.2:66 build/C/man2/sync_file_range.2:147
160 #, no-wrap
161 msgid "ERRORS"
162 msgstr ""
163
164 #. type: TP
165 #: build/C/man2/alloc_hugepages.2:119 build/C/man2/fallocate.2:151
166 #, no-wrap
167 msgid "B<ENOSYS>"
168 msgstr ""
169
170 #. type: Plain text
171 #: build/C/man2/alloc_hugepages.2:122
172 msgid "The system call is not supported on this kernel."
173 msgstr ""
174
175 #. type: SH
176 #: build/C/man2/alloc_hugepages.2:122
177 #, no-wrap
178 msgid "FILES"
179 msgstr ""
180
181 #. type: Plain text
182 #: build/C/man2/alloc_hugepages.2:126
183 msgid ""
184 "I</proc/sys/vm/nr_hugepages> Number of configured hugetlb pages.  This can "
185 "be read and written."
186 msgstr ""
187
188 #. type: Plain text
189 #: build/C/man2/alloc_hugepages.2:130
190 msgid ""
191 "I</proc/meminfo> Gives info on the number of configured hugetlb pages and on "
192 "their size in the three variables HugePages_Total, HugePages_Free, "
193 "Hugepagesize."
194 msgstr ""
195
196 #. type: SH
197 #: build/C/man2/alloc_hugepages.2:130 build/C/man3/alloca.3:63 build/C/man2/cacheflush.2:74 build/C/man2/fallocate.2:186 build/C/man2/madvise.2:307 build/C/man3/malloc_hook.3:76 build/C/man3/mallopt.3:390 build/C/man2/mlock.2:187 build/C/man2/mmap.2:483 build/C/man2/mmap2.2:73 build/C/man2/mprotect.2:107 build/C/man2/mremap.2:186 build/C/man2/msync.2:96 build/C/man3/mtrace.3:76 build/C/man2/posix_fadvise.2:111 build/C/man3/posix_fallocate.3:101 build/C/man3/posix_memalign.3:180 build/C/man2/readahead.2:87 build/C/man2/remap_file_pages.2:151 build/C/man3/shm_open.3:249 build/C/man7/shm_overview.7:101 build/C/man2/shmctl.2:366 build/C/man2/shmget.2:229 build/C/man2/shmop.2:226 build/C/man2/subpage_prot.2:91 build/C/man2/sync_file_range.2:180
198 #, no-wrap
199 msgid "CONFORMING TO"
200 msgstr ""
201
202 #. type: Plain text
203 #: build/C/man2/alloc_hugepages.2:133
204 msgid ""
205 "These calls are specific to Linux on Intel processors, and should not be "
206 "used in programs intended to be portable."
207 msgstr ""
208
209 #. type: SH
210 #: build/C/man2/alloc_hugepages.2:133 build/C/man3/alloca.3:71 build/C/man2/madvise.2:328 build/C/man3/malloc_hook.3:78 build/C/man2/mlock.2:214 build/C/man2/mmap.2:501 build/C/man2/mmap2.2:75 build/C/man2/mprotect.2:116 build/C/man2/mremap.2:192 build/C/man3/mtrace.3:78 build/C/man2/posix_fadvise.2:120 build/C/man3/posix_memalign.3:219 build/C/man3/shm_open.3:255 build/C/man7/shm_overview.7:103 build/C/man2/shmctl.2:371 build/C/man2/shmget.2:235 build/C/man2/shmop.2:245 build/C/man2/subpage_prot.2:93 build/C/man2/sync_file_range.2:183
211 #, no-wrap
212 msgid "NOTES"
213 msgstr ""
214
215 #. type: Plain text
216 #: build/C/man2/alloc_hugepages.2:141
217 msgid ""
218 "These system calls are gone; they existed only in Linux 2.5.36 through to "
219 "2.5.54.  Now the hugetlbfs file system can be used instead.  Memory backed "
220 "by huge pages (if the CPU supports them) is obtained by using B<mmap>(2)  to "
221 "map files in this virtual file system."
222 msgstr ""
223
224 #. type: Plain text
225 #: build/C/man2/alloc_hugepages.2:145
226 msgid ""
227 "The maximal number of huge pages can be specified using the B<hugepages=> "
228 "boot parameter."
229 msgstr ""
230
231 #. type: SH
232 #: build/C/man2/alloc_hugepages.2:150 build/C/man3/alloca.3:153 build/C/man2/cacheflush.2:88 build/C/man2/fallocate.2:193 build/C/man2/madvise.2:360 build/C/man3/malloc_hook.3:138 build/C/man3/mallopt.3:578 build/C/man2/mlock.2:337 build/C/man2/mmap.2:667 build/C/man2/mmap2.2:94 build/C/man2/mprotect.2:223 build/C/man2/mremap.2:214 build/C/man2/msync.2:122 build/C/man3/mtrace.3:169 build/C/man2/posix_fadvise.2:188 build/C/man3/posix_fallocate.3:130 build/C/man3/posix_memalign.3:275 build/C/man2/readahead.2:98 build/C/man2/remap_file_pages.2:162 build/C/man3/shm_open.3:280 build/C/man7/shm_overview.7:127 build/C/man2/shmctl.2:410 build/C/man2/shmget.2:298 build/C/man2/shmop.2:290 build/C/man2/subpage_prot.2:126 build/C/man2/sync_file_range.2:222
233 #, no-wrap
234 msgid "COLOPHON"
235 msgstr ""
236
237 #. type: Plain text
238 #: build/C/man2/alloc_hugepages.2:157 build/C/man3/alloca.3:160 build/C/man2/cacheflush.2:95 build/C/man2/fallocate.2:200 build/C/man2/madvise.2:367 build/C/man3/malloc_hook.3:145 build/C/man3/mallopt.3:585 build/C/man2/mlock.2:344 build/C/man2/mmap.2:674 build/C/man2/mmap2.2:101 build/C/man2/mprotect.2:230 build/C/man2/mremap.2:221 build/C/man2/msync.2:129 build/C/man3/mtrace.3:176 build/C/man2/posix_fadvise.2:195 build/C/man3/posix_fallocate.3:137 build/C/man3/posix_memalign.3:282 build/C/man2/readahead.2:105 build/C/man2/remap_file_pages.2:169 build/C/man3/shm_open.3:287 build/C/man7/shm_overview.7:134 build/C/man2/shmctl.2:417 build/C/man2/shmget.2:305 build/C/man2/shmop.2:297 build/C/man2/subpage_prot.2:133 build/C/man2/sync_file_range.2:229
239 msgid ""
240 "This page is part of release 3.38 of the Linux I<man-pages> project.  A "
241 "description of the project, and information about reporting bugs, can be "
242 "found at http://www.kernel.org/doc/man-pages/."
243 msgstr ""
244
245 #. type: TH
246 #: build/C/man3/alloca.3:41
247 #, no-wrap
248 msgid "ALLOCA"
249 msgstr ""
250
251 #. type: TH
252 #: build/C/man3/alloca.3:41
253 #, no-wrap
254 msgid "2008-01-24"
255 msgstr ""
256
257 #. type: TH
258 #: build/C/man3/alloca.3:41 build/C/man3/malloc_hook.3:6 build/C/man3/mtrace.3:23 build/C/man3/posix_fallocate.3:23 build/C/man3/posix_memalign.3:28
259 #, no-wrap
260 msgid "GNU"
261 msgstr ""
262
263 #. type: Plain text
264 #: build/C/man3/alloca.3:44
265 msgid "alloca - allocate memory that is automatically freed"
266 msgstr ""
267
268 #. type: Plain text
269 #: build/C/man3/alloca.3:46
270 msgid "B<#include E<lt>alloca.hE<gt>>"
271 msgstr ""
272
273 #. type: Plain text
274 #: build/C/man3/alloca.3:48
275 msgid "B<void *alloca(size_t >I<size>B<);>"
276 msgstr ""
277
278 #. type: Plain text
279 #: build/C/man3/alloca.3:58
280 msgid ""
281 "The B<alloca>()  function allocates I<size> bytes of space in the stack "
282 "frame of the caller.  This temporary space is automatically freed when the "
283 "function that called B<alloca>()  returns to its caller."
284 msgstr ""
285
286 #. type: Plain text
287 #: build/C/man3/alloca.3:63
288 msgid ""
289 "The B<alloca>()  function returns a pointer to the beginning of the "
290 "allocated space.  If the allocation causes stack overflow, program behavior "
291 "is undefined."
292 msgstr ""
293
294 #. type: Plain text
295 #: build/C/man3/alloca.3:65
296 msgid "This function is not in POSIX.1-2001."
297 msgstr ""
298
299 #. type: Plain text
300 #: build/C/man3/alloca.3:71
301 msgid ""
302 "There is evidence that the B<alloca>()  function appeared in 32V, PWB, "
303 "PWB.2, 3BSD, and 4BSD.  There is a man page for it in 4.3BSD.  Linux uses "
304 "the GNU version."
305 msgstr ""
306
307 #. type: Plain text
308 #: build/C/man3/alloca.3:86
309 msgid ""
310 "The B<alloca>()  function is machine- and compiler-dependent.  For certain "
311 "applications, its use can improve efficiency compared to the use of "
312 "B<malloc>(3)  plus B<free>(3).  In certain cases, it can also simplify "
313 "memory deallocation in applications that use B<longjmp>(3)  or "
314 "B<siglongjmp>(3).  Otherwise, its use is discouraged."
315 msgstr ""
316
317 #. type: Plain text
318 #: build/C/man3/alloca.3:95
319 msgid ""
320 "Because the space allocated by B<alloca>()  is allocated within the stack "
321 "frame, that space is automatically freed if the function return is jumped "
322 "over by a call to B<longjmp>(3)  or B<siglongjmp>(3)."
323 msgstr ""
324
325 #. type: Plain text
326 #: build/C/man3/alloca.3:100
327 msgid "Do not attempt to B<free>(3)  space allocated by B<alloca>()!"
328 msgstr ""
329
330 #. type: SS
331 #: build/C/man3/alloca.3:100
332 #, no-wrap
333 msgid "Notes on the GNU Version"
334 msgstr ""
335
336 #. type: Plain text
337 #: build/C/man3/alloca.3:122
338 msgid ""
339 "Normally, B<gcc>(1)  translates calls to B<alloca>()  with inlined code.  "
340 "This is not done when either the I<-ansi>, I<-std=c89>, I<-std=c99>, or the "
341 "I<-fno-builtin> option is given (and the header I<E<lt>alloca.hE<gt>> is not "
342 "included).  But beware! By default the glibc version of "
343 "I<E<lt>stdlib.hE<gt>> includes I<E<lt>alloca.hE<gt>> and that contains the "
344 "line:"
345 msgstr ""
346
347 #. type: Plain text
348 #: build/C/man3/alloca.3:125
349 #, no-wrap
350 msgid "    #define alloca(size)   __builtin_alloca (size)\n"
351 msgstr ""
352
353 #. type: Plain text
354 #: build/C/man3/alloca.3:128
355 msgid "with messy consequences if one has a private version of this function."
356 msgstr ""
357
358 #. type: Plain text
359 #: build/C/man3/alloca.3:132
360 msgid ""
361 "The fact that the code is inlined means that it is impossible to take the "
362 "address of this function, or to change its behavior by linking with a "
363 "different library."
364 msgstr ""
365
366 #. type: Plain text
367 #: build/C/man3/alloca.3:136
368 msgid ""
369 "The inlined code often consists of a single instruction adjusting the stack "
370 "pointer, and does not check for stack overflow.  Thus, there is no NULL "
371 "error return."
372 msgstr ""
373
374 #. type: SH
375 #: build/C/man3/alloca.3:136 build/C/man2/cacheflush.2:81 build/C/man3/mallopt.3:404 build/C/man2/mlock.2:305 build/C/man2/mmap.2:540 build/C/man3/mtrace.3:100 build/C/man2/posix_fadvise.2:177 build/C/man2/shmget.2:284
376 #, no-wrap
377 msgid "BUGS"
378 msgstr ""
379
380 #. type: Plain text
381 #: build/C/man3/alloca.3:141
382 msgid ""
383 "There is no error indication if the stack frame cannot be extended.  "
384 "(However, after a failed allocation, the program is likely to receive a "
385 "B<SIGSEGV> signal if it attempts to access the unallocated space.)"
386 msgstr ""
387
388 #. type: Plain text
389 #: build/C/man3/alloca.3:149
390 msgid ""
391 "On many systems B<alloca>()  cannot be used inside the list of arguments of "
392 "a function call, because the stack space reserved by B<alloca>()  would "
393 "appear on the stack in the middle of the space for the function arguments."
394 msgstr ""
395
396 #. type: SH
397 #: build/C/man3/alloca.3:149 build/C/man2/fallocate.2:189 build/C/man2/madvise.2:353 build/C/man3/malloc_hook.3:133 build/C/man3/mallopt.3:568 build/C/man2/mlock.2:330 build/C/man2/mmap.2:649 build/C/man2/mmap2.2:88 build/C/man2/mprotect.2:220 build/C/man2/mremap.2:200 build/C/man2/msync.2:118 build/C/man3/mtrace.3:165 build/C/man2/posix_fadvise.2:182 build/C/man3/posix_fallocate.3:126 build/C/man3/posix_memalign.3:270 build/C/man2/readahead.2:92 build/C/man2/remap_file_pages.2:155 build/C/man3/shm_open.3:269 build/C/man7/shm_overview.7:114 build/C/man2/shmctl.2:403 build/C/man2/shmget.2:290 build/C/man2/shmop.2:282 build/C/man2/subpage_prot.2:120 build/C/man2/sync_file_range.2:217
398 #, no-wrap
399 msgid "SEE ALSO"
400 msgstr ""
401
402 #. type: Plain text
403 #: build/C/man3/alloca.3:153
404 msgid "B<brk>(2), B<longjmp>(3), B<malloc>(3)"
405 msgstr ""
406
407 #. type: TH
408 #: build/C/man2/cacheflush.2:24
409 #, no-wrap
410 msgid "CACHEFLUSH"
411 msgstr ""
412
413 #. type: TH
414 #: build/C/man2/cacheflush.2:24
415 #, no-wrap
416 msgid "2007-05-26"
417 msgstr ""
418
419 #. type: Plain text
420 #: build/C/man2/cacheflush.2:27
421 msgid "cacheflush - flush contents of instruction and/or data cache"
422 msgstr ""
423
424 #. type: Plain text
425 #: build/C/man2/cacheflush.2:30
426 #, no-wrap
427 msgid "B<#include E<lt>asm/cachectl.hE<gt>>\n"
428 msgstr ""
429
430 #. type: Plain text
431 #: build/C/man2/cacheflush.2:32
432 #, no-wrap
433 msgid "B<int cacheflush(char *>I<addr>B<, int >I<nbytes>B<, int >I<cache>B<);>\n"
434 msgstr ""
435
436 #. type: Plain text
437 #: build/C/man2/cacheflush.2:42
438 msgid ""
439 "B<cacheflush>()  flushes the contents of the indicated cache(s) for the user "
440 "addresses in the range I<addr> to I<(addr+nbytes-1)>.  I<cache> may be one "
441 "of:"
442 msgstr ""
443
444 #. type: TP
445 #: build/C/man2/cacheflush.2:42
446 #, no-wrap
447 msgid "B<ICACHE>"
448 msgstr ""
449
450 #. type: Plain text
451 #: build/C/man2/cacheflush.2:45
452 msgid "Flush the instruction cache."
453 msgstr ""
454
455 #. type: TP
456 #: build/C/man2/cacheflush.2:45
457 #, no-wrap
458 msgid "B<DCACHE>"
459 msgstr ""
460
461 #. type: Plain text
462 #: build/C/man2/cacheflush.2:48
463 msgid "Write back to memory and invalidate the affected valid cache lines."
464 msgstr ""
465
466 #. type: TP
467 #: build/C/man2/cacheflush.2:48
468 #, no-wrap
469 msgid "B<BCACHE>"
470 msgstr ""
471
472 #. type: Plain text
473 #: build/C/man2/cacheflush.2:52
474 msgid "Same as B<(ICACHE|DCACHE)>."
475 msgstr ""
476
477 #. type: Plain text
478 #: build/C/man2/cacheflush.2:58
479 msgid ""
480 "B<cacheflush>()  returns 0 on success or -1 on error.  If errors are "
481 "detected, I<errno> will indicate the error."
482 msgstr ""
483
484 #. type: TP
485 #: build/C/man2/cacheflush.2:59 build/C/man2/mmap2.2:58 build/C/man2/mremap.2:143 build/C/man2/shmctl.2:303 build/C/man2/subpage_prot.2:67
486 #, no-wrap
487 msgid "B<EFAULT>"
488 msgstr ""
489
490 #. type: Plain text
491 #: build/C/man2/cacheflush.2:66
492 msgid ""
493 "Some or all of the address range I<addr> to I<(addr+nbytes-1)> is not "
494 "accessible."
495 msgstr ""
496
497 #. type: TP
498 #: build/C/man2/cacheflush.2:66 build/C/man2/fallocate.2:124 build/C/man2/madvise.2:264 build/C/man2/mlock.2:158 build/C/man2/mlock.2:165 build/C/man2/mlock.2:177 build/C/man2/mmap.2:421 build/C/man2/mmap.2:429 build/C/man2/mmap.2:434 build/C/man2/mmap2.2:61 build/C/man2/mprotect.2:89 build/C/man2/mremap.2:152 build/C/man2/msync.2:80 build/C/man2/posix_fadvise.2:93 build/C/man3/posix_fallocate.3:79 build/C/man3/posix_memalign.3:156 build/C/man2/readahead.2:76 build/C/man2/remap_file_pages.2:130 build/C/man2/remap_file_pages.2:137 build/C/man3/shm_open.3:211 build/C/man2/shmctl.2:317 build/C/man2/shmget.2:196 build/C/man2/shmop.2:195 build/C/man2/shmop.2:218 build/C/man2/subpage_prot.2:72 build/C/man2/sync_file_range.2:152
499 #, no-wrap
500 msgid "B<EINVAL>"
501 msgstr ""
502
503 #. type: Plain text
504 #: build/C/man2/cacheflush.2:74
505 msgid "I<cache> is not one of B<ICACHE>, B<DCACHE>, or B<BCACHE>."
506 msgstr ""
507
508 #.  FIXME This system call was only on MIPS back in 1.2 days, but
509 #.  by now it is on a number of other architectures (but not i386).
510 #.  Investigate the details and update this page.
511 #.  Irix 6.5 appears to have a cacheflush() syscall -- mtk
512 #. type: Plain text
513 #: build/C/man2/cacheflush.2:81
514 msgid ""
515 "This Linux-specific system call is only available on MIPS-based systems.  It "
516 "should not be used in programs intended to be portable."
517 msgstr ""
518
519 #. type: Plain text
520 #: build/C/man2/cacheflush.2:88
521 msgid ""
522 "The current implementation ignores the I<addr> and I<nbytes> arguments.  "
523 "Therefore, the whole cache is always flushed."
524 msgstr ""
525
526 #. type: TH
527 #: build/C/man2/fallocate.2:8
528 #, no-wrap
529 msgid "FALLOCATE"
530 msgstr ""
531
532 #. type: TH
533 #: build/C/man2/fallocate.2:8
534 #, no-wrap
535 msgid "2012-02-27"
536 msgstr ""
537
538 #. type: Plain text
539 #: build/C/man2/fallocate.2:11
540 msgid "fallocate - manipulate file space"
541 msgstr ""
542
543 #. type: Plain text
544 #: build/C/man2/fallocate.2:15 build/C/man2/readahead.2:35
545 #, no-wrap
546 msgid ""
547 "B<#define _GNU_SOURCE>             /* See feature_test_macros(7) */\n"
548 "B<#include E<lt>fcntl.hE<gt>>\n"
549 msgstr ""
550
551 #. type: Plain text
552 #: build/C/man2/fallocate.2:18
553 #, no-wrap
554 msgid ""
555 "B<int fallocate(int >I<fd>B<, int >I<mode>B<, off_t >I<offset>B<, off_t "
556 ">I<len>B<);>\n"
557 msgstr ""
558
559 #. type: Plain text
560 #: build/C/man2/fallocate.2:24
561 msgid ""
562 "This is a nonportable, Linux-specific system call.  For the portable, "
563 "POSIX.1-specified method of ensuring that space is allocated for a file, see "
564 "B<posix_fallocate>(3)."
565 msgstr ""
566
567 #. type: Plain text
568 #: build/C/man2/fallocate.2:34
569 msgid ""
570 "B<fallocate>()  allows the caller to directly manipulate the allocated disk "
571 "space for the file referred to by I<fd> for the byte range starting at "
572 "I<offset> and continuing for I<len> bytes."
573 msgstr ""
574
575 #. type: Plain text
576 #: build/C/man2/fallocate.2:39
577 msgid ""
578 "The I<mode> argument determines the operation to be performed on the given "
579 "range.  Details of the supported operations are given in the subsections "
580 "below."
581 msgstr ""
582
583 #. type: SS
584 #: build/C/man2/fallocate.2:39
585 #, no-wrap
586 msgid "Allocating disk space"
587 msgstr ""
588
589 #. type: Plain text
590 #: build/C/man2/fallocate.2:58
591 msgid ""
592 "The default operation (i.e., I<mode> is zero) of B<fallocate>()  allocates "
593 "and initializes to zero the disk space within the range specified by "
594 "I<offset> and I<len>.  The file size (as reported by B<stat>(2))  will be "
595 "changed if I<offset>+I<len> is greater than the file size.  This default "
596 "behavior closely resembles the behavior of the B<posix_fallocate>(3)  "
597 "library function, and is intended as a method of optimally implementing that "
598 "function."
599 msgstr ""
600
601 #. type: Plain text
602 #: build/C/man2/fallocate.2:64
603 msgid ""
604 "After a successful call, subsequent writes into the range specified by "
605 "I<offset> and I<len> are guaranteed not to fail because of lack of disk "
606 "space."
607 msgstr ""
608
609 #. type: Plain text
610 #: build/C/man2/fallocate.2:75
611 msgid ""
612 "If the B<FALLOC_FL_KEEP_SIZE> flag is specified in I<mode>, the behavior of "
613 "the call is similar, but the file size will not be changed even if "
614 "I<offset>+I<len> is greater than the file size.  Preallocating zeroed blocks "
615 "beyond the end of the file in this manner is useful for optimizing append "
616 "workloads."
617 msgstr ""
618
619 #. type: Plain text
620 #: build/C/man2/fallocate.2:79
621 msgid ""
622 "Because allocation is done in block size chunks, B<fallocate>()  may "
623 "allocate a larger range of disk space than was specified."
624 msgstr ""
625
626 #. type: SS
627 #: build/C/man2/fallocate.2:79
628 #, no-wrap
629 msgid "Deallocating file space"
630 msgstr ""
631
632 #. type: Plain text
633 #: build/C/man2/fallocate.2:94
634 msgid ""
635 "Specifying the B<FALLOC_FL_PUNCH_HOLE> flag (available since Linux 2.6.38) "
636 "in I<mode> deallocates space (i.e., creates a hole)  in the byte range "
637 "starting at I<offset> and continuing for I<len> bytes.  Within the specified "
638 "range, partial file system blocks are zeroed, and whole file system blocks "
639 "are removed from the file.  After a successful call, subsequent reads from "
640 "this range will return zeroes."
641 msgstr ""
642
643 #. type: Plain text
644 #: build/C/man2/fallocate.2:105
645 msgid ""
646 "The B<FALLOC_FL_PUNCH_HOLE> flag must be ORed with B<FALLOC_FL_KEEP_SIZE> in "
647 "I<mode>; in other words, even when punching off the end of the file, the "
648 "file size (as reported by B<stat>(2))  does not change."
649 msgstr ""
650
651 #. type: Plain text
652 #: build/C/man2/fallocate.2:109
653 msgid ""
654 "Not all file systems support B<FALLOC_FL_PUNCH_HOLE>; if a file system "
655 "doesn't support the operation, an error is returned."
656 msgstr ""
657
658 #. type: Plain text
659 #: build/C/man2/fallocate.2:112
660 msgid "B<fallocate>()  returns zero on success, and -1 on failure."
661 msgstr ""
662
663 #. type: TP
664 #: build/C/man2/fallocate.2:113 build/C/man2/madvise.2:261 build/C/man2/mmap.2:415 build/C/man2/posix_fadvise.2:90 build/C/man3/posix_fallocate.3:71 build/C/man2/readahead.2:72 build/C/man2/sync_file_range.2:148
665 #, no-wrap
666 msgid "B<EBADF>"
667 msgstr ""
668
669 #. type: Plain text
670 #: build/C/man2/fallocate.2:117 build/C/man3/posix_fallocate.3:75
671 msgid "I<fd> is not a valid file descriptor, or is not opened for writing."
672 msgstr ""
673
674 #. type: TP
675 #: build/C/man2/fallocate.2:117 build/C/man3/posix_fallocate.3:75
676 #, no-wrap
677 msgid "B<EFBIG>"
678 msgstr ""
679
680 #. type: Plain text
681 #: build/C/man2/fallocate.2:121
682 msgid "I<offset>+I<len> exceeds the maximum file size."
683 msgstr ""
684
685 #. type: TP
686 #: build/C/man2/fallocate.2:121
687 #, no-wrap
688 msgid "B<EINTR>"
689 msgstr ""
690
691 #. type: Plain text
692 #: build/C/man2/fallocate.2:124
693 msgid "A signal was caught during execution."
694 msgstr ""
695
696 #. type: Plain text
697 #: build/C/man2/fallocate.2:136 build/C/man3/posix_fallocate.3:85
698 msgid "I<offset> was less than 0, or I<len> was less than or equal to 0."
699 msgstr ""
700
701 #. type: TP
702 #: build/C/man2/fallocate.2:136 build/C/man2/madvise.2:292 build/C/man2/sync_file_range.2:160
703 #, no-wrap
704 msgid "B<EIO>"
705 msgstr ""
706
707 #. type: Plain text
708 #: build/C/man2/fallocate.2:139
709 msgid "An I/O error occurred while reading from or writing to a file system."
710 msgstr ""
711
712 #. type: TP
713 #: build/C/man2/fallocate.2:139 build/C/man2/mmap.2:450 build/C/man3/posix_fallocate.3:85
714 #, no-wrap
715 msgid "B<ENODEV>"
716 msgstr ""
717
718 #. type: Plain text
719 #: build/C/man2/fallocate.2:146
720 msgid ""
721 "I<fd> does not refer to a regular file or a directory.  (If I<fd> is a pipe "
722 "or FIFO, a different error results.)"
723 msgstr ""
724
725 #. type: TP
726 #: build/C/man2/fallocate.2:146 build/C/man3/posix_fallocate.3:89 build/C/man2/shmget.2:214 build/C/man2/sync_file_range.2:166
727 #, no-wrap
728 msgid "B<ENOSPC>"
729 msgstr ""
730
731 #. type: Plain text
732 #: build/C/man2/fallocate.2:151 build/C/man3/posix_fallocate.3:94
733 msgid ""
734 "There is not enough space left on the device containing the file referred to "
735 "by I<fd>."
736 msgstr ""
737
738 #. type: Plain text
739 #: build/C/man2/fallocate.2:156
740 msgid ""
741 "The file system containing the file referred to by I<fd> does not support "
742 "this operation."
743 msgstr ""
744
745 #. type: TP
746 #: build/C/man2/fallocate.2:156
747 #, no-wrap
748 msgid "B<EOPNOTSUPP>"
749 msgstr ""
750
751 #. type: Plain text
752 #: build/C/man2/fallocate.2:162
753 msgid ""
754 "The I<mode> is not supported by the file system containing the file referred "
755 "to by I<fd>."
756 msgstr ""
757
758 #. type: TP
759 #: build/C/man2/fallocate.2:162 build/C/man2/mlock.2:144 build/C/man2/mlock.2:183 build/C/man2/mmap.2:458 build/C/man2/shmctl.2:342 build/C/man2/shmget.2:222
760 #, no-wrap
761 msgid "B<EPERM>"
762 msgstr ""
763
764 #. type: Plain text
765 #: build/C/man2/fallocate.2:178
766 msgid ""
767 "The file referred to by I<fd> is marked immutable (see B<chattr>(1)).  Or: "
768 "I<mode> specifies B<FALLOC_FL_PUNCH_HOLE> and the file referred to by I<fd> "
769 "is marked append-only (see B<chattr>(1))."
770 msgstr ""
771
772 #. type: TP
773 #: build/C/man2/fallocate.2:178 build/C/man2/posix_fadvise.2:96 build/C/man3/posix_fallocate.3:94 build/C/man2/sync_file_range.2:169
774 #, no-wrap
775 msgid "B<ESPIPE>"
776 msgstr ""
777
778 #. type: Plain text
779 #: build/C/man2/fallocate.2:182
780 msgid "I<fd> refers to a pipe or FIFO."
781 msgstr ""
782
783 #. type: SH
784 #: build/C/man2/fallocate.2:182 build/C/man2/mmap2.2:70 build/C/man2/posix_fadvise.2:103 build/C/man3/posix_fallocate.3:98 build/C/man3/posix_memalign.3:165 build/C/man2/readahead.2:82 build/C/man2/remap_file_pages.2:146 build/C/man3/shm_open.3:247 build/C/man2/subpage_prot.2:85 build/C/man2/sync_file_range.2:177
785 #, no-wrap
786 msgid "VERSIONS"
787 msgstr ""
788
789 #. type: Plain text
790 #: build/C/man2/fallocate.2:186
791 msgid ""
792 "B<fallocate>()  is available on Linux since kernel 2.6.23.  Support is "
793 "provided by glibc since version 2.10."
794 msgstr ""
795
796 #. type: Plain text
797 #: build/C/man2/fallocate.2:189
798 msgid "B<fallocate>()  is Linux-specific."
799 msgstr ""
800
801 #. type: Plain text
802 #: build/C/man2/fallocate.2:193
803 msgid "B<ftruncate>(2), B<posix_fadvise>(3), B<posix_fallocate>(3)"
804 msgstr ""
805
806 #. type: TH
807 #: build/C/man2/madvise.2:35
808 #, no-wrap
809 msgid "MADVISE"
810 msgstr ""
811
812 #. type: TH
813 #: build/C/man2/madvise.2:35
814 #, no-wrap
815 msgid "2011-09-18"
816 msgstr ""
817
818 #. type: Plain text
819 #: build/C/man2/madvise.2:38
820 msgid "madvise - give advice about use of memory"
821 msgstr ""
822
823 #. type: Plain text
824 #: build/C/man2/madvise.2:40 build/C/man2/msync.2:30 build/C/man3/shm_open.3:31
825 msgid "B<#include E<lt>sys/mman.hE<gt>>"
826 msgstr ""
827
828 #. type: Plain text
829 #: build/C/man2/madvise.2:42
830 msgid "B<int madvise(void *>I<addr>B<, size_t >I<length>B<, int >I<advice>B<);>"
831 msgstr ""
832
833 #. type: Plain text
834 #: build/C/man2/madvise.2:46 build/C/man2/posix_fadvise.2:42 build/C/man3/posix_fallocate.3:37 build/C/man3/posix_memalign.3:48
835 msgid "Feature Test Macro Requirements for glibc (see B<feature_test_macros>(7)):"
836 msgstr ""
837
838 #. type: Plain text
839 #: build/C/man2/madvise.2:50
840 msgid "B<madvise>(): _BSD_SOURCE"
841 msgstr ""
842
843 #. type: Plain text
844 #: build/C/man2/madvise.2:68
845 msgid ""
846 "The B<madvise>()  system call advises the kernel about how to handle paging "
847 "input/output in the address range beginning at address I<addr> and with size "
848 "I<length> bytes.  It allows an application to tell the kernel how it expects "
849 "to use some mapped or shared memory areas, so that the kernel can choose "
850 "appropriate read-ahead and caching techniques.  This call does not influence "
851 "the semantics of the application (except in the case of B<MADV_DONTNEED>), "
852 "but may influence its performance.  The kernel is free to ignore the advice."
853 msgstr ""
854
855 #. type: Plain text
856 #: build/C/man2/madvise.2:72
857 msgid "The advice is indicated in the I<advice> argument which can be"
858 msgstr ""
859
860 #. type: TP
861 #: build/C/man2/madvise.2:72
862 #, no-wrap
863 msgid "B<MADV_NORMAL>"
864 msgstr ""
865
866 #. type: Plain text
867 #: build/C/man2/madvise.2:76
868 msgid "No special treatment.  This is the default."
869 msgstr ""
870
871 #. type: TP
872 #: build/C/man2/madvise.2:76
873 #, no-wrap
874 msgid "B<MADV_RANDOM>"
875 msgstr ""
876
877 #. type: Plain text
878 #: build/C/man2/madvise.2:80
879 msgid ""
880 "Expect page references in random order.  (Hence, read ahead may be less "
881 "useful than normally.)"
882 msgstr ""
883
884 #. type: TP
885 #: build/C/man2/madvise.2:80
886 #, no-wrap
887 msgid "B<MADV_SEQUENTIAL>"
888 msgstr ""
889
890 #. type: Plain text
891 #: build/C/man2/madvise.2:85
892 msgid ""
893 "Expect page references in sequential order.  (Hence, pages in the given "
894 "range can be aggressively read ahead, and may be freed soon after they are "
895 "accessed.)"
896 msgstr ""
897
898 #. type: TP
899 #: build/C/man2/madvise.2:85
900 #, no-wrap
901 msgid "B<MADV_WILLNEED>"
902 msgstr ""
903
904 #. type: Plain text
905 #: build/C/man2/madvise.2:89
906 msgid ""
907 "Expect access in the near future.  (Hence, it might be a good idea to read "
908 "some pages ahead.)"
909 msgstr ""
910
911 #. type: TP
912 #: build/C/man2/madvise.2:89
913 #, no-wrap
914 msgid "B<MADV_DONTNEED>"
915 msgstr ""
916
917 #. type: Plain text
918 #: build/C/man2/madvise.2:100
919 msgid ""
920 "Do not expect access in the near future.  (For the time being, the "
921 "application is finished with the given range, so the kernel can free "
922 "resources associated with it.)  Subsequent accesses of pages in this range "
923 "will succeed, but will result either in reloading of the memory contents "
924 "from the underlying mapped file (see B<mmap>(2))  or zero-fill-on-demand "
925 "pages for mappings without an underlying file."
926 msgstr ""
927
928 #. type: TP
929 #: build/C/man2/madvise.2:100
930 #, no-wrap
931 msgid "B<MADV_REMOVE> (Since Linux 2.6.16)"
932 msgstr ""
933
934 #.  2.6.18-rc5
935 #.  Databases want to use this feature to drop a section of their
936 #.  bufferpool (shared memory segments) - without writing back to
937 #.  disk/swap space.  This feature is also useful for supporting
938 #.  hot-plug memory on UML.
939 #. type: Plain text
940 #: build/C/man2/madvise.2:113
941 msgid ""
942 "Free up a given range of pages and its associated backing store.  Currently, "
943 "only shmfs/tmpfs supports this; other file systems return with the error "
944 "B<ENOSYS>."
945 msgstr ""
946
947 #. type: TP
948 #: build/C/man2/madvise.2:113
949 #, no-wrap
950 msgid "B<MADV_DONTFORK> (Since Linux 2.6.16)"
951 msgstr ""
952
953 #.  See http://lwn.net/Articles/171941/
954 #.  [PATCH] madvise MADV_DONTFORK/MADV_DOFORK
955 #.  Currently, copy-on-write may change the physical address of
956 #.  a page even if the user requested that the page is pinned in
957 #.  memory (either by mlock or by get_user_pages).  This happens
958 #.  if the process forks meanwhile, and the parent writes to that
959 #.  page.  As a result, the page is orphaned: in case of
960 #.  get_user_pages, the application will never see any data hardware
961 #.  DMA's into this page after the COW.  In case of mlock'd memory,
962 #.  the parent is not getting the realtime/security benefits of mlock.
963 #
964 #.  In particular, this affects the Infiniband modules which do DMA from
965 #.  and into user pages all the time.
966 #
967 #.  This patch adds madvise options to control whether memory range is
968 #.  inherited across fork. Useful e.g. for when hardware is doing DMA
969 #.  from/into these pages.  Could also be useful to an application
970 #.  wanting to speed up its forks by cutting large areas out of
971 #.  consideration.
972 #
973 #.  SEE ALSO: http://lwn.net/Articles/171941/
974 #.  "Tweaks to madvise() and posix_fadvise()", 14 Feb 2006
975 #. type: Plain text
976 #: build/C/man2/madvise.2:144
977 msgid ""
978 "Do not make the pages in this range available to the child after a "
979 "B<fork>(2).  This is useful to prevent copy-on-write semantics from changing "
980 "the physical location of a page(s) if the parent writes to it after a "
981 "B<fork>(2).  (Such page relocations cause problems for hardware that DMAs "
982 "into the page(s).)"
983 msgstr ""
984
985 #. type: TP
986 #: build/C/man2/madvise.2:144
987 #, no-wrap
988 msgid "B<MADV_DOFORK> (Since Linux 2.6.16)"
989 msgstr ""
990
991 #. type: Plain text
992 #: build/C/man2/madvise.2:150
993 msgid ""
994 "Undo the effect of B<MADV_DONTFORK>, restoring the default behavior, whereby "
995 "a mapping is inherited across B<fork>(2)."
996 msgstr ""
997
998 #. type: TP
999 #: build/C/man2/madvise.2:150
1000 #, no-wrap
1001 msgid "B<MADV_HWPOISON> (Since Linux 2.6.32)"
1002 msgstr ""
1003
1004 #. type: Plain text
1005 #: build/C/man2/madvise.2:162
1006 msgid ""
1007 "Poison a page and handle it like a hardware memory corruption.  This "
1008 "operation is only available for privileged (B<CAP_SYS_ADMIN>)  processes.  "
1009 "This operation may result in the calling process receiving a B<SIGBUS> and "
1010 "the page being unmapped.  This feature is intended for testing of memory "
1011 "error-handling code; it is only available if the kernel was configured with "
1012 "B<CONFIG_MEMORY_FAILURE>."
1013 msgstr ""
1014
1015 #. type: TP
1016 #: build/C/man2/madvise.2:162
1017 #, no-wrap
1018 msgid "B<MADV_SOFT_OFFLINE> (Since Linux 2.6.33)"
1019 msgstr ""
1020
1021 #. type: Plain text
1022 #: build/C/man2/madvise.2:180
1023 msgid ""
1024 "Soft offline the pages in the range specified by I<addr> and I<length>.  The "
1025 "memory of each page in the specified range is preserved (i.e., when next "
1026 "accessed, the same content will be visible, but in a new physical page "
1027 "frame), and the original page is offlined (i.e., no longer used, and taken "
1028 "out of normal memory management).  The effect of the B<MADV_SOFT_OFFLINE> "
1029 "operation is invisible to (i.e., does not change the semantics of)  the "
1030 "calling process.  This feature is intended for testing of memory "
1031 "error-handling code; it is only available if the kernel was configured with "
1032 "B<CONFIG_MEMORY_FAILURE>."
1033 msgstr ""
1034
1035 #. type: TP
1036 #: build/C/man2/madvise.2:180
1037 #, no-wrap
1038 msgid "B<MADV_MERGEABLE> (since Linux 2.6.32)"
1039 msgstr ""
1040
1041 #. type: Plain text
1042 #: build/C/man2/madvise.2:205
1043 msgid ""
1044 "Enable Kernel Samepage Merging (KSM) for the pages in the range specified by "
1045 "I<addr> and I<length>.  The kernel regularly scans those areas of user "
1046 "memory that have been marked as mergeable, looking for pages with identical "
1047 "content.  These are replaced by a single write-protected page (which is "
1048 "automatically copied if a process later wants to update the content of the "
1049 "page).  KSM only merges private anonymous pages (see B<mmap>(2)).  The KSM "
1050 "feature is intended for applications that generate many instances of the "
1051 "same data (e.g., virtualization systems such as KVM).  It can consume a lot "
1052 "of processing power; use with care.  See the kernel source file "
1053 "I<Documentation/vm/ksm.txt> for more details.  The B<MADV_MERGEABLE> and "
1054 "B<MADV_UNMERGEABLE> operations are only available if the kernel was "
1055 "configured with B<CONFIG_KSM>."
1056 msgstr ""
1057
1058 #. type: TP
1059 #: build/C/man2/madvise.2:205
1060 #, no-wrap
1061 msgid "B<MADV_UNMERGEABLE> (since Linux 2.6.32)"
1062 msgstr ""
1063
1064 #. type: Plain text
1065 #: build/C/man2/madvise.2:214
1066 msgid ""
1067 "Undo the effect of an earlier B<MADV_MERGEABLE> operation on the specified "
1068 "address range; KSM unmerges whatever pages it had merged in the address "
1069 "range specified by I<addr> and I<length>."
1070 msgstr ""
1071
1072 #. type: TP
1073 #: build/C/man2/madvise.2:214
1074 #, no-wrap
1075 msgid "B<MADV_HUGEPAGE> (since Linux 2.6.38)"
1076 msgstr ""
1077
1078 #.  http://lwn.net/Articles/358904/
1079 #.  https://lwn.net/Articles/423584/
1080 #. type: Plain text
1081 #: build/C/man2/madvise.2:243
1082 msgid ""
1083 "Enables Transparent Huge Pages (THP) for pages in the range specified by "
1084 "I<addr> and I<length>.  Currently, Transparent Huge Pages only work with "
1085 "private anonymous pages (see B<mmap>(2)).  The kernel will regularly scan "
1086 "the areas marked as huge page candidates to replace them with huge pages.  "
1087 "The kernel will also allocate huge pages directly when the region is "
1088 "naturally aligned to the huge page size (see B<posix_memalign>(2)).  This "
1089 "feature is primarily aimed at applications that use large mappings of data "
1090 "and access large regions of that memory at a time (e.g. virtualization "
1091 "systems such as QEMU).  It can very easily waste memory (e.g. a 2MB mapping "
1092 "that only ever accesses 1 byte will result in 2MB of wired memory instead of "
1093 "one 4KB page).  See the kernel source file I<Documentation/vm/transhuge.txt> "
1094 "for more details.  The B<MADV_HUGEPAGE> and B<MADV_NOHUGEPAGE> operations "
1095 "are only available if the kernel was configured with "
1096 "B<CONFIG_TRANSPARENT_HUGEPAGE>."
1097 msgstr ""
1098
1099 #. type: TP
1100 #: build/C/man2/madvise.2:243
1101 #, no-wrap
1102 msgid "B<MADV_NOHUGEPAGE> (since Linux 2.6.38)"
1103 msgstr ""
1104
1105 #. type: Plain text
1106 #: build/C/man2/madvise.2:250
1107 msgid ""
1108 "Ensures that memory in the address range specified by I<addr> and I<length> "
1109 "will not be collapsed into huge pages."
1110 msgstr ""
1111
1112 #. type: Plain text
1113 #: build/C/man2/madvise.2:257
1114 msgid ""
1115 "On success B<madvise>()  returns zero.  On error, it returns -1 and I<errno> "
1116 "is set appropriately."
1117 msgstr ""
1118
1119 #. type: TP
1120 #: build/C/man2/madvise.2:258 build/C/man2/mlock.2:155 build/C/man2/mmap.2:411 build/C/man2/mremap.2:137
1121 #, no-wrap
1122 msgid "B<EAGAIN>"
1123 msgstr ""
1124
1125 #. type: Plain text
1126 #: build/C/man2/madvise.2:261
1127 msgid "A kernel resource was temporarily unavailable."
1128 msgstr ""
1129
1130 #. type: Plain text
1131 #: build/C/man2/madvise.2:264
1132 msgid "The map exists, but the area maps something that isn't a file."
1133 msgstr ""
1134
1135 #. type: Plain text
1136 #: build/C/man2/madvise.2:267
1137 msgid "This error can occur for the following reasons:"
1138 msgstr ""
1139
1140 #. type: IP
1141 #: build/C/man2/madvise.2:268 build/C/man2/madvise.2:274 build/C/man2/madvise.2:277 build/C/man2/madvise.2:280 build/C/man2/madvise.2:283 build/C/man3/mallopt.3:233 build/C/man3/mallopt.3:239
1142 #, no-wrap
1143 msgid "*"
1144 msgstr ""
1145
1146 #.  .I len
1147 #.  is zero,
1148 #. type: Plain text
1149 #: build/C/man2/madvise.2:274
1150 msgid "The value I<len> is negative."
1151 msgstr ""
1152
1153 #. type: Plain text
1154 #: build/C/man2/madvise.2:277
1155 msgid "I<addr> is not page-aligned."
1156 msgstr ""
1157
1158 #. type: Plain text
1159 #: build/C/man2/madvise.2:280
1160 msgid "I<advice> is not a valid value"
1161 msgstr ""
1162
1163 #. type: Plain text
1164 #: build/C/man2/madvise.2:283
1165 msgid ""
1166 "The application is attempting to release locked or shared pages (with "
1167 "B<MADV_DONTNEED>)."
1168 msgstr ""
1169
1170 #. type: Plain text
1171 #: build/C/man2/madvise.2:291
1172 msgid ""
1173 "B<MADV_MERGEABLE> or B<MADV_UNMERGEABLE> was specified in I<advice>, but the "
1174 "kernel was not configured with B<CONFIG_KSM>."
1175 msgstr ""
1176
1177 #. type: Plain text
1178 #: build/C/man2/madvise.2:298
1179 msgid ""
1180 "(for B<MADV_WILLNEED>)  Paging in this area would exceed the process's "
1181 "maximum resident set size."
1182 msgstr ""
1183
1184 #. type: TP
1185 #: build/C/man2/madvise.2:298 build/C/man2/madvise.2:303 build/C/man2/mlock.2:124 build/C/man2/mlock.2:132 build/C/man2/mlock.2:170 build/C/man2/mmap.2:454 build/C/man2/mprotect.2:94 build/C/man2/mprotect.2:97 build/C/man2/mremap.2:180 build/C/man2/msync.2:93 build/C/man3/posix_memalign.3:162 build/C/man2/shmctl.2:326 build/C/man2/shmget.2:211 build/C/man2/shmop.2:209 build/C/man2/subpage_prot.2:82 build/C/man2/sync_file_range.2:163
1186 #, no-wrap
1187 msgid "B<ENOMEM>"
1188 msgstr ""
1189
1190 #. type: Plain text
1191 #: build/C/man2/madvise.2:303
1192 msgid "(for B<MADV_WILLNEED>)  Not enough memory: paging in failed."
1193 msgstr ""
1194
1195 #. type: Plain text
1196 #: build/C/man2/madvise.2:307
1197 msgid ""
1198 "Addresses in the specified range are not currently mapped, or are outside "
1199 "the address space of the process."
1200 msgstr ""
1201
1202 #.  FIXME . Write a posix_fadvise(3) page.
1203 #. type: Plain text
1204 #: build/C/man2/madvise.2:319
1205 msgid ""
1206 "POSIX.1b.  POSIX.1-2001 describes B<posix_madvise>(3)  with constants "
1207 "B<POSIX_MADV_NORMAL>, etc., with a behavior close to that described here.  "
1208 "There is a similar B<posix_fadvise>(2)  for file access."
1209 msgstr ""
1210
1211 #. type: Plain text
1212 #: build/C/man2/madvise.2:328
1213 msgid ""
1214 "B<MADV_REMOVE>, B<MADV_DONTFORK>, B<MADV_DOFORK>, B<MADV_HWPOISON>, "
1215 "B<MADV_MERGEABLE>, and B<MADV_UNMERGEABLE> are Linux-specific."
1216 msgstr ""
1217
1218 #. type: SS
1219 #: build/C/man2/madvise.2:329 build/C/man2/mlock.2:268 build/C/man2/shmget.2:278
1220 #, no-wrap
1221 msgid "Linux Notes"
1222 msgstr ""
1223
1224 #. type: Plain text
1225 #: build/C/man2/madvise.2:337
1226 msgid ""
1227 "The current Linux implementation (2.4.0) views this system call more as a "
1228 "command than as advice and hence may return an error when it cannot do what "
1229 "it usually would do in response to this advice.  (See the ERRORS description "
1230 "above.)  This is nonstandard behavior."
1231 msgstr ""
1232
1233 #.  .SH HISTORY
1234 #.  The
1235 #.  .BR madvise ()
1236 #.  function first appeared in 4.4BSD.
1237 #. type: Plain text
1238 #: build/C/man2/madvise.2:353
1239 msgid ""
1240 "The Linux implementation requires that the address I<addr> be page-aligned, "
1241 "and allows I<length> to be zero.  If there are some parts of the specified "
1242 "address range that are not mapped, the Linux version of B<madvise>()  "
1243 "ignores them and applies the call to the rest (but returns B<ENOMEM> from "
1244 "the system call, as it should)."
1245 msgstr ""
1246
1247 #. type: Plain text
1248 #: build/C/man2/madvise.2:360
1249 msgid ""
1250 "B<getrlimit>(2), B<mincore>(2), B<mmap>(2), B<mprotect>(2), B<msync>(2), "
1251 "B<munmap>(2)"
1252 msgstr ""
1253
1254 #. type: TH
1255 #: build/C/man3/malloc_hook.3:6
1256 #, no-wrap
1257 msgid "MALLOC_HOOK"
1258 msgstr ""
1259
1260 #. type: TH
1261 #: build/C/man3/malloc_hook.3:6
1262 #, no-wrap
1263 msgid "2010-10-13"
1264 msgstr ""
1265
1266 #. type: Plain text
1267 #: build/C/man3/malloc_hook.3:11
1268 msgid ""
1269 "__malloc_hook, __malloc_initialize_hook, __memalign_hook, __free_hook, "
1270 "__realloc_hook, __after_morecore_hook - malloc debugging variables"
1271 msgstr ""
1272
1273 #. type: Plain text
1274 #: build/C/man3/malloc_hook.3:14 build/C/man3/posix_memalign.3:40
1275 #, no-wrap
1276 msgid "B<#include E<lt>malloc.hE<gt>>\n"
1277 msgstr ""
1278
1279 #. type: Plain text
1280 #: build/C/man3/malloc_hook.3:16
1281 #, no-wrap
1282 msgid "B<void *(*__malloc_hook)(size_t >I<size>B<, const void *>I<caller>B<);>\n"
1283 msgstr ""
1284
1285 #. type: Plain text
1286 #: build/C/man3/malloc_hook.3:19
1287 #, no-wrap
1288 msgid ""
1289 "B<void *(*__realloc_hook)(void *>I<ptr>B<, size_t >I<size>B<, const void "
1290 "*>I<caller>B<);>\n"
1291 msgstr ""
1292
1293 #. type: Plain text
1294 #: build/C/man3/malloc_hook.3:22
1295 #, no-wrap
1296 msgid ""
1297 "B<void *(*__memalign_hook)(size_t >I<alignment>B<, size_t >I<size>B<,>\n"
1298 "B<                         const void *>I<caller>B<);>\n"
1299 msgstr ""
1300
1301 #. type: Plain text
1302 #: build/C/man3/malloc_hook.3:24
1303 #, no-wrap
1304 msgid "B<void (*__free_hook)(void *>I<ptr>B<, const void *>I<caller>B<);>\n"
1305 msgstr ""
1306
1307 #. type: Plain text
1308 #: build/C/man3/malloc_hook.3:26
1309 #, no-wrap
1310 msgid "B<void (*__malloc_initialize_hook)(void);>\n"
1311 msgstr ""
1312
1313 #. type: Plain text
1314 #: build/C/man3/malloc_hook.3:28
1315 #, no-wrap
1316 msgid "B<void (*__after_morecore_hook)(void);>\n"
1317 msgstr ""
1318
1319 #. type: Plain text
1320 #: build/C/man3/malloc_hook.3:39
1321 msgid ""
1322 "The GNU C library lets you modify the behavior of B<malloc>(3), "
1323 "B<realloc>(3), and B<free>(3)  by specifying appropriate hook functions.  "
1324 "You can use these hooks to help you debug programs that use dynamic memory "
1325 "allocation, for example."
1326 msgstr ""
1327
1328 #. type: Plain text
1329 #: build/C/man3/malloc_hook.3:46
1330 msgid ""
1331 "The variable B<__malloc_initialize_hook> points at a function that is called "
1332 "once when the malloc implementation is initialized.  This is a weak "
1333 "variable, so it can be overridden in the application with a definition like "
1334 "the following:"
1335 msgstr ""
1336
1337 #. type: Plain text
1338 #: build/C/man3/malloc_hook.3:49
1339 #, no-wrap
1340 msgid "    void (*__malloc_initialize_hook)(void) = my_init_hook;\n"
1341 msgstr ""
1342
1343 #. type: Plain text
1344 #: build/C/man3/malloc_hook.3:54
1345 msgid "Now the function I<my_init_hook>()  can do the initialization of all hooks."
1346 msgstr ""
1347
1348 #. type: Plain text
1349 #: build/C/man3/malloc_hook.3:70
1350 msgid ""
1351 "The four functions pointed to by B<__malloc_hook>, B<__realloc_hook>, "
1352 "B<__memalign_hook>, B<__free_hook> have a prototype like the functions "
1353 "B<malloc>(3), B<realloc>(3), B<memalign>(3), B<free>(3), respectively, "
1354 "except that they have a final argument I<caller> that gives the address of "
1355 "the caller of B<malloc>(3), etc."
1356 msgstr ""
1357
1358 #. type: Plain text
1359 #: build/C/man3/malloc_hook.3:76
1360 msgid ""
1361 "The variable B<__after_morecore_hook> points at a function that is called "
1362 "each time after B<sbrk>(2)  was asked for more memory."
1363 msgstr ""
1364
1365 #. type: Plain text
1366 #: build/C/man3/malloc_hook.3:78 build/C/man3/mtrace.3:78
1367 msgid "These functions are GNU extensions."
1368 msgstr ""
1369
1370 #.  https://bugzilla.redhat.com/show_bug.cgi?id=450187
1371 #.  http://sourceware.org/bugzilla/show_bug.cgi?id=9957
1372 #. type: Plain text
1373 #: build/C/man3/malloc_hook.3:85
1374 msgid ""
1375 "The use of these hook functions is not safe in multithreaded programs, and "
1376 "they are now deprecated.  Programmers should instead preempt calls to the "
1377 "relevant functions by defining and exporting functions such as \"malloc\" "
1378 "and \"free\"."
1379 msgstr ""
1380
1381 #. type: SH
1382 #: build/C/man3/malloc_hook.3:85 build/C/man3/mallopt.3:464 build/C/man2/mmap.2:567 build/C/man2/mprotect.2:142 build/C/man3/mtrace.3:106
1383 #, no-wrap
1384 msgid "EXAMPLE"
1385 msgstr ""
1386
1387 #. type: Plain text
1388 #: build/C/man3/malloc_hook.3:87
1389 msgid "Here is a short example of how to use these variables."
1390 msgstr ""
1391
1392 #. type: Plain text
1393 #: build/C/man3/malloc_hook.3:91
1394 #, no-wrap
1395 msgid ""
1396 "#include E<lt>stdio.hE<gt>\n"
1397 "#include E<lt>malloc.hE<gt>\n"
1398 msgstr ""
1399
1400 #. type: Plain text
1401 #: build/C/man3/malloc_hook.3:95
1402 #, no-wrap
1403 msgid ""
1404 "/* Prototypes for our hooks.  */\n"
1405 "static void my_init_hook(void);\n"
1406 "static void *my_malloc_hook(size_t, const void *);\n"
1407 msgstr ""
1408
1409 #. type: Plain text
1410 #: build/C/man3/malloc_hook.3:98
1411 #, no-wrap
1412 msgid ""
1413 "/* Variables to save original hooks. */\n"
1414 "static void *(*old_malloc_hook)(size_t, const void *);\n"
1415 msgstr ""
1416
1417 #. type: Plain text
1418 #: build/C/man3/malloc_hook.3:101
1419 #, no-wrap
1420 msgid ""
1421 "/* Override initializing hook from the C library. */\n"
1422 "void (*__malloc_initialize_hook) (void) = my_init_hook;\n"
1423 msgstr ""
1424
1425 #. type: Plain text
1426 #: build/C/man3/malloc_hook.3:108
1427 #, no-wrap
1428 msgid ""
1429 "static void\n"
1430 "my_init_hook(void)\n"
1431 "{\n"
1432 "    old_malloc_hook = __malloc_hook;\n"
1433 "    __malloc_hook = my_malloc_hook;\n"
1434 "}\n"
1435 msgstr ""
1436
1437 #. type: Plain text
1438 #: build/C/man3/malloc_hook.3:113
1439 #, no-wrap
1440 msgid ""
1441 "static void *\n"
1442 "my_malloc_hook(size_t size, const void *caller)\n"
1443 "{\n"
1444 "    void *result;\n"
1445 msgstr ""
1446
1447 #. type: Plain text
1448 #: build/C/man3/malloc_hook.3:116
1449 #, no-wrap
1450 msgid ""
1451 "    /* Restore all old hooks */\n"
1452 "    __malloc_hook = old_malloc_hook;\n"
1453 msgstr ""
1454
1455 #. type: Plain text
1456 #: build/C/man3/malloc_hook.3:119
1457 #, no-wrap
1458 msgid ""
1459 "    /* Call recursively */\n"
1460 "    result = malloc(size);\n"
1461 msgstr ""
1462
1463 #. type: Plain text
1464 #: build/C/man3/malloc_hook.3:122
1465 #, no-wrap
1466 msgid ""
1467 "    /* Save underlying hooks */\n"
1468 "    old_malloc_hook = __malloc_hook;\n"
1469 msgstr ""
1470
1471 #. type: Plain text
1472 #: build/C/man3/malloc_hook.3:126
1473 #, no-wrap
1474 msgid ""
1475 "    /* printf() might call malloc(), so protect it too. */\n"
1476 "    printf(\"malloc(%u) called from %p returns %p\\en\",\n"
1477 "            (unsigned int) size, caller, result);\n"
1478 msgstr ""
1479
1480 #. type: Plain text
1481 #: build/C/man3/malloc_hook.3:129
1482 #, no-wrap
1483 msgid ""
1484 "    /* Restore our own hooks */\n"
1485 "    __malloc_hook = my_malloc_hook;\n"
1486 msgstr ""
1487
1488 #. type: Plain text
1489 #: build/C/man3/malloc_hook.3:132
1490 #, no-wrap
1491 msgid ""
1492 "    return result;\n"
1493 "}\n"
1494 msgstr ""
1495
1496 #. type: Plain text
1497 #: build/C/man3/malloc_hook.3:138
1498 msgid "B<mallinfo>(3), B<malloc>(3), B<mcheck>(3), B<mtrace>(3)"
1499 msgstr ""
1500
1501 #. type: TH
1502 #: build/C/man3/mallopt.3:24
1503 #, no-wrap
1504 msgid "MALLOPT"
1505 msgstr ""
1506
1507 #. type: TH
1508 #: build/C/man3/mallopt.3:24 build/C/man3/mtrace.3:23
1509 #, no-wrap
1510 msgid "2012-03-22"
1511 msgstr ""
1512
1513 #. type: Plain text
1514 #: build/C/man3/mallopt.3:27
1515 msgid "mallopt - set memory allocation parameters"
1516 msgstr ""
1517
1518 #. type: Plain text
1519 #: build/C/man3/mallopt.3:29
1520 msgid "B<#include E<lt>malloc.hE<gt>>"
1521 msgstr ""
1522
1523 #. type: Plain text
1524 #: build/C/man3/mallopt.3:31
1525 msgid "B<int mallopt(int >I<param>B<, int >I<value>B<);>"
1526 msgstr ""
1527
1528 #. type: Plain text
1529 #: build/C/man3/mallopt.3:42
1530 msgid ""
1531 "The B<mallopt>()  function adjusts parameters that control the behavior of "
1532 "the memory-allocation functions (see B<malloc>(3)).  The I<param> argument "
1533 "specifies the parameter to be modified, and I<value> specifies the new value "
1534 "for that parameter."
1535 msgstr ""
1536
1537 #. type: Plain text
1538 #: build/C/man3/mallopt.3:45
1539 msgid "The following values can be specified for I<param>:"
1540 msgstr ""
1541
1542 #. type: TP
1543 #: build/C/man3/mallopt.3:45
1544 #, no-wrap
1545 msgid "B<M_CHECK_ACTION>"
1546 msgstr ""
1547
1548 #. type: Plain text
1549 #: build/C/man3/mallopt.3:51
1550 msgid ""
1551 "Setting this parameter controls how glibc responds when various kinds of "
1552 "programming errors are detected (e.g., freeing the same pointer twice).  The "
1553 "3 least significant bits (2, 1, and 0) of the value assigned to this "
1554 "parameter determine the glibc behavior, as follows:"
1555 msgstr ""
1556
1557 #. type: TP
1558 #: build/C/man3/mallopt.3:52
1559 #, no-wrap
1560 msgid "Bit 0"
1561 msgstr ""
1562
1563 #. type: Plain text
1564 #: build/C/man3/mallopt.3:62
1565 msgid ""
1566 "If this bit is set, then print a one-line message on I<stderr> that provides "
1567 "details about the error.  The message starts with the string \"***\\ glibc "
1568 "detected\\ ***\", followed by the program name, the name of the "
1569 "memory-allocation function in which the error was detected, a brief "
1570 "description of the error, and the memory address where the error was "
1571 "detected."
1572 msgstr ""
1573
1574 #. type: TP
1575 #: build/C/man3/mallopt.3:62
1576 #, no-wrap
1577 msgid "Bit 1"
1578 msgstr ""
1579
1580 #. type: Plain text
1581 #: build/C/man3/mallopt.3:77
1582 msgid ""
1583 "If this bit is set, then, after printing any error message specified by bit "
1584 "0, the program is terminated by calling B<abort>(3).  In glibc versions "
1585 "since 2.4, if bit 0 is also set, then, between printing the error message "
1586 "and aborting, the program also prints a stack trace in the manner of "
1587 "B<backtrace>(3), and prints the process's memory mapping in the style of "
1588 "I</proc/[pid]/maps> (see B<proc>(5))."
1589 msgstr ""
1590
1591 #. type: TP
1592 #: build/C/man3/mallopt.3:77
1593 #, no-wrap
1594 msgid "Bit 2 (since glibc 2.4)"
1595 msgstr ""
1596
1597 #. type: Plain text
1598 #: build/C/man3/mallopt.3:84
1599 msgid ""
1600 "This bit has an effect only if bit 0 is also set.  If this bit is set, then "
1601 "the one-line message describing the error is simplified to contain just the "
1602 "name of the function where the error was detected and the brief description "
1603 "of the error."
1604 msgstr ""
1605
1606 #. type: Plain text
1607 #: build/C/man3/mallopt.3:89
1608 msgid "The remaining bits in I<value> are ignored."
1609 msgstr ""
1610
1611 #. type: Plain text
1612 #: build/C/man3/mallopt.3:93
1613 msgid ""
1614 "Combining the above details, the following numeric values are meaningful for "
1615 "B<M_CHECK_ACTION>:"
1616 msgstr ""
1617
1618 #. type: IP
1619 #: build/C/man3/mallopt.3:94
1620 #, no-wrap
1621 msgid "0"
1622 msgstr ""
1623
1624 #. type: Plain text
1625 #: build/C/man3/mallopt.3:96
1626 msgid "Ignore error conditions; continue execution (with undefined results)."
1627 msgstr ""
1628
1629 #. type: IP
1630 #: build/C/man3/mallopt.3:96
1631 #, no-wrap
1632 msgid "1"
1633 msgstr ""
1634
1635 #. type: Plain text
1636 #: build/C/man3/mallopt.3:98
1637 msgid "Print a detailed error message and continue execution."
1638 msgstr ""
1639
1640 #. type: IP
1641 #: build/C/man3/mallopt.3:98
1642 #, no-wrap
1643 msgid "2"
1644 msgstr ""
1645
1646 #. type: Plain text
1647 #: build/C/man3/mallopt.3:100
1648 msgid "Abort the program."
1649 msgstr ""
1650
1651 #. type: IP
1652 #: build/C/man3/mallopt.3:100
1653 #, no-wrap
1654 msgid "3"
1655 msgstr ""
1656
1657 #. type: Plain text
1658 #: build/C/man3/mallopt.3:103
1659 msgid ""
1660 "Print detailed error message, stack trace, and memory mappings, and abort "
1661 "the program."
1662 msgstr ""
1663
1664 #. type: IP
1665 #: build/C/man3/mallopt.3:103
1666 #, no-wrap
1667 msgid "5"
1668 msgstr ""
1669
1670 #. type: Plain text
1671 #: build/C/man3/mallopt.3:105
1672 msgid "Print a simple error message and continue execution."
1673 msgstr ""
1674
1675 #. type: IP
1676 #: build/C/man3/mallopt.3:105
1677 #, no-wrap
1678 msgid "7"
1679 msgstr ""
1680
1681 #. type: Plain text
1682 #: build/C/man3/mallopt.3:108
1683 msgid ""
1684 "Print simple error message, stack trace, and memory mappings, and abort the "
1685 "program."
1686 msgstr ""
1687
1688 #. type: Plain text
1689 #: build/C/man3/mallopt.3:114
1690 msgid ""
1691 "Since glibc 2.3.4, the default value for the B<M_CHECK_ACTION> parameter is "
1692 "3.  In glibc version 2.3.3 and earlier, the default value is 1."
1693 msgstr ""
1694
1695 #. type: Plain text
1696 #: build/C/man3/mallopt.3:119
1697 msgid ""
1698 "Using a nonzero B<M_CHECK_ACTION> value can be useful because otherwise a "
1699 "crash may happen much later, and the true cause of the problem is then very "
1700 "hard to track down."
1701 msgstr ""
1702
1703 #. type: TP
1704 #: build/C/man3/mallopt.3:119
1705 #, no-wrap
1706 msgid "B<M_MMAP_MAX>"
1707 msgstr ""
1708
1709 #.  The following text adapted from comments in the glibc source:
1710 #. type: Plain text
1711 #: build/C/man3/mallopt.3:129
1712 msgid ""
1713 "This parameter specifies the maximum number of allocation requests that may "
1714 "be simultaneously serviced using B<mmap>(2).  This parameter exists because "
1715 "some systems have a limited number of internal tables for use by B<mmap>(2), "
1716 "and using more than a few of them may degrade performance."
1717 msgstr ""
1718
1719 #. type: Plain text
1720 #: build/C/man3/mallopt.3:136
1721 msgid ""
1722 "The default value is 65,536, a value which has no special significance and "
1723 "which servers only as a safeguard.  Setting this parameter to 0 disables the "
1724 "use of B<mmap>(2)  for servicing large allocation requests."
1725 msgstr ""
1726
1727 #. type: TP
1728 #: build/C/man3/mallopt.3:136
1729 #, no-wrap
1730 msgid "B<M_MMAP_THRESHOLD>"
1731 msgstr ""
1732
1733 #. type: Plain text
1734 #: build/C/man3/mallopt.3:145
1735 msgid ""
1736 "For allocations greater than or equal to the limit specified (in bytes) by "
1737 "B<M_MMAP_THRESHOLD> that can't be satisfied from the free list, the "
1738 "memory-allocation functions employ B<mmap>(2)  instead of increasing the "
1739 "program break using B<sbrk>(2)."
1740 msgstr ""
1741
1742 #. type: Plain text
1743 #: build/C/man3/mallopt.3:165
1744 msgid ""
1745 "Allocating memory using B<mmap>(2)  has the significant advantage that the "
1746 "allocated memory blocks can always be independently released back to the "
1747 "system.  (By contrast, the heap can be trimmed only if memory is freed at "
1748 "the top end.)  On the other hand, there are some disadvantages to the use of "
1749 "B<mmap>(2): deallocated space is not placed on the free list for reuse by "
1750 "later allocations; memory may be wasted because B<mmap>(2)  allocations must "
1751 "be page-aligned; and the kernel must perform the expensive task of zeroing "
1752 "out memory allocated via B<mmap>(2).  Balancing these factors leads to a "
1753 "default setting of 128*1024 for the B<M_MMAP_THRESHOLD> parameter."
1754 msgstr ""
1755
1756 #. type: Plain text
1757 #: build/C/man3/mallopt.3:172
1758 msgid ""
1759 "The lower limit for this parameter is 0.  The upper limit is "
1760 "B<DEFAULT_MMAP_THRESHOLD_MAX>: 512*1024 on 32-bit systems or "
1761 "I<4*1024*1024*sizeof(long)> on 64-bit systems."
1762 msgstr ""
1763
1764 #. type: Plain text
1765 #: build/C/man3/mallopt.3:190
1766 msgid ""
1767 "I<Note:> Nowadays, glibc uses a dynamic mmap threshold by default.  The "
1768 "initial value of the threshold is 128*1024, but when blocks larger than the "
1769 "current threshold and less than or equal to B<DEFAULT_MMAP_THRESHOLD_MAX> "
1770 "are freed, the threshold is adjusted upwards to the size of the freed "
1771 "block.  When dynamic mmap thresholding is in effect, the threshold for "
1772 "trimming the heap is also dynamically adjusted to be twice the dynamic mmap "
1773 "threshold.  Dynamic adjustment of the mmap threshold is disabled if any of "
1774 "the B<M_TRIM_THRESHOLD>, B<M_TOP_PAD>, B<M_MMAP_THRESHOLD>, or B<M_MMAP_MAX> "
1775 "parameters is set."
1776 msgstr ""
1777
1778 #. type: TP
1779 #: build/C/man3/mallopt.3:190
1780 #, no-wrap
1781 msgid "B<M_MXFAST> (since glibc 2.3)"
1782 msgstr ""
1783
1784 #.  The following text adapted from comments in the glibc sources:
1785 #. type: Plain text
1786 #: build/C/man3/mallopt.3:210
1787 msgid ""
1788 "Set the upper limit for memory allocation requests that are satisfied using "
1789 "\"fastbins\".  (The measurement unit for this parameter is bytes.)  Fastbins "
1790 "are storage areas that hold deallocated blocks of memory of the same size "
1791 "without merging adjacent free blocks.  Subsequent reallocation of blocks of "
1792 "the same size can be handled very quickly by allocating from the fastbin, "
1793 "although memory fragmentation and the overall memory footprint of the "
1794 "program can increase.  The default value for this parameter is "
1795 "I<64*sizeof(size_t)/4> (i.e., 64 on 32-bit architectures).  The range for "
1796 "this parameter is 0 to I<80*sizeof(size_t)/4>.  Setting B<M_MXFAST> to 0 "
1797 "disables the use of fastbins."
1798 msgstr ""
1799
1800 #. type: TP
1801 #: build/C/man3/mallopt.3:210
1802 #, no-wrap
1803 msgid "B<M_PERTURB> (since glibc 2.4)"
1804 msgstr ""
1805
1806 #. type: Plain text
1807 #: build/C/man3/mallopt.3:225
1808 msgid ""
1809 "If this parameter is set to a nonzero value, then bytes of allocated memory "
1810 "(other than allocations via B<calloc>(3))  are initialized to the complement "
1811 "of the value in the least significant byte of I<value>, and when allocated "
1812 "memory is released using B<free>(3), the freed bytes are ANded with the "
1813 "value in the least significant byte of I<value>.  This can be useful for "
1814 "detecting errors where programs incorrectly rely on allocated memory being "
1815 "initialized to zero, or reuse values in memory that has already been freed."
1816 msgstr ""
1817
1818 #. type: TP
1819 #: build/C/man3/mallopt.3:225
1820 #, no-wrap
1821 msgid "B<M_TOP_PAD>"
1822 msgstr ""
1823
1824 #. type: Plain text
1825 #: build/C/man3/mallopt.3:232
1826 msgid ""
1827 "This parameter defines the amount of padding to employ when calling "
1828 "B<sbrk>(2)  to modify the program break.  (The measurement unit for this "
1829 "parameter is bytes.)  This parameter has an effect in the following "
1830 "circumstances:"
1831 msgstr ""
1832
1833 #. type: Plain text
1834 #: build/C/man3/mallopt.3:239
1835 msgid ""
1836 "When the program break is increased, then B<M_TOP_PAD> bytes are added to "
1837 "the B<sbrk>(2)  request."
1838 msgstr ""
1839
1840 #. type: Plain text
1841 #: build/C/man3/mallopt.3:245
1842 msgid ""
1843 "When the heap is trimmed as a consequence of calling B<free>(3)  (see the "
1844 "discussion of B<M_TRIM_THRESHOLD>)  this much free space is preserved at the "
1845 "top of the heap."
1846 msgstr ""
1847
1848 #. type: Plain text
1849 #: build/C/man3/mallopt.3:249
1850 msgid ""
1851 "In either case, the amount of padding is always rounded to a system page "
1852 "boundary."
1853 msgstr ""
1854
1855 #. type: Plain text
1856 #: build/C/man3/mallopt.3:256
1857 msgid ""
1858 "Modifying B<M_TOP_PAD> is a trade-off between increasing the number of "
1859 "system calls (when the parameter is set low)  and wasting unused memory at "
1860 "the top of the heap (when the parameter is set high)."
1861 msgstr ""
1862
1863 #.  DEFAULT_TOP_PAD in glibc source
1864 #. type: Plain text
1865 #: build/C/man3/mallopt.3:259
1866 msgid "The default value for this parameter is 128*1024."
1867 msgstr ""
1868
1869 #. type: TP
1870 #: build/C/man3/mallopt.3:259
1871 #, no-wrap
1872 msgid "B<M_TRIM_THRESHOLD>"
1873 msgstr ""
1874
1875 #. type: Plain text
1876 #: build/C/man3/mallopt.3:275
1877 msgid ""
1878 "When the amount of contiguous free memory at the top of the heap grows "
1879 "sufficiently large, B<free>(3)  employs B<sbrk>(2)  to release this memory "
1880 "back to the system.  (This can be useful in programs that continue to "
1881 "execute for a long period after freeing a significant amount of memory.)  "
1882 "The B<M_TRIM_THRESHOLD> parameter specifies the minimum size (in bytes) that "
1883 "this block of memory must reach before B<sbrk>(2)  is used to trim the heap."
1884 msgstr ""
1885
1886 #. type: Plain text
1887 #: build/C/man3/mallopt.3:280
1888 msgid ""
1889 "The default value for this parameter is 128*1024.  Setting "
1890 "B<M_TRIM_THRESHOLD> to -1 disables trimming completely."
1891 msgstr ""
1892
1893 #.  FIXME Do the arena parameters need to be documented?
1894 #.  .TP
1895 #.  .BR M_ARENA_TEST " (since glibc 2.10)"
1896 #.  .TP
1897 #.  .BR M_ARENA_MAX " (since glibc 2.10)"
1898 #
1899 #.  Environment variables
1900 #.      MALLOC_ARENA_MAX_
1901 #.      MALLOC_ARENA_TEST_
1902 #
1903 #.  http://udrepper.livejournal.com/20948.html describes some details
1904 #.      of the MALLOC_ARENA_* environment variables.
1905 #
1906 #.  These macros aren't enabled in production releases until 2.15?
1907 #.  (see glibc malloc/Makefile)
1908 #. type: Plain text
1909 #: build/C/man3/mallopt.3:303
1910 msgid ""
1911 "Modifying B<M_TRIM_THRESHOLD> is a trade-off between increasing the number "
1912 "of system calls (when the parameter is set low)  and wasting unused memory "
1913 "at the top of the heap (when the parameter is set high)."
1914 msgstr ""
1915
1916 #. type: SS
1917 #: build/C/man3/mallopt.3:303
1918 #, no-wrap
1919 msgid "Environment Variables"
1920 msgstr ""
1921
1922 #. type: Plain text
1923 #: build/C/man3/mallopt.3:318
1924 msgid ""
1925 "A number of environment variables can be defined to modify some of the same "
1926 "parameters as are controlled by B<mallopt>().  Using these variables has the "
1927 "advantage that the source code of the program need not be changed.  To be "
1928 "effective, these variables must be defined before the first call to a "
1929 "memory-allocation function.  (If the same parameters are adjusted via "
1930 "B<mallopt>()  then the B<mallopt>()  settings take precedence.)  For "
1931 "security reasons, these variables are ignored in set-user-ID and "
1932 "set-group-ID programs."
1933 msgstr ""
1934
1935 #. type: Plain text
1936 #: build/C/man3/mallopt.3:321
1937 msgid ""
1938 "The environment variables are as follows (note the trailing underscore at "
1939 "the end of the name of each variable):"
1940 msgstr ""
1941
1942 #. type: TP
1943 #: build/C/man3/mallopt.3:321
1944 #, no-wrap
1945 msgid "B<MALLOC_CHECK_>"
1946 msgstr ""
1947
1948 #.  On glibc 2.12/x86, a simple malloc()+free() loop is about 70% slower
1949 #.  when MALLOC_CHECK_ was set.
1950 #. type: Plain text
1951 #: build/C/man3/mallopt.3:338
1952 msgid ""
1953 "This environment variable controls the same parameter as B<mallopt>()  "
1954 "B<M_CHECK_ACTION>.  If this variable is set to a nonzero value, then a "
1955 "special implementation of the memory-allocation functions is used.  (This is "
1956 "accomplished using the B<malloc_hook>(3)  feature.)  This implementation "
1957 "performs additional error checking, but is slower than the standard set of "
1958 "memory-allocation functions.  (This implementation does not detect all "
1959 "possible errors; memory leaks can still occur.)"
1960 msgstr ""
1961
1962 #. type: Plain text
1963 #: build/C/man3/mallopt.3:343
1964 msgid ""
1965 "The value assigned to this environment variable should be a single digit, "
1966 "whose meaning is as described for B<M_CHECK_ACTION>.  Any characters beyond "
1967 "the initial digit are ignored."
1968 msgstr ""
1969
1970 #. type: Plain text
1971 #: build/C/man3/mallopt.3:352
1972 msgid ""
1973 "For security reasons, the effect of B<MALLOC_CHECK_> is disabled by default "
1974 "for set-user-ID and set-group-ID programs.  However, if the file "
1975 "I</etc/suid-debug> exists (the content of the file is irrelevant), then "
1976 "B<MALLOC_CHECK_> also has an effect for set-user-ID and set-group-ID "
1977 "programs."
1978 msgstr ""
1979
1980 #. type: TP
1981 #: build/C/man3/mallopt.3:352
1982 #, no-wrap
1983 msgid "B<MALLOC_MMAP_MAX_>"
1984 msgstr ""
1985
1986 #. type: Plain text
1987 #: build/C/man3/mallopt.3:357
1988 msgid "Controls the same parameter as B<mallopt>()  B<M_MMAP_MAX>."
1989 msgstr ""
1990
1991 #. type: TP
1992 #: build/C/man3/mallopt.3:357
1993 #, no-wrap
1994 msgid "B<MALLOC_MMAP_THRESHOLD_>"
1995 msgstr ""
1996
1997 #. type: Plain text
1998 #: build/C/man3/mallopt.3:362
1999 msgid "Controls the same parameter as B<mallopt>()  B<M_MMAP_THRESHOLD>."
2000 msgstr ""
2001
2002 #. type: TP
2003 #: build/C/man3/mallopt.3:362
2004 #, no-wrap
2005 msgid "B<MALLOC_PERTURB_>"
2006 msgstr ""
2007
2008 #. type: Plain text
2009 #: build/C/man3/mallopt.3:367
2010 msgid "Controls the same parameter as B<mallopt>()  B<M_PERTURB>."
2011 msgstr ""
2012
2013 #. type: TP
2014 #: build/C/man3/mallopt.3:367
2015 #, no-wrap
2016 msgid "B<MALLOC_TRIM_THRESHOLD_>"
2017 msgstr ""
2018
2019 #. type: Plain text
2020 #: build/C/man3/mallopt.3:372
2021 msgid "Controls the same parameter as B<mallopt>()  B<M_TRIM_THRESHOLD>."
2022 msgstr ""
2023
2024 #. type: TP
2025 #: build/C/man3/mallopt.3:372
2026 #, no-wrap
2027 msgid "B<MALLOC_TOP_PAD_>"
2028 msgstr ""
2029
2030 #. type: Plain text
2031 #: build/C/man3/mallopt.3:377
2032 msgid "Controls the same parameter as B<mallopt>()  B<M_TOP_PAD>."
2033 msgstr ""
2034
2035 #. type: Plain text
2036 #: build/C/man3/mallopt.3:382
2037 msgid "On success, B<mallopt>()  returns 1.  On error, it returns 0."
2038 msgstr ""
2039
2040 #.  .SH VERSIONS
2041 #.  Available already in glibc 2.0, possibly earlier
2042 #. type: Plain text
2043 #: build/C/man3/mallopt.3:390
2044 msgid "On error, I<errno> is I<not> set."
2045 msgstr ""
2046
2047 #.  .SH NOTES
2048 #. type: Plain text
2049 #: build/C/man3/mallopt.3:404
2050 msgid ""
2051 "This function is not specified by POSIX or the C standards.  A similar "
2052 "function exists on many System V derivatives, but the range of values for "
2053 "I<param> varies across systems.  The SVID defined options B<M_MXFAST>, "
2054 "B<M_NLBLKS>, B<M_GRAIN>, and B<M_KEEP>, but only the first of these is "
2055 "implemented in glibc."
2056 msgstr ""
2057
2058 #. type: Plain text
2059 #: build/C/man3/mallopt.3:408
2060 msgid "Specifying an invalid value for I<param> does not generate an error."
2061 msgstr ""
2062
2063 #.  FIXME This looks buggy:
2064 #.  setting the M_MXFAST limit rounds up:    (s + SIZE_SZ) & ~MALLOC_ALIGN_MASK)
2065 #.  malloc requests are rounded up:
2066 #.     (req) + SIZE_SZ + MALLOC_ALIGN_MASK) & ~MALLOC_ALIGN_MASK
2067 #.  http://sources.redhat.com/bugzilla/show_bug.cgi?id=12129
2068 #. type: Plain text
2069 #: build/C/man3/mallopt.3:416
2070 msgid ""
2071 "A calculation error within the glibc implementation means that a call of the "
2072 "form:"
2073 msgstr ""
2074
2075 #. type: Plain text
2076 #: build/C/man3/mallopt.3:419
2077 #, no-wrap
2078 msgid "    mallopt(M_MXFAST, n)\n"
2079 msgstr ""
2080
2081 #.  Bins are multiples of 2 * sizeof(size_t) + sizeof(size_t)
2082 #. type: Plain text
2083 #: build/C/man3/mallopt.3:431
2084 msgid ""
2085 "does not result in fastbins being employed for all allocations of size up to "
2086 "I<n>.  To ensure desired results, I<n> should be rounded up to the next "
2087 "multiple greater than or equal to I<(2k+1)*sizeof(size_t)>, where I<k> is an "
2088 "integer."
2089 msgstr ""
2090
2091 #.  FIXME MALLOC_MMAP_THRESHOLD_ and MALLOC_MMAP_MAX_
2092 #.  do have an effect for set-user-ID programs (but not
2093 #.  set-group-ID programs).
2094 #.  http://sources.redhat.com/bugzilla/show_bug.cgi?id=12155
2095 #. type: Plain text
2096 #: build/C/man3/mallopt.3:443
2097 msgid ""
2098 "The B<MALLOC_MMAP_THRESHOLD_> and B<MALLOC_MMAP_MAX_> variables are I<not> "
2099 "ignored in set-group-ID programs."
2100 msgstr ""
2101
2102 #.  FIXME http://sources.redhat.com/bugzilla/show_bug.cgi?id=12140
2103 #. type: Plain text
2104 #: build/C/man3/mallopt.3:464
2105 msgid ""
2106 "If B<mallopt>()  is used to set B<M_PERTURB>, then, as expected, the bytes "
2107 "of allocated memory are initialized to the complement of the byte in "
2108 "I<value>, and when that memory is freed, the bytes of the region are "
2109 "initialized to the byte specified in I<value>.  However, there is an "
2110 "off-by-I<sizeof(size_t)> error in the implementation: instead of "
2111 "initializing precisely the block of memory being freed by the call "
2112 "I<free(p)>, the block starting at I<p+sizeof(size_t)> is initialized."
2113 msgstr ""
2114
2115 #. type: Plain text
2116 #: build/C/man3/mallopt.3:473
2117 msgid ""
2118 "The program below demonstrates the use of B<M_CHECK_ACTION>.  If the program "
2119 "is supplied with an (integer) command-line argument, then that argument is "
2120 "used to set the B<M_CHECK_ACTION> parameter.  The program then allocates a "
2121 "block of memory, and frees it twice (an error)."
2122 msgstr ""
2123
2124 #. type: Plain text
2125 #: build/C/man3/mallopt.3:477
2126 msgid ""
2127 "The following shell session shows what happens when we run this program "
2128 "under glibc, with the default value for B<M_CHECK_ACTION>:"
2129 msgstr ""
2130
2131 #. type: Plain text
2132 #: build/C/man3/mallopt.3:496
2133 #, no-wrap
2134 msgid ""
2135 "$ B<./a.out>\n"
2136 "*** glibc detected *** ./a.out: double free or corruption (top): 0x09d30008 "
2137 "***\n"
2138 "======= Backtrace: =========\n"
2139 "/lib/libc.so.6(+0x6c501)[0x523501]\n"
2140 "/lib/libc.so.6(+0x6dd70)[0x524d70]\n"
2141 "/lib/libc.so.6(cfree+0x6d)[0x527e5d]\n"
2142 "\\&./a.out[0x80485db]\n"
2143 "/lib/libc.so.6(__libc_start_main+0xe7)[0x4cdce7]\n"
2144 "\\&./a.out[0x8048471]\n"
2145 "======= Memory map: ========\n"
2146 "001e4000-001fe000 r-xp 00000000 08:06 1083555    /lib/libgcc_s.so.1\n"
2147 "001fe000-001ff000 r--p 00019000 08:06 1083555    /lib/libgcc_s.so.1\n"
2148 "[some lines omitted]\n"
2149 "b7814000-b7817000 rw-p 00000000 00:00 0\n"
2150 "bff53000-bff74000 rw-p 00000000 00:00 0          [stack]\n"
2151 "Aborted (core dumped)\n"
2152 msgstr ""
2153
2154 #. type: Plain text
2155 #: build/C/man3/mallopt.3:501
2156 msgid ""
2157 "The following runs show the results when employing other values for "
2158 "B<M_CHECK_ACTION:>"
2159 msgstr ""
2160
2161 #. type: Plain text
2162 #: build/C/man3/mallopt.3:514
2163 #, no-wrap
2164 msgid ""
2165 "$ B<./a.out 1>             # Diagnose error and continue\n"
2166 "main(): returned from first free() call\n"
2167 "*** glibc detected *** ./a.out: double free or corruption (top): 0x09cbe008 "
2168 "***\n"
2169 "main(): returned from second free() call\n"
2170 "$ B<./a.out 2>             # Abort without error message\n"
2171 "main(): returned from first free() call\n"
2172 "Aborted (core dumped)\n"
2173 "$ B<./a.out 0>             # Ignore error and continue\n"
2174 "main(): returned from first free() call\n"
2175 "main(): returned from second free() call\n"
2176 msgstr ""
2177
2178 #. type: Plain text
2179 #: build/C/man3/mallopt.3:520
2180 msgid ""
2181 "The next run shows how to set the same parameter using the B<MALLOC_CHECK_> "
2182 "environment variable:"
2183 msgstr ""
2184
2185 #. type: Plain text
2186 #: build/C/man3/mallopt.3:527
2187 #, no-wrap
2188 msgid ""
2189 "$ B<MALLOC_CHECK_=1 ./a.out>\n"
2190 "main(): returned from first free() call\n"
2191 "*** glibc detected *** ./a.out: free(): invalid pointer: 0x092c2008 ***\n"
2192 "main(): returned from second free() call\n"
2193 msgstr ""
2194
2195 #. type: SS
2196 #: build/C/man3/mallopt.3:529 build/C/man2/mprotect.2:159
2197 #, no-wrap
2198 msgid "Program source"
2199 msgstr ""
2200
2201 #. type: Plain text
2202 #: build/C/man3/mallopt.3:535
2203 #, no-wrap
2204 msgid ""
2205 "#include E<lt>malloc.hE<gt>\n"
2206 "#include E<lt>stdio.hE<gt>\n"
2207 "#include E<lt>stdlib.hE<gt>\n"
2208 msgstr ""
2209
2210 #. type: Plain text
2211 #: build/C/man3/mallopt.3:540
2212 #, no-wrap
2213 msgid ""
2214 "int\n"
2215 "main(int argc, char *argv[])\n"
2216 "{\n"
2217 "    char *p;\n"
2218 msgstr ""
2219
2220 #. type: Plain text
2221 #: build/C/man3/mallopt.3:547
2222 #, no-wrap
2223 msgid ""
2224 "    if (argc E<gt> 1) {\n"
2225 "        if (argc != 2) {\n"
2226 "            fprintf(stderr, \"%s E<lt>M_CHECK_ACTION-valueE<gt>\\en\", "
2227 "argv[0]);\n"
2228 "            exit(EXIT_FAILURE);\n"
2229 "        }\n"
2230 "    }\n"
2231 msgstr ""
2232
2233 #. type: Plain text
2234 #: build/C/man3/mallopt.3:552
2235 #, no-wrap
2236 msgid ""
2237 "    if (mallopt(M_CHECK_ACTION, atoi(argv[1])) != 1) {\n"
2238 "        fprintf(stderr, \"mallopt() failed\");\n"
2239 "        exit(EXIT_FAILURE);\n"
2240 "    }\n"
2241 msgstr ""
2242
2243 #. type: Plain text
2244 #: build/C/man3/mallopt.3:558
2245 #, no-wrap
2246 msgid ""
2247 "    p = malloc(1000);\n"
2248 "    if (p == NULL) {\n"
2249 "        fprintf(stderr, \"malloc() failed\");\n"
2250 "        exit(EXIT_FAILURE);\n"
2251 "    }\n"
2252 msgstr ""
2253
2254 #. type: Plain text
2255 #: build/C/man3/mallopt.3:561
2256 #, no-wrap
2257 msgid ""
2258 "    free(p);\n"
2259 "    printf(\"main(): returned from first free() call\\en\");\n"
2260 msgstr ""
2261
2262 #. type: Plain text
2263 #: build/C/man3/mallopt.3:564
2264 #, no-wrap
2265 msgid ""
2266 "    free(p);\n"
2267 "    printf(\"main(): returned from second free() call\\en\");\n"
2268 msgstr ""
2269
2270 #. type: Plain text
2271 #: build/C/man3/mallopt.3:567 build/C/man2/mmap.2:648
2272 #, no-wrap
2273 msgid ""
2274 "    exit(EXIT_SUCCESS);\n"
2275 "}\n"
2276 msgstr ""
2277
2278 #. type: Plain text
2279 #: build/C/man3/mallopt.3:578
2280 msgid ""
2281 "B<mmap>(2)  B<sbrk>(2), B<mallinfo>(3), B<malloc>(3), B<malloc_hook>(3), "
2282 "B<mtrace>(3), B<posix_memalign>(3)"
2283 msgstr ""
2284
2285 #. type: TH
2286 #: build/C/man2/mlock.2:27
2287 #, no-wrap
2288 msgid "MLOCK"
2289 msgstr ""
2290
2291 #. type: TH
2292 #: build/C/man2/mlock.2:27
2293 #, no-wrap
2294 msgid "2011-09-14"
2295 msgstr ""
2296
2297 #. type: Plain text
2298 #: build/C/man2/mlock.2:30
2299 msgid "mlock, munlock, mlockall, munlockall - lock and unlock memory"
2300 msgstr ""
2301
2302 #. type: Plain text
2303 #: build/C/man2/mlock.2:33 build/C/man2/mmap.2:46 build/C/man2/mmap2.2:35 build/C/man2/mprotect.2:38 build/C/man2/mremap.2:39
2304 #, no-wrap
2305 msgid "B<#include E<lt>sys/mman.hE<gt>>\n"
2306 msgstr ""
2307
2308 #. type: Plain text
2309 #: build/C/man2/mlock.2:36
2310 #, no-wrap
2311 msgid ""
2312 "B<int mlock(const void *>I<addr>B<, size_t >I<len>B<);>\n"
2313 "B<int munlock(const void *>I<addr>B<, size_t >I<len>B<);>\n"
2314 msgstr ""
2315
2316 #. type: Plain text
2317 #: build/C/man2/mlock.2:39
2318 #, no-wrap
2319 msgid ""
2320 "B<int mlockall(int >I<flags>B<);>\n"
2321 "B<int munlockall(void);>\n"
2322 msgstr ""
2323
2324 #. type: Plain text
2325 #: build/C/man2/mlock.2:55
2326 msgid ""
2327 "B<mlock>()  and B<mlockall>()  respectively lock part or all of the calling "
2328 "process's virtual address space into RAM, preventing that memory from being "
2329 "paged to the swap area.  B<munlock>()  and B<munlockall>()  perform the "
2330 "converse operation, respectively unlocking part or all of the calling "
2331 "process's virtual address space, so that pages in the specified virtual "
2332 "address range may once more to be swapped out if required by the kernel "
2333 "memory manager.  Memory locking and unlocking are performed in units of "
2334 "whole pages."
2335 msgstr ""
2336
2337 #. type: SS
2338 #: build/C/man2/mlock.2:55
2339 #, no-wrap
2340 msgid "mlock() and munlock()"
2341 msgstr ""
2342
2343 #. type: Plain text
2344 #: build/C/man2/mlock.2:65
2345 msgid ""
2346 "B<mlock>()  locks pages in the address range starting at I<addr> and "
2347 "continuing for I<len> bytes.  All pages that contain a part of the specified "
2348 "address range are guaranteed to be resident in RAM when the call returns "
2349 "successfully; the pages are guaranteed to stay in RAM until later unlocked."
2350 msgstr ""
2351
2352 #. type: Plain text
2353 #: build/C/man2/mlock.2:74
2354 msgid ""
2355 "B<munlock>()  unlocks pages in the address range starting at I<addr> and "
2356 "continuing for I<len> bytes.  After this call, all pages that contain a part "
2357 "of the specified memory range can be moved to external swap space again by "
2358 "the kernel."
2359 msgstr ""
2360
2361 #. type: SS
2362 #: build/C/man2/mlock.2:74
2363 #, no-wrap
2364 msgid "mlockall() and munlockall()"
2365 msgstr ""
2366
2367 #. type: Plain text
2368 #: build/C/man2/mlock.2:84
2369 msgid ""
2370 "B<mlockall>()  locks all pages mapped into the address space of the calling "
2371 "process.  This includes the pages of the code, data and stack segment, as "
2372 "well as shared libraries, user space kernel data, shared memory, and "
2373 "memory-mapped files.  All mapped pages are guaranteed to be resident in RAM "
2374 "when the call returns successfully; the pages are guaranteed to stay in RAM "
2375 "until later unlocked."
2376 msgstr ""
2377
2378 #. type: Plain text
2379 #: build/C/man2/mlock.2:89
2380 msgid ""
2381 "The I<flags> argument is constructed as the bitwise OR of one or more of the "
2382 "following constants:"
2383 msgstr ""
2384
2385 #. type: TP
2386 #: build/C/man2/mlock.2:89
2387 #, no-wrap
2388 msgid "B<MCL_CURRENT>"
2389 msgstr ""
2390
2391 #. type: Plain text
2392 #: build/C/man2/mlock.2:93
2393 msgid ""
2394 "Lock all pages which are currently mapped into the address space of the "
2395 "process."
2396 msgstr ""
2397
2398 #. type: TP
2399 #: build/C/man2/mlock.2:93
2400 #, no-wrap
2401 msgid "B<MCL_FUTURE>"
2402 msgstr ""
2403
2404 #. type: Plain text
2405 #: build/C/man2/mlock.2:100
2406 msgid ""
2407 "Lock all pages which will become mapped into the address space of the "
2408 "process in the future.  These could be for instance new pages required by a "
2409 "growing heap and stack as well as new memory mapped files or shared memory "
2410 "regions."
2411 msgstr ""
2412
2413 #. type: Plain text
2414 #: build/C/man2/mlock.2:113
2415 msgid ""
2416 "If B<MCL_FUTURE> has been specified, then a later system call (e.g., "
2417 "B<mmap>(2), B<sbrk>(2), B<malloc>(3)), may fail if it would cause the number "
2418 "of locked bytes to exceed the permitted maximum (see below).  In the same "
2419 "circumstances, stack growth may likewise fail: the kernel will deny stack "
2420 "expansion and deliver a B<SIGSEGV> signal to the process."
2421 msgstr ""
2422
2423 #. type: Plain text
2424 #: build/C/man2/mlock.2:117
2425 msgid ""
2426 "B<munlockall>()  unlocks all pages mapped into the address space of the "
2427 "calling process."
2428 msgstr ""
2429
2430 #. type: Plain text
2431 #: build/C/man2/mlock.2:123
2432 msgid ""
2433 "On success these system calls return 0.  On error, -1 is returned, I<errno> "
2434 "is set appropriately, and no changes are made to any locks in the address "
2435 "space of the process."
2436 msgstr ""
2437
2438 #. type: Plain text
2439 #: build/C/man2/mlock.2:132
2440 msgid ""
2441 "(Linux 2.6.9 and later) the caller had a nonzero B<RLIMIT_MEMLOCK> soft "
2442 "resource limit, but tried to lock more memory than the limit permitted.  "
2443 "This limit is not enforced if the process is privileged (B<CAP_IPC_LOCK>)."
2444 msgstr ""
2445
2446 #.  In the case of mlock(), this check is somewhat buggy: it doesn't
2447 #.  take into account whether the to-be-locked range overlaps with
2448 #.  already locked pages.  Thus, suppose we allocate
2449 #.  (num_physpages / 4 + 1) of memory, and lock those pages once using
2450 #.  mlock(), and then lock the *same* page range a second time.
2451 #.  In the case, the second mlock() call will fail, since the check
2452 #.  calculates that the process is trying to lock (num_physpages / 2 + 2)
2453 #.  pages, which of course is not true.  (MTK, Nov 04, kernel 2.4.28)
2454 #. type: Plain text
2455 #: build/C/man2/mlock.2:144
2456 msgid ""
2457 "(Linux 2.4 and earlier) the calling process tried to lock more than half of "
2458 "RAM."
2459 msgstr ""
2460
2461 #. SVr4 documents an additional EAGAIN error code.
2462 #. type: Plain text
2463 #: build/C/man2/mlock.2:150
2464 msgid ""
2465 "The caller is not privileged, but needs privilege (B<CAP_IPC_LOCK>)  to "
2466 "perform the requested operation."
2467 msgstr ""
2468
2469 #. type: Plain text
2470 #: build/C/man2/mlock.2:155
2471 msgid "For B<mlock>()  and B<munlock>():"
2472 msgstr ""
2473
2474 #. type: Plain text
2475 #: build/C/man2/mlock.2:158
2476 msgid "Some or all of the specified address range could not be locked."
2477 msgstr ""
2478
2479 #. type: Plain text
2480 #: build/C/man2/mlock.2:165
2481 msgid ""
2482 "The result of the addition I<start>+I<len> was less than I<start> (e.g., the "
2483 "addition may have resulted in an overflow)."
2484 msgstr ""
2485
2486 #. type: Plain text
2487 #: build/C/man2/mlock.2:170
2488 msgid "(Not on Linux)  I<addr> was not a multiple of the page size."
2489 msgstr ""
2490
2491 #. type: Plain text
2492 #: build/C/man2/mlock.2:174
2493 msgid ""
2494 "Some of the specified address range does not correspond to mapped pages in "
2495 "the address space of the process."
2496 msgstr ""
2497
2498 #. type: Plain text
2499 #: build/C/man2/mlock.2:177
2500 msgid "For B<mlockall>():"
2501 msgstr ""
2502
2503 #. type: Plain text
2504 #: build/C/man2/mlock.2:180
2505 msgid "Unknown I<flags> were specified."
2506 msgstr ""
2507
2508 #. type: Plain text
2509 #: build/C/man2/mlock.2:183
2510 msgid "For B<munlockall>():"
2511 msgstr ""
2512
2513 #. type: Plain text
2514 #: build/C/man2/mlock.2:187
2515 msgid "(Linux 2.6.8 and earlier) The caller was not privileged (B<CAP_IPC_LOCK>)."
2516 msgstr ""
2517
2518 #. type: Plain text
2519 #: build/C/man2/mlock.2:189
2520 msgid "POSIX.1-2001, SVr4."
2521 msgstr ""
2522
2523 #. type: SH
2524 #: build/C/man2/mlock.2:189 build/C/man2/mmap.2:487 build/C/man2/msync.2:105
2525 #, no-wrap
2526 msgid "AVAILABILITY"
2527 msgstr ""
2528
2529 #. type: Plain text
2530 #: build/C/man2/mlock.2:201
2531 msgid ""
2532 "On POSIX systems on which B<mlock>()  and B<munlock>()  are available, "
2533 "B<_POSIX_MEMLOCK_RANGE> is defined in I<E<lt>unistd.hE<gt>> and the number "
2534 "of bytes in a page can be determined from the constant B<PAGESIZE> (if "
2535 "defined) in I<E<lt>limits.hE<gt>> or by calling I<sysconf(_SC_PAGESIZE)>."
2536 msgstr ""
2537
2538 #.  POSIX.1-2001: It shall be defined to -1 or 0 or 200112L.
2539 #.  -1: unavailable, 0: ask using sysconf().
2540 #.  glibc defines it to 1.
2541 #. type: Plain text
2542 #: build/C/man2/mlock.2:214
2543 msgid ""
2544 "On POSIX systems on which B<mlockall>()  and B<munlockall>()  are available, "
2545 "B<_POSIX_MEMLOCK> is defined in I<E<lt>unistd.hE<gt>> to a value greater "
2546 "than 0.  (See also B<sysconf>(3).)"
2547 msgstr ""
2548
2549 #. type: Plain text
2550 #: build/C/man2/mlock.2:232
2551 msgid ""
2552 "Memory locking has two main applications: real-time algorithms and "
2553 "high-security data processing.  Real-time applications require deterministic "
2554 "timing, and, like scheduling, paging is one major cause of unexpected "
2555 "program execution delays.  Real-time applications will usually also switch "
2556 "to a real-time scheduler with B<sched_setscheduler>(2).  Cryptographic "
2557 "security software often handles critical bytes like passwords or secret keys "
2558 "as data structures.  As a result of paging, these secrets could be "
2559 "transferred onto a persistent swap store medium, where they might be "
2560 "accessible to the enemy long after the security software has erased the "
2561 "secrets in RAM and terminated.  (But be aware that the suspend mode on "
2562 "laptops and some desktop computers will save a copy of the system's RAM to "
2563 "disk, regardless of memory locks.)"
2564 msgstr ""
2565
2566 #. type: Plain text
2567 #: build/C/man2/mlock.2:245
2568 msgid ""
2569 "Real-time processes that are using B<mlockall>()  to prevent delays on page "
2570 "faults should reserve enough locked stack pages before entering the "
2571 "time-critical section, so that no page fault can be caused by function "
2572 "calls.  This can be achieved by calling a function that allocates a "
2573 "sufficiently large automatic variable (an array) and writes to the memory "
2574 "occupied by this array in order to touch these stack pages.  This way, "
2575 "enough pages will be mapped for the stack and can be locked into RAM.  The "
2576 "dummy writes ensure that not even copy-on-write page faults can occur in the "
2577 "critical section."
2578 msgstr ""
2579
2580 #. type: Plain text
2581 #: build/C/man2/mlock.2:251
2582 msgid ""
2583 "Memory locks are not inherited by a child created via B<fork>(2)  and are "
2584 "automatically removed (unlocked) during an B<execve>(2)  or when the process "
2585 "terminates."
2586 msgstr ""
2587
2588 #. type: Plain text
2589 #: build/C/man2/mlock.2:255
2590 msgid ""
2591 "The memory lock on an address range is automatically removed if the address "
2592 "range is unmapped via B<munmap>(2)."
2593 msgstr ""
2594
2595 #. type: Plain text
2596 #: build/C/man2/mlock.2:268
2597 msgid ""
2598 "Memory locks do not stack, that is, pages which have been locked several "
2599 "times by calls to B<mlock>()  or B<mlockall>()  will be unlocked by a single "
2600 "call to B<munlock>()  for the corresponding range or by B<munlockall>().  "
2601 "Pages which are mapped to several locations or by several processes stay "
2602 "locked into RAM as long as they are locked at least at one location or by at "
2603 "least one process."
2604 msgstr ""
2605
2606 #. type: Plain text
2607 #: build/C/man2/mlock.2:279
2608 msgid ""
2609 "Under Linux, B<mlock>()  and B<munlock>()  automatically round I<addr> down "
2610 "to the nearest page boundary.  However, POSIX.1-2001 allows an "
2611 "implementation to require that I<addr> is page aligned, so portable "
2612 "applications should ensure this."
2613 msgstr ""
2614
2615 #. type: Plain text
2616 #: build/C/man2/mlock.2:292
2617 msgid ""
2618 "The I<VmLck> field of the Linux-specific I</proc/PID/status> file shows how "
2619 "many kilobytes of memory the process with ID I<PID> has locked using "
2620 "B<mlock>(), B<mlockall>(), and B<mmap>(2)  B<MAP_LOCKED>."
2621 msgstr ""
2622
2623 #. type: SS
2624 #: build/C/man2/mlock.2:292
2625 #, no-wrap
2626 msgid "Limits and permissions"
2627 msgstr ""
2628
2629 #. type: Plain text
2630 #: build/C/man2/mlock.2:299
2631 msgid ""
2632 "In Linux 2.6.8 and earlier, a process must be privileged (B<CAP_IPC_LOCK>)  "
2633 "in order to lock memory and the B<RLIMIT_MEMLOCK> soft resource limit "
2634 "defines a limit on how much memory the process may lock."
2635 msgstr ""
2636
2637 #. type: Plain text
2638 #: build/C/man2/mlock.2:305
2639 msgid ""
2640 "Since Linux 2.6.9, no limits are placed on the amount of memory that a "
2641 "privileged process can lock and the B<RLIMIT_MEMLOCK> soft resource limit "
2642 "instead defines a limit on how much memory an unprivileged process may lock."
2643 msgstr ""
2644
2645 #. type: Plain text
2646 #: build/C/man2/mlock.2:313
2647 msgid ""
2648 "In the 2.4 series Linux kernels up to and including 2.4.17, a bug caused the "
2649 "B<mlockall>()  B<MCL_FUTURE> flag to be inherited across a B<fork>(2).  This "
2650 "was rectified in kernel 2.4.18."
2651 msgstr ""
2652
2653 #.  See the following LKML thread:
2654 #.  http://marc.theaimsgroup.com/?l=linux-kernel&m=113801392825023&w=2
2655 #.  "Rationale for RLIMIT_MEMLOCK"
2656 #.  23 Jan 2006
2657 #. type: Plain text
2658 #: build/C/man2/mlock.2:330
2659 msgid ""
2660 "Since kernel 2.6.9, if a privileged process calls I<mlockall(MCL_FUTURE)> "
2661 "and later drops privileges (loses the B<CAP_IPC_LOCK> capability by, for "
2662 "example, setting its effective UID to a nonzero value), then subsequent "
2663 "memory allocations (e.g., B<mmap>(2), B<brk>(2))  will fail if the "
2664 "B<RLIMIT_MEMLOCK> resource limit is encountered."
2665 msgstr ""
2666
2667 #. type: Plain text
2668 #: build/C/man2/mlock.2:337
2669 msgid ""
2670 "B<mmap>(2), B<setrlimit>(2), B<shmctl>(2), B<sysconf>(3), B<proc>(5), "
2671 "B<capabilities>(7)"
2672 msgstr ""
2673
2674 #. type: TH
2675 #: build/C/man2/mmap.2:40
2676 #, no-wrap
2677 msgid "MMAP"
2678 msgstr ""
2679
2680 #. type: TH
2681 #: build/C/man2/mmap.2:40
2682 #, no-wrap
2683 msgid "2010-06-20"
2684 msgstr ""
2685
2686 #. type: Plain text
2687 #: build/C/man2/mmap.2:43
2688 msgid "mmap, munmap - map or unmap files or devices into memory"
2689 msgstr ""
2690
2691 #. type: Plain text
2692 #: build/C/man2/mmap.2:51
2693 #, no-wrap
2694 msgid ""
2695 "B<void *mmap(void *>I<addr>B<, size_t >I<length>B<, int >I<prot>B<, int "
2696 ">I<flags>B<,>\n"
2697 "B<           int >I<fd>B<, off_t >I<offset>B<);>\n"
2698 "B<int munmap(void *>I<addr>B<, size_t >I<length>B<);>\n"
2699 msgstr ""
2700
2701 #. type: Plain text
2702 #: build/C/man2/mmap.2:61
2703 msgid ""
2704 "B<mmap>()  creates a new mapping in the virtual address space of the calling "
2705 "process.  The starting address for the new mapping is specified in I<addr>.  "
2706 "The I<length> argument specifies the length of the mapping."
2707 msgstr ""
2708
2709 #.  Before Linux 2.6.24, the address was rounded up to the next page
2710 #.  boundary; since 2.6.24, it is rounded down!
2711 #. type: Plain text
2712 #: build/C/man2/mmap.2:75
2713 msgid ""
2714 "If I<addr> is NULL, then the kernel chooses the address at which to create "
2715 "the mapping; this is the most portable method of creating a new mapping.  If "
2716 "I<addr> is not NULL, then the kernel takes it as a hint about where to place "
2717 "the mapping; on Linux, the mapping will be created at a nearby page "
2718 "boundary.  The address of the new mapping is returned as the result of the "
2719 "call."
2720 msgstr ""
2721
2722 #. type: Plain text
2723 #: build/C/man2/mmap.2:87
2724 msgid ""
2725 "The contents of a file mapping (as opposed to an anonymous mapping; see "
2726 "B<MAP_ANONYMOUS> below), are initialized using I<length> bytes starting at "
2727 "offset I<offset> in the file (or other object) referred to by the file "
2728 "descriptor I<fd>.  I<offset> must be a multiple of the page size as returned "
2729 "by I<sysconf(_SC_PAGE_SIZE)>."
2730 msgstr ""
2731
2732 #. type: Plain text
2733 #: build/C/man2/mmap.2:95
2734 msgid ""
2735 "The I<prot> argument describes the desired memory protection of the mapping "
2736 "(and must not conflict with the open mode of the file).  It is either "
2737 "B<PROT_NONE> or the bitwise OR of one or more of the following flags:"
2738 msgstr ""
2739
2740 #. type: TP
2741 #: build/C/man2/mmap.2:95 build/C/man2/mprotect.2:67
2742 #, no-wrap
2743 msgid "B<PROT_EXEC>"
2744 msgstr ""
2745
2746 #. type: Plain text
2747 #: build/C/man2/mmap.2:98
2748 msgid "Pages may be executed."
2749 msgstr ""
2750
2751 #. type: TP
2752 #: build/C/man2/mmap.2:98 build/C/man2/mprotect.2:61
2753 #, no-wrap
2754 msgid "B<PROT_READ>"
2755 msgstr ""
2756
2757 #. type: Plain text
2758 #: build/C/man2/mmap.2:101
2759 msgid "Pages may be read."
2760 msgstr ""
2761
2762 #. type: TP
2763 #: build/C/man2/mmap.2:101 build/C/man2/mprotect.2:64
2764 #, no-wrap
2765 msgid "B<PROT_WRITE>"
2766 msgstr ""
2767
2768 #. type: Plain text
2769 #: build/C/man2/mmap.2:104
2770 msgid "Pages may be written."
2771 msgstr ""
2772
2773 #. type: TP
2774 #: build/C/man2/mmap.2:104 build/C/man2/mprotect.2:58
2775 #, no-wrap
2776 msgid "B<PROT_NONE>"
2777 msgstr ""
2778
2779 #. type: Plain text
2780 #: build/C/man2/mmap.2:107
2781 msgid "Pages may not be accessed."
2782 msgstr ""
2783
2784 #. type: Plain text
2785 #: build/C/man2/mmap.2:116
2786 msgid ""
2787 "The I<flags> argument determines whether updates to the mapping are visible "
2788 "to other processes mapping the same region, and whether updates are carried "
2789 "through to the underlying file.  This behavior is determined by including "
2790 "exactly one of the following values in I<flags>:"
2791 msgstr ""
2792
2793 #. type: TP
2794 #: build/C/man2/mmap.2:116
2795 #, no-wrap
2796 msgid "B<MAP_SHARED>"
2797 msgstr ""
2798
2799 #. type: Plain text
2800 #: build/C/man2/mmap.2:126
2801 msgid ""
2802 "Share this mapping.  Updates to the mapping are visible to other processes "
2803 "that map this file, and are carried through to the underlying file.  The "
2804 "file may not actually be updated until B<msync>(2)  or B<munmap>()  is "
2805 "called."
2806 msgstr ""
2807
2808 #. type: TP
2809 #: build/C/man2/mmap.2:126
2810 #, no-wrap
2811 msgid "B<MAP_PRIVATE>"
2812 msgstr ""
2813
2814 #. type: Plain text
2815 #: build/C/man2/mmap.2:135
2816 msgid ""
2817 "Create a private copy-on-write mapping.  Updates to the mapping are not "
2818 "visible to other processes mapping the same file, and are not carried "
2819 "through to the underlying file.  It is unspecified whether changes made to "
2820 "the file after the B<mmap>()  call are visible in the mapped region."
2821 msgstr ""
2822
2823 #. type: Plain text
2824 #: build/C/man2/mmap.2:137
2825 msgid "Both of these flags are described in POSIX.1-2001."
2826 msgstr ""
2827
2828 #. type: Plain text
2829 #: build/C/man2/mmap.2:140
2830 msgid "In addition, zero or more of the following values can be ORed in I<flags>:"
2831 msgstr ""
2832
2833 #. type: TP
2834 #: build/C/man2/mmap.2:140
2835 #, no-wrap
2836 msgid "B<MAP_32BIT> (since Linux 2.4.20, 2.6)"
2837 msgstr ""
2838
2839 #.  See http://lwn.net/Articles/294642 "Tangled up in threads", 19 Aug 08
2840 #. type: Plain text
2841 #: build/C/man2/mmap.2:156
2842 msgid ""
2843 "Put the mapping into the first 2 Gigabytes of the process address space.  "
2844 "This flag is only supported on x86-64, for 64-bit programs.  It was added to "
2845 "allow thread stacks to be allocated somewhere in the first 2GB of memory, so "
2846 "as to improve context-switch performance on some early 64-bit processors.  "
2847 "Modern x86-64 processors no longer have this performance problem, so use of "
2848 "this flag is not required on those systems.  The B<MAP_32BIT> flag is "
2849 "ignored when B<MAP_FIXED> is set."
2850 msgstr ""
2851
2852 #. type: TP
2853 #: build/C/man2/mmap.2:156
2854 #, no-wrap
2855 msgid "B<MAP_ANON>"
2856 msgstr ""
2857
2858 #. type: Plain text
2859 #: build/C/man2/mmap.2:161
2860 msgid "Synonym for B<MAP_ANONYMOUS>.  Deprecated."
2861 msgstr ""
2862
2863 #. type: TP
2864 #: build/C/man2/mmap.2:161
2865 #, no-wrap
2866 msgid "B<MAP_ANONYMOUS>"
2867 msgstr ""
2868
2869 #. type: Plain text
2870 #: build/C/man2/mmap.2:183
2871 msgid ""
2872 "The mapping is not backed by any file; its contents are initialized to "
2873 "zero.  The I<fd> and I<offset> arguments are ignored; however, some "
2874 "implementations require I<fd> to be -1 if B<MAP_ANONYMOUS> (or B<MAP_ANON>)  "
2875 "is specified, and portable applications should ensure this.  The use of "
2876 "B<MAP_ANONYMOUS> in conjunction with B<MAP_SHARED> is only supported on "
2877 "Linux since kernel 2.4."
2878 msgstr ""
2879
2880 #. type: TP
2881 #: build/C/man2/mmap.2:183
2882 #, no-wrap
2883 msgid "B<MAP_DENYWRITE>"
2884 msgstr ""
2885
2886 #.  Introduced in 1.1.36, removed in 1.3.24.
2887 #. type: Plain text
2888 #: build/C/man2/mmap.2:191
2889 msgid ""
2890 "This flag is ignored.  (Long ago, it signaled that attempts to write to the "
2891 "underlying file should fail with B<ETXTBUSY>.  But this was a source of "
2892 "denial-of-service attacks.)"
2893 msgstr ""
2894
2895 #. type: TP
2896 #: build/C/man2/mmap.2:191
2897 #, no-wrap
2898 msgid "B<MAP_EXECUTABLE>"
2899 msgstr ""
2900
2901 #.  Introduced in 1.1.38, removed in 1.3.24. Flag tested in proc_follow_link.
2902 #.  (Long ago, it signaled that the underlying file is an executable.
2903 #.  However, that information was not really used anywhere.)
2904 #.  Linus talked about DOS related to MAP_EXECUTABLE, but he was thinking of
2905 #.  MAP_DENYWRITE?
2906 #. type: Plain text
2907 #: build/C/man2/mmap.2:199
2908 msgid "This flag is ignored."
2909 msgstr ""
2910
2911 #. type: TP
2912 #: build/C/man2/mmap.2:199
2913 #, no-wrap
2914 msgid "B<MAP_FILE>"
2915 msgstr ""
2916
2917 #.  On some systems, this was required as the opposite of
2918 #.  MAP_ANONYMOUS -- mtk, 1 May 2007
2919 #. type: Plain text
2920 #: build/C/man2/mmap.2:205
2921 msgid "Compatibility flag.  Ignored."
2922 msgstr ""
2923
2924 #. type: TP
2925 #: build/C/man2/mmap.2:205
2926 #, no-wrap
2927 msgid "B<MAP_FIXED>"
2928 msgstr ""
2929
2930 #. type: Plain text
2931 #: build/C/man2/mmap.2:223
2932 msgid ""
2933 "Don't interpret I<addr> as a hint: place the mapping at exactly that "
2934 "address.  I<addr> must be a multiple of the page size.  If the memory region "
2935 "specified by I<addr> and I<len> overlaps pages of any existing mapping(s), "
2936 "then the overlapped part of the existing mapping(s) will be discarded.  If "
2937 "the specified address cannot be used, B<mmap>()  will fail.  Because "
2938 "requiring a fixed address for a mapping is less portable, the use of this "
2939 "option is discouraged."
2940 msgstr ""
2941
2942 #. type: TP
2943 #: build/C/man2/mmap.2:223
2944 #, no-wrap
2945 msgid "B<MAP_GROWSDOWN>"
2946 msgstr ""
2947
2948 #. type: Plain text
2949 #: build/C/man2/mmap.2:228
2950 msgid ""
2951 "Used for stacks.  Indicates to the kernel virtual memory system that the "
2952 "mapping should extend downward in memory."
2953 msgstr ""
2954
2955 #. type: TP
2956 #: build/C/man2/mmap.2:228
2957 #, no-wrap
2958 msgid "B<MAP_HUGETLB> (since Linux 2.6.32)"
2959 msgstr ""
2960
2961 #. type: Plain text
2962 #: build/C/man2/mmap.2:234
2963 msgid ""
2964 "Allocate the mapping using \"huge pages.\" See the kernel source file "
2965 "I<Documentation/vm/hugetlbpage.txt> for further information."
2966 msgstr ""
2967
2968 #. type: TP
2969 #: build/C/man2/mmap.2:234
2970 #, no-wrap
2971 msgid "B<MAP_LOCKED> (since Linux 2.5.37)"
2972 msgstr ""
2973
2974 #.  If set, the mapped pages will not be swapped out.
2975 #. type: Plain text
2976 #: build/C/man2/mmap.2:240
2977 msgid ""
2978 "Lock the pages of the mapped region into memory in the manner of "
2979 "B<mlock>(2).  This flag is ignored in older kernels."
2980 msgstr ""
2981
2982 #. type: TP
2983 #: build/C/man2/mmap.2:240
2984 #, no-wrap
2985 msgid "B<MAP_NONBLOCK> (since Linux 2.5.46)"
2986 msgstr ""
2987
2988 #. type: Plain text
2989 #: build/C/man2/mmap.2:255
2990 msgid ""
2991 "Only meaningful in conjunction with B<MAP_POPULATE>.  Don't perform "
2992 "read-ahead: only create page tables entries for pages that are already "
2993 "present in RAM.  Since Linux 2.6.23, this flag causes B<MAP_POPULATE> to do "
2994 "nothing.  One day the combination of B<MAP_POPULATE> and B<MAP_NONBLOCK> may "
2995 "be reimplemented."
2996 msgstr ""
2997
2998 #. type: TP
2999 #: build/C/man2/mmap.2:255
3000 #, no-wrap
3001 msgid "B<MAP_NORESERVE>"
3002 msgstr ""
3003
3004 #. type: Plain text
3005 #: build/C/man2/mmap.2:270
3006 msgid ""
3007 "Do not reserve swap space for this mapping.  When swap space is reserved, "
3008 "one has the guarantee that it is possible to modify the mapping.  When swap "
3009 "space is not reserved one might get B<SIGSEGV> upon a write if no physical "
3010 "memory is available.  See also the discussion of the file "
3011 "I</proc/sys/vm/overcommit_memory> in B<proc>(5).  In kernels before 2.6, "
3012 "this flag only had effect for private writable mappings."
3013 msgstr ""
3014
3015 #. type: TP
3016 #: build/C/man2/mmap.2:270
3017 #, no-wrap
3018 msgid "B<MAP_POPULATE> (since Linux 2.5.46)"
3019 msgstr ""
3020
3021 #. type: Plain text
3022 #: build/C/man2/mmap.2:277
3023 msgid ""
3024 "Populate (prefault) page tables for a mapping.  For a file mapping, this "
3025 "causes read-ahead on the file.  Later accesses to the mapping will not be "
3026 "blocked by page faults.  B<MAP_POPULATE> is only supported for private "
3027 "mappings since Linux 2.6.23."
3028 msgstr ""
3029
3030 #. type: TP
3031 #: build/C/man2/mmap.2:277
3032 #, no-wrap
3033 msgid "B<MAP_STACK> (since Linux 2.6.27)"
3034 msgstr ""
3035
3036 #.  See http://lwn.net/Articles/294642 "Tangled up in threads", 19 Aug 08
3037 #.  commit cd98a04a59e2f94fa64d5bf1e26498d27427d5e7
3038 #.  http://thread.gmane.org/gmane.linux.kernel/720412
3039 #.  "pthread_create() slow for many threads; also time to revisit 64b
3040 #.   context switch optimization?"
3041 #. type: Plain text
3042 #: build/C/man2/mmap.2:290
3043 msgid ""
3044 "Allocate the mapping at an address suitable for a process or thread stack.  "
3045 "This flag is currently a no-op, but is used in the glibc threading "
3046 "implementation so that if some architectures require special treatment for "
3047 "stack allocations, support can later be transparently implemented for glibc."
3048 msgstr ""
3049
3050 #. type: TP
3051 #: build/C/man2/mmap.2:290
3052 #, no-wrap
3053 msgid "B<MAP_UNINITIALIZED> (since Linux 2.6.33)"
3054 msgstr ""
3055
3056 #. type: Plain text
3057 #: build/C/man2/mmap.2:300
3058 msgid ""
3059 "Don't clear anonymous pages.  This flag is intended to improve performance "
3060 "on embedded devices.  This flag is only honored if the kernel was configured "
3061 "with the B<CONFIG_MMAP_ALLOW_UNINITIALIZED> option.  Because of the security "
3062 "implications, that option is normally enabled only on embedded devices "
3063 "(i.e., devices where one has complete control of the contents of user "
3064 "memory)."
3065 msgstr ""
3066
3067 #. type: Plain text
3068 #: build/C/man2/mmap.2:308
3069 msgid ""
3070 "Of the above flags, only B<MAP_FIXED> is specified in POSIX.1-2001.  "
3071 "However, most systems also support B<MAP_ANONYMOUS> (or its synonym "
3072 "B<MAP_ANON>)."
3073 msgstr ""
3074
3075 #. type: Plain text
3076 #: build/C/man2/mmap.2:315
3077 msgid ""
3078 "Some systems document the additional flags B<MAP_AUTOGROW>, "
3079 "B<MAP_AUTORESRV>, B<MAP_COPY>, and B<MAP_LOCAL>."
3080 msgstr ""
3081
3082 #. type: Plain text
3083 #: build/C/man2/mmap.2:321
3084 msgid ""
3085 "Memory mapped by B<mmap>()  is preserved across B<fork>(2), with the same "
3086 "attributes."
3087 msgstr ""
3088
3089 #. type: Plain text
3090 #: build/C/man2/mmap.2:329
3091 msgid ""
3092 "A file is mapped in multiples of the page size.  For a file that is not a "
3093 "multiple of the page size, the remaining memory is zeroed when mapped, and "
3094 "writes to that region are not written out to the file.  The effect of "
3095 "changing the size of the underlying file of a mapping on the pages that "
3096 "correspond to added or removed regions of the file is unspecified."
3097 msgstr ""
3098
3099 #. type: SS
3100 #: build/C/man2/mmap.2:329
3101 #, no-wrap
3102 msgid "munmap()"
3103 msgstr ""
3104
3105 #. type: Plain text
3106 #: build/C/man2/mmap.2:339
3107 msgid ""
3108 "The B<munmap>()  system call deletes the mappings for the specified address "
3109 "range, and causes further references to addresses within the range to "
3110 "generate invalid memory references.  The region is also automatically "
3111 "unmapped when the process is terminated.  On the other hand, closing the "
3112 "file descriptor does not unmap the region."
3113 msgstr ""
3114
3115 #. type: Plain text
3116 #: build/C/man2/mmap.2:349
3117 msgid ""
3118 "The address I<addr> must be a multiple of the page size.  All pages "
3119 "containing a part of the indicated range are unmapped, and subsequent "
3120 "references to these pages will generate B<SIGSEGV>.  It is not an error if "
3121 "the indicated range does not contain any mapped pages."
3122 msgstr ""
3123
3124 #. type: SS
3125 #: build/C/man2/mmap.2:349
3126 #, no-wrap
3127 msgid "Timestamps changes for file-backed mappings"
3128 msgstr ""
3129
3130 #. type: Plain text
3131 #: build/C/man2/mmap.2:356
3132 msgid ""
3133 "For file-backed mappings, the I<st_atime> field for the mapped file may be "
3134 "updated at any time between the B<mmap>()  and the corresponding unmapping; "
3135 "the first reference to a mapped page will update the field if it has not "
3136 "been already."
3137 msgstr ""
3138
3139 #. type: Plain text
3140 #: build/C/man2/mmap.2:373
3141 msgid ""
3142 "The I<st_ctime> and I<st_mtime> field for a file mapped with B<PROT_WRITE> "
3143 "and B<MAP_SHARED> will be updated after a write to the mapped region, and "
3144 "before a subsequent B<msync>(2)  with the B<MS_SYNC> or B<MS_ASYNC> flag, if "
3145 "one occurs."
3146 msgstr ""
3147
3148 #. type: Plain text
3149 #: build/C/man2/mmap.2:390
3150 msgid ""
3151 "On success, B<mmap>()  returns a pointer to the mapped area.  On error, the "
3152 "value B<MAP_FAILED> (that is, I<(void\\ *)\\ -1>)  is returned, and I<errno> "
3153 "is set appropriately.  On success, B<munmap>()  returns 0, on failure -1, "
3154 "and I<errno> is set (probably to B<EINVAL>)."
3155 msgstr ""
3156
3157 #. type: TP
3158 #: build/C/man2/mmap.2:391 build/C/man2/mprotect.2:80 build/C/man3/shm_open.3:185 build/C/man3/shm_open.3:190 build/C/man2/shmctl.2:295 build/C/man2/shmget.2:186 build/C/man2/shmop.2:189
3159 #, no-wrap
3160 msgid "B<EACCES>"
3161 msgstr ""
3162
3163 #. type: Plain text
3164 #: build/C/man2/mmap.2:411
3165 msgid ""
3166 "A file descriptor refers to a non-regular file.  Or B<MAP_PRIVATE> was "
3167 "requested, but I<fd> is not open for reading.  Or B<MAP_SHARED> was "
3168 "requested and B<PROT_WRITE> is set, but I<fd> is not open in read/write "
3169 "(B<O_RDWR>)  mode.  Or B<PROT_WRITE> is set, but the file is append-only."
3170 msgstr ""
3171
3172 #. type: Plain text
3173 #: build/C/man2/mmap.2:415
3174 msgid ""
3175 "The file has been locked, or too much memory has been locked (see "
3176 "B<setrlimit>(2))."
3177 msgstr ""
3178
3179 #. type: Plain text
3180 #: build/C/man2/mmap.2:421
3181 msgid "I<fd> is not a valid file descriptor (and B<MAP_ANONYMOUS> was not set)."
3182 msgstr ""
3183
3184 #. type: Plain text
3185 #: build/C/man2/mmap.2:429
3186 msgid ""
3187 "We don't like I<addr>, I<length>, or I<offset> (e.g., they are too large, or "
3188 "not aligned on a page boundary)."
3189 msgstr ""
3190
3191 #. type: Plain text
3192 #: build/C/man2/mmap.2:434
3193 msgid "(since Linux 2.6.12)  I<length> was 0."
3194 msgstr ""
3195
3196 #. type: Plain text
3197 #: build/C/man2/mmap.2:442
3198 msgid ""
3199 "I<flags> contained neither B<MAP_PRIVATE> or B<MAP_SHARED>, or contained "
3200 "both of these values."
3201 msgstr ""
3202
3203 #. type: TP
3204 #: build/C/man2/mmap.2:442 build/C/man3/shm_open.3:227 build/C/man2/shmget.2:202
3205 #, no-wrap
3206 msgid "B<ENFILE>"
3207 msgstr ""
3208
3209 #.  [2.6.7] shmem_zero_setup()-->shmem_file_setup()-->get_empty_filp()
3210 #. type: Plain text
3211 #: build/C/man2/mmap.2:450 build/C/man2/shmget.2:206
3212 msgid "The system limit on the total number of open files has been reached."
3213 msgstr ""
3214
3215 #. type: Plain text
3216 #: build/C/man2/mmap.2:454
3217 msgid ""
3218 "The underlying file system of the specified file does not support memory "
3219 "mapping."
3220 msgstr ""
3221
3222 #. type: Plain text
3223 #: build/C/man2/mmap.2:458
3224 msgid ""
3225 "No memory is available, or the process's maximum number of mappings would "
3226 "have been exceeded."
3227 msgstr ""
3228
3229 #.  (Since 2.4.25 / 2.6.0.)
3230 #. type: Plain text
3231 #: build/C/man2/mmap.2:467
3232 msgid ""
3233 "The I<prot> argument asks for B<PROT_EXEC> but the mapped area belongs to a "
3234 "file on a file system that was mounted no-exec."
3235 msgstr ""
3236
3237 #. type: TP
3238 #: build/C/man2/mmap.2:467
3239 #, no-wrap
3240 msgid "B<ETXTBSY>"
3241 msgstr ""
3242
3243 #. type: Plain text
3244 #: build/C/man2/mmap.2:473
3245 msgid ""
3246 "B<MAP_DENYWRITE> was set but the object specified by I<fd> is open for "
3247 "writing."
3248 msgstr ""
3249
3250 #. type: Plain text
3251 #: build/C/man2/mmap.2:475
3252 msgid "Use of a mapped region can result in these signals:"
3253 msgstr ""
3254
3255 #. type: TP
3256 #: build/C/man2/mmap.2:475
3257 #, no-wrap
3258 msgid "B<SIGSEGV>"
3259 msgstr ""
3260
3261 #. type: Plain text
3262 #: build/C/man2/mmap.2:478
3263 msgid "Attempted write into a region mapped as read-only."
3264 msgstr ""
3265
3266 #. type: TP
3267 #: build/C/man2/mmap.2:478
3268 #, no-wrap
3269 msgid "B<SIGBUS>"
3270 msgstr ""
3271
3272 #. type: Plain text
3273 #: build/C/man2/mmap.2:483
3274 msgid ""
3275 "Attempted access to a portion of the buffer that does not correspond to the "
3276 "file (for example, beyond the end of the file, including the case where "
3277 "another process has truncated the file)."
3278 msgstr ""
3279
3280 #.  SVr4 documents additional error codes ENXIO and ENODEV.
3281 #.  SUSv2 documents additional error codes EMFILE and EOVERFLOW.
3282 #. type: Plain text
3283 #: build/C/man2/mmap.2:487
3284 msgid "SVr4, 4.4BSD, POSIX.1-2001."
3285 msgstr ""
3286
3287 #.  POSIX.1-2001: It shall be defined to -1 or 0 or 200112L.
3288 #.  -1: unavailable, 0: ask using sysconf().
3289 #.  glibc defines it to 1.
3290 #. type: Plain text
3291 #: build/C/man2/mmap.2:501
3292 msgid ""
3293 "On POSIX systems on which B<mmap>(), B<msync>(2)  and B<munmap>()  are "
3294 "available, B<_POSIX_MAPPED_FILES> is defined in I<E<lt>unistd.hE<gt>> to a "
3295 "value greater than 0.  (See also B<sysconf>(3).)"
3296 msgstr ""
3297
3298 #.  Since around glibc 2.1/2.2, depending on the platform.
3299 #. type: Plain text
3300 #: build/C/man2/mmap.2:512
3301 msgid ""
3302 "Since kernel 2.4, this system call has been superseded by B<mmap2>(2).  "
3303 "Nowadays, the glibc B<mmap>()  wrapper function invokes B<mmap2>(2)  with a "
3304 "suitably adjusted value for I<offset>."
3305 msgstr ""
3306
3307 #. type: Plain text
3308 #: build/C/man2/mmap.2:525
3309 msgid ""
3310 "On some hardware architectures (e.g., i386), B<PROT_WRITE> implies "
3311 "B<PROT_READ>.  It is architecture dependent whether B<PROT_READ> implies "
3312 "B<PROT_EXEC> or not.  Portable programs should always set B<PROT_EXEC> if "
3313 "they intend to execute code in the new mapping."
3314 msgstr ""
3315
3316 #. type: Plain text
3317 #: build/C/man2/mmap.2:540
3318 msgid ""
3319 "The portable way to create a mapping is to specify I<addr> as 0 (NULL), and "
3320 "omit B<MAP_FIXED> from I<flags>.  In this case, the system chooses the "
3321 "address for the mapping; the address is chosen so as not to conflict with "
3322 "any existing mapping, and will not be 0.  If the B<MAP_FIXED> flag is "
3323 "specified, and I<addr> is 0 (NULL), then the mapped address will be 0 "
3324 "(NULL)."
3325 msgstr ""
3326
3327 #. type: Plain text
3328 #: build/C/man2/mmap.2:545
3329 msgid ""
3330 "On Linux there are no guarantees like those suggested above under "
3331 "B<MAP_NORESERVE>.  By default, any process can be killed at any moment when "
3332 "the system runs out of memory."
3333 msgstr ""
3334
3335 #. type: Plain text
3336 #: build/C/man2/mmap.2:552
3337 msgid ""
3338 "In kernels before 2.6.7, the B<MAP_POPULATE> flag only has effect if I<prot> "
3339 "is specified as B<PROT_NONE>."
3340 msgstr ""
3341
3342 #. type: Plain text
3343 #: build/C/man2/mmap.2:567
3344 msgid ""
3345 "SUSv3 specifies that B<mmap>()  should fail if I<length> is 0.  However, in "
3346 "kernels before 2.6.12, B<mmap>()  succeeded in this case: no mapping was "
3347 "created and the call returned I<addr>.  Since kernel 2.6.12, B<mmap>()  "
3348 "fails with the error B<EINVAL> for this case."
3349 msgstr ""
3350
3351 #. type: Plain text
3352 #: build/C/man2/mmap.2:579
3353 msgid ""
3354 "The following program prints part of the file specified in its first "
3355 "command-line argument to standard output.  The range of bytes to be printed "
3356 "is specified via offset and length values in the second and third "
3357 "command-line arguments.  The program creates a memory mapping of the "
3358 "required pages of the file and then uses B<write>(2)  to output the desired "
3359 "bytes."
3360 msgstr ""
3361
3362 #. type: Plain text
3363 #: build/C/man2/mmap.2:587
3364 #, no-wrap
3365 msgid ""
3366 "#include E<lt>sys/mman.hE<gt>\n"
3367 "#include E<lt>sys/stat.hE<gt>\n"
3368 "#include E<lt>fcntl.hE<gt>\n"
3369 "#include E<lt>stdio.hE<gt>\n"
3370 "#include E<lt>stdlib.hE<gt>\n"
3371 "#include E<lt>unistd.hE<gt>\n"
3372 msgstr ""
3373
3374 #. type: Plain text
3375 #: build/C/man2/mmap.2:590 build/C/man2/mprotect.2:172
3376 #, no-wrap
3377 msgid ""
3378 "#define handle_error(msg) \\e\n"
3379 "    do { perror(msg); exit(EXIT_FAILURE); } while (0)\n"
3380 msgstr ""
3381
3382 #. type: Plain text
3383 #: build/C/man2/mmap.2:600
3384 #, no-wrap
3385 msgid ""
3386 "int\n"
3387 "main(int argc, char *argv[])\n"
3388 "{\n"
3389 "    char *addr;\n"
3390 "    int fd;\n"
3391 "    struct stat sb;\n"
3392 "    off_t offset, pa_offset;\n"
3393 "    size_t length;\n"
3394 "    ssize_t s;\n"
3395 msgstr ""
3396
3397 #. type: Plain text
3398 #: build/C/man2/mmap.2:605
3399 #, no-wrap
3400 msgid ""
3401 "    if (argc E<lt> 3 || argc E<gt> 4) {\n"
3402 "        fprintf(stderr, \"%s file offset [length]\\en\", argv[0]);\n"
3403 "        exit(EXIT_FAILURE);\n"
3404 "    }\n"
3405 msgstr ""
3406
3407 #. type: Plain text
3408 #: build/C/man2/mmap.2:609
3409 #, no-wrap
3410 msgid ""
3411 "    fd = open(argv[1], O_RDONLY);\n"
3412 "    if (fd == -1)\n"
3413 "        handle_error(\"open\");\n"
3414 msgstr ""
3415
3416 #. type: Plain text
3417 #: build/C/man2/mmap.2:612
3418 #, no-wrap
3419 msgid ""
3420 "    if (fstat(fd, &sb) == -1)           /* To obtain file size */\n"
3421 "        handle_error(\"fstat\");\n"
3422 msgstr ""
3423
3424 #. type: Plain text
3425 #: build/C/man2/mmap.2:616
3426 #, no-wrap
3427 msgid ""
3428 "    offset = atoi(argv[2]);\n"
3429 "    pa_offset = offset & ~(sysconf(_SC_PAGE_SIZE) - 1);\n"
3430 "        /* offset for mmap() must be page aligned */\n"
3431 msgstr ""
3432
3433 #. type: Plain text
3434 #: build/C/man2/mmap.2:621
3435 #, no-wrap
3436 msgid ""
3437 "    if (offset E<gt>= sb.st_size) {\n"
3438 "        fprintf(stderr, \"offset is past end of file\\en\");\n"
3439 "        exit(EXIT_FAILURE);\n"
3440 "    }\n"
3441 msgstr ""
3442
3443 #. type: Plain text
3444 #: build/C/man2/mmap.2:627
3445 #, no-wrap
3446 msgid ""
3447 "    if (argc == 4) {\n"
3448 "        length = atoi(argv[3]);\n"
3449 "        if (offset + length E<gt> sb.st_size)\n"
3450 "            length = sb.st_size - offset;\n"
3451 "                /* Can\\(aqt display bytes past end of file */\n"
3452 msgstr ""
3453
3454 #. type: Plain text
3455 #: build/C/man2/mmap.2:631
3456 #, no-wrap
3457 msgid ""
3458 "    } else {    /* No length arg ==E<gt> display to end of file */\n"
3459 "        length = sb.st_size - offset;\n"
3460 "    }\n"
3461 msgstr ""
3462
3463 #. type: Plain text
3464 #: build/C/man2/mmap.2:636
3465 #, no-wrap
3466 msgid ""
3467 "    addr = mmap(NULL, length + offset - pa_offset, PROT_READ,\n"
3468 "                MAP_PRIVATE, fd, pa_offset);\n"
3469 "    if (addr == MAP_FAILED)\n"
3470 "        handle_error(\"mmap\");\n"
3471 msgstr ""
3472
3473 #. type: Plain text
3474 #: build/C/man2/mmap.2:641
3475 #, no-wrap
3476 msgid ""
3477 "    s = write(STDOUT_FILENO, addr + offset - pa_offset, length);\n"
3478 "    if (s != length) {\n"
3479 "        if (s == -1)\n"
3480 "            handle_error(\"write\");\n"
3481 msgstr ""
3482
3483 #. type: Plain text
3484 #: build/C/man2/mmap.2:645
3485 #, no-wrap
3486 msgid ""
3487 "        fprintf(stderr, \"partial write\");\n"
3488 "        exit(EXIT_FAILURE);\n"
3489 "    }\n"
3490 msgstr ""
3491
3492 #. type: Plain text
3493 #: build/C/man2/mmap.2:662
3494 msgid ""
3495 "B<getpagesize>(2), B<mincore>(2), B<mlock>(2), B<mmap2>(2), B<mprotect>(2), "
3496 "B<mremap>(2), B<msync>(2), B<remap_file_pages>(2), B<setrlimit>(2), "
3497 "B<shmat>(2), B<shm_open>(3), B<shm_overview>(7)"
3498 msgstr ""
3499
3500 #. type: Plain text
3501 #: build/C/man2/mmap.2:667 build/C/man2/msync.2:122
3502 msgid "B.O. Gallmeister, POSIX.4, O'Reilly, pp. 128-129 and 389-391."
3503 msgstr ""
3504
3505 #. type: TH
3506 #: build/C/man2/mmap2.2:29
3507 #, no-wrap
3508 msgid "MMAP2"
3509 msgstr ""
3510
3511 #. type: TH
3512 #: build/C/man2/mmap2.2:29 build/C/man2/msync.2:25 build/C/man2/remap_file_pages.2:26
3513 #, no-wrap
3514 msgid "2008-04-22"
3515 msgstr ""
3516
3517 #. type: Plain text
3518 #: build/C/man2/mmap2.2:32
3519 msgid "mmap2 - map files or devices into memory"
3520 msgstr ""
3521
3522 #. type: Plain text
3523 #: build/C/man2/mmap2.2:38
3524 #, no-wrap
3525 msgid ""
3526 "B<void *mmap2(void *>I<addr>B<, size_t >I<length>B<, int >I<prot>B<,>\n"
3527 "B<             int >I<flags>B<, int >I<fd>B<, off_t >I<pgoffset>B<);>\n"
3528 msgstr ""
3529
3530 #. type: Plain text
3531 #: build/C/man2/mmap2.2:50
3532 msgid ""
3533 "The B<mmap2>()  system call operates in exactly the same way as B<mmap>(2), "
3534 "except that the final argument specifies the offset into the file in "
3535 "4096-byte units (instead of bytes, as is done by B<mmap>(2)).  This enables "
3536 "applications that use a 32-bit I<off_t> to map large files (up to 2^44 "
3537 "bytes)."
3538 msgstr ""
3539
3540 #. type: Plain text
3541 #: build/C/man2/mmap2.2:57
3542 msgid ""
3543 "On success, B<mmap2>()  returns a pointer to the mapped area.  On error -1 "
3544 "is returned and I<errno> is set appropriately."
3545 msgstr ""
3546
3547 #. type: Plain text
3548 #: build/C/man2/mmap2.2:61
3549 msgid "Problem with getting the data from userspace."
3550 msgstr ""
3551
3552 #. type: Plain text
3553 #: build/C/man2/mmap2.2:66
3554 msgid ""
3555 "(Various platforms where the page size is not 4096 bytes.)  I<offset * 4096> "
3556 "is not a multiple of the system page size."
3557 msgstr ""
3558
3559 #. type: Plain text
3560 #: build/C/man2/mmap2.2:70
3561 msgid "B<mmap2>()  can return any of the same errors as B<mmap>(2)."
3562 msgstr ""
3563
3564 #. type: Plain text
3565 #: build/C/man2/mmap2.2:73
3566 msgid "B<mmap2>()  is available since Linux 2.3.31."
3567 msgstr ""
3568
3569 #. type: Plain text
3570 #: build/C/man2/mmap2.2:75 build/C/man2/subpage_prot.2:93
3571 msgid "This system call is Linux-specific."
3572 msgstr ""
3573
3574 #. type: Plain text
3575 #: build/C/man2/mmap2.2:81
3576 msgid ""
3577 "Nowadays, the glibc B<mmap>()  wrapper function invokes this system call "
3578 "rather than the B<mmap>(2)  system call."
3579 msgstr ""
3580
3581 #.  ia64 can have page sizes ranging from 4kB to 64kB.
3582 #.  On cris, it looks like the unit might also be the page size,
3583 #.  which is 8192 bytes. -- mtk, June 2007
3584 #. type: Plain text
3585 #: build/C/man2/mmap2.2:88
3586 msgid ""
3587 "On ia64, the unit for I<offset> is actually the system page size, rather "
3588 "than 4096 bytes."
3589 msgstr ""
3590
3591 #. type: Plain text
3592 #: build/C/man2/mmap2.2:94
3593 msgid "B<getpagesize>(2), B<mmap>(2), B<mremap>(2), B<msync>(2), B<shm_open>(3)"
3594 msgstr ""
3595
3596 #. type: TH
3597 #: build/C/man2/mprotect.2:32
3598 #, no-wrap
3599 msgid "MPROTECT"
3600 msgstr ""
3601
3602 #. type: TH
3603 #: build/C/man2/mprotect.2:32
3604 #, no-wrap
3605 msgid "2011-09-08"
3606 msgstr ""
3607
3608 #. type: Plain text
3609 #: build/C/man2/mprotect.2:35
3610 msgid "mprotect - set protection on a region of memory"
3611 msgstr ""
3612
3613 #. type: Plain text
3614 #: build/C/man2/mprotect.2:40
3615 #, no-wrap
3616 msgid "B<int mprotect(const void *>I<addr>B<, size_t >I<len>B<, int >I<prot>B<);>\n"
3617 msgstr ""
3618
3619 #. type: Plain text
3620 #: build/C/man2/mprotect.2:48
3621 msgid ""
3622 "B<mprotect>()  changes protection for the calling process's memory page(s)  "
3623 "containing any part of the address range in the interval [I<addr>,\\ "
3624 "I<addr>+I<len>-1].  I<addr> must be aligned to a page boundary."
3625 msgstr ""
3626
3627 #. type: Plain text
3628 #: build/C/man2/mprotect.2:53
3629 msgid ""
3630 "If the calling process tries to access memory in a manner that violates the "
3631 "protection, then the kernel generates a B<SIGSEGV> signal for the process."
3632 msgstr ""
3633
3634 #. type: Plain text
3635 #: build/C/man2/mprotect.2:58
3636 msgid ""
3637 "I<prot> is either B<PROT_NONE> or a bitwise-or of the other values in the "
3638 "following list:"
3639 msgstr ""
3640
3641 #. type: Plain text
3642 #: build/C/man2/mprotect.2:61
3643 msgid "The memory cannot be accessed at all."
3644 msgstr ""
3645
3646 #. type: Plain text
3647 #: build/C/man2/mprotect.2:64
3648 msgid "The memory can be read."
3649 msgstr ""
3650
3651 #. type: Plain text
3652 #: build/C/man2/mprotect.2:67
3653 msgid "The memory can be modified."
3654 msgstr ""
3655
3656 #.  FIXME
3657 #.  Document PROT_GROWSUP and PROT_GROWSDOWN
3658 #. type: Plain text
3659 #: build/C/man2/mprotect.2:72
3660 msgid "The memory can be executed."
3661 msgstr ""
3662
3663 #. type: Plain text
3664 #: build/C/man2/mprotect.2:79
3665 msgid ""
3666 "On success, B<mprotect>()  returns zero.  On error, -1 is returned, and "
3667 "I<errno> is set appropriately."
3668 msgstr ""
3669
3670 #. type: Plain text
3671 #: build/C/man2/mprotect.2:89
3672 msgid ""
3673 "The memory cannot be given the specified access.  This can happen, for "
3674 "example, if you B<mmap>(2)  a file to which you have read-only access, then "
3675 "ask B<mprotect>()  to mark it B<PROT_WRITE>."
3676 msgstr ""
3677
3678 #.  Or: both PROT_GROWSUP and PROT_GROWSDOWN were specified in 'prot'.
3679 #. type: Plain text
3680 #: build/C/man2/mprotect.2:94
3681 msgid "I<addr> is not a valid pointer, or not a multiple of the system page size."
3682 msgstr ""
3683
3684 #. type: Plain text
3685 #: build/C/man2/mprotect.2:97
3686 msgid "Internal kernel structures could not be allocated."
3687 msgstr ""
3688
3689 #. type: Plain text
3690 #: build/C/man2/mprotect.2:107
3691 msgid ""
3692 "Addresses in the range [I<addr>, I<addr>+I<len>-1] are invalid for the "
3693 "address space of the process, or specify one or more pages that are not "
3694 "mapped.  (Before kernel 2.4.19, the error B<EFAULT> was incorrectly produced "
3695 "for these cases.)"
3696 msgstr ""
3697
3698 #.  SVr4 defines an additional error
3699 #.  code EAGAIN. The SVr4 error conditions don't map neatly onto Linux's.
3700 #. type: Plain text
3701 #: build/C/man2/mprotect.2:116
3702 msgid ""
3703 "SVr4, POSIX.1-2001.  POSIX says that the behavior of B<mprotect>()  is "
3704 "unspecified if it is applied to a region of memory that was not obtained via "
3705 "B<mmap>(2)."
3706 msgstr ""
3707
3708 #. type: Plain text
3709 #: build/C/man2/mprotect.2:123
3710 msgid ""
3711 "On Linux it is always permissible to call B<mprotect>()  on any address in a "
3712 "process's address space (except for the kernel vsyscall area).  In "
3713 "particular it can be used to change existing code mappings to be writable."
3714 msgstr ""
3715
3716 #. type: Plain text
3717 #: build/C/man2/mprotect.2:133
3718 msgid ""
3719 "Whether B<PROT_EXEC> has any effect different from B<PROT_READ> is "
3720 "architecture- and kernel version-dependent.  On some hardware architectures "
3721 "(e.g., i386), B<PROT_WRITE> implies B<PROT_READ>."
3722 msgstr ""
3723
3724 #. type: Plain text
3725 #: build/C/man2/mprotect.2:142
3726 msgid ""
3727 "POSIX.1-2001 says that an implementation may permit access other than that "
3728 "specified in I<prot>, but at a minimum can only allow write access if "
3729 "B<PROT_WRITE> has been set, and must not allow any access if B<PROT_NONE> "
3730 "has been set."
3731 msgstr ""
3732
3733 #. type: Plain text
3734 #: build/C/man2/mprotect.2:148
3735 msgid ""
3736 "The program below allocates four pages of memory, makes the third of these "
3737 "pages read-only, and then executes a loop that walks upward through the "
3738 "allocated region modifying bytes."
3739 msgstr ""
3740
3741 #. type: Plain text
3742 #: build/C/man2/mprotect.2:151
3743 msgid "An example of what we might see when running the program is the following:"
3744 msgstr ""
3745
3746 #. type: Plain text
3747 #: build/C/man2/mprotect.2:157
3748 #, no-wrap
3749 msgid ""
3750 "$B< ./a.out>\n"
3751 "Start of region:        0x804c000\n"
3752 "Got SIGSEGV at address: 0x804e000\n"
3753 msgstr ""
3754
3755 #. type: Plain text
3756 #: build/C/man2/mprotect.2:169
3757 #, no-wrap
3758 msgid ""
3759 "#include E<lt>unistd.hE<gt>\n"
3760 "#include E<lt>signal.hE<gt>\n"
3761 "#include E<lt>stdio.hE<gt>\n"
3762 "#include E<lt>malloc.hE<gt>\n"
3763 "#include E<lt>stdlib.hE<gt>\n"
3764 "#include E<lt>errno.hE<gt>\n"
3765 "#include E<lt>sys/mman.hE<gt>\n"
3766 msgstr ""
3767
3768 #. type: Plain text
3769 #: build/C/man2/mprotect.2:174
3770 #, no-wrap
3771 msgid "char *buffer;\n"
3772 msgstr ""
3773
3774 #. type: Plain text
3775 #: build/C/man2/mprotect.2:182
3776 #, no-wrap
3777 msgid ""
3778 "static void\n"
3779 "handler(int sig, siginfo_t *si, void *unused)\n"
3780 "{\n"
3781 "    printf(\"Got SIGSEGV at address: 0x%lx\\en\",\n"
3782 "            (long) si-E<gt>si_addr);\n"
3783 "    exit(EXIT_FAILURE);\n"
3784 "}\n"
3785 msgstr ""
3786
3787 #. type: Plain text
3788 #: build/C/man2/mprotect.2:189
3789 #, no-wrap
3790 msgid ""
3791 "int\n"
3792 "main(int argc, char *argv[])\n"
3793 "{\n"
3794 "    char *p;\n"
3795 "    int pagesize;\n"
3796 "    struct sigaction sa;\n"
3797 msgstr ""
3798
3799 #. type: Plain text
3800 #: build/C/man2/mprotect.2:195
3801 #, no-wrap
3802 msgid ""
3803 "    sa.sa_flags = SA_SIGINFO;\n"
3804 "    sigemptyset(&sa.sa_mask);\n"
3805 "    sa.sa_sigaction = handler;\n"
3806 "    if (sigaction(SIGSEGV, &sa, NULL) == -1)\n"
3807 "        handle_error(\"sigaction\");\n"
3808 msgstr ""
3809
3810 #. type: Plain text
3811 #: build/C/man2/mprotect.2:199
3812 #, no-wrap
3813 msgid ""
3814 "    pagesize = sysconf(_SC_PAGE_SIZE);\n"
3815 "    if (pagesize == -1)\n"
3816 "        handle_error(\"sysconf\");\n"
3817 msgstr ""
3818
3819 #. type: Plain text
3820 #: build/C/man2/mprotect.2:202
3821 #, no-wrap
3822 msgid ""
3823 "    /* Allocate a buffer aligned on a page boundary;\n"
3824 "       initial protection is PROT_READ | PROT_WRITE */\n"
3825 msgstr ""
3826
3827 #. type: Plain text
3828 #: build/C/man2/mprotect.2:206
3829 #, no-wrap
3830 msgid ""
3831 "    buffer = memalign(pagesize, 4 * pagesize);\n"
3832 "    if (buffer == NULL)\n"
3833 "        handle_error(\"memalign\");\n"
3834 msgstr ""
3835
3836 #. type: Plain text
3837 #: build/C/man2/mprotect.2:208
3838 #, no-wrap
3839 msgid "    printf(\"Start of region:        0x%lx\\en\", (long) buffer);\n"
3840 msgstr ""
3841
3842 #. type: Plain text
3843 #: build/C/man2/mprotect.2:212
3844 #, no-wrap
3845 msgid ""
3846 "    if (mprotect(buffer + pagesize * 2, pagesize,\n"
3847 "                PROT_READ) == -1)\n"
3848 "        handle_error(\"mprotect\");\n"
3849 msgstr ""
3850
3851 #. type: Plain text
3852 #: build/C/man2/mprotect.2:215
3853 #, no-wrap
3854 msgid ""
3855 "    for (p = buffer ; ; )\n"
3856 "        *(p++) = \\(aqa\\(aq;\n"
3857 msgstr ""
3858
3859 #. type: Plain text
3860 #: build/C/man2/mprotect.2:219
3861 #, no-wrap
3862 msgid ""
3863 "    printf(\"Loop completed\\en\");     /* Should never happen */\n"
3864 "    exit(EXIT_SUCCESS);\n"
3865 "}\n"
3866 msgstr ""
3867
3868 #. type: Plain text
3869 #: build/C/man2/mprotect.2:223
3870 msgid "B<mmap>(2), B<sysconf>(3)"
3871 msgstr ""
3872
3873 #. type: TH
3874 #: build/C/man2/mremap.2:31
3875 #, no-wrap
3876 msgid "MREMAP"
3877 msgstr ""
3878
3879 #. type: TH
3880 #: build/C/man2/mremap.2:31
3881 #, no-wrap
3882 msgid "2010-06-10"
3883 msgstr ""
3884
3885 #. type: Plain text
3886 #: build/C/man2/mremap.2:34
3887 msgid "mremap - remap a virtual memory address"
3888 msgstr ""
3889
3890 #. type: Plain text
3891 #: build/C/man2/mremap.2:37
3892 #, no-wrap
3893 msgid "B<#define _GNU_SOURCE>         /* See feature_test_macros(7) */\n"
3894 msgstr ""
3895
3896 #. type: Plain text
3897 #: build/C/man2/mremap.2:42
3898 #, no-wrap
3899 msgid ""
3900 "B<void *mremap(void *>I<old_address>B<, size_t >I<old_size>B<,>\n"
3901 "B<             size_t >I<new_size>B<, int >I<flags>B<, ... /* void "
3902 "*>I<new_address>B< */);>\n"
3903 msgstr ""
3904
3905 #. type: Plain text
3906 #: build/C/man2/mremap.2:48
3907 msgid ""
3908 "B<mremap>()  expands (or shrinks) an existing memory mapping, potentially "
3909 "moving it at the same time (controlled by the I<flags> argument and the "
3910 "available virtual address space)."
3911 msgstr ""
3912
3913 #. type: Plain text
3914 #: build/C/man2/mremap.2:62
3915 msgid ""
3916 "I<old_address> is the old address of the virtual memory block that you want "
3917 "to expand (or shrink).  Note that I<old_address> has to be page aligned.  "
3918 "I<old_size> is the old size of the virtual memory block.  I<new_size> is the "
3919 "requested size of the virtual memory block after the resize.  An optional "
3920 "fifth argument, I<new_address>, may be provided; see the description of "
3921 "B<MREMAP_FIXED> below."
3922 msgstr ""
3923
3924 #. type: Plain text
3925 #: build/C/man2/mremap.2:74
3926 msgid ""
3927 "In Linux the memory is divided into pages.  A user process has (one or)  "
3928 "several linear virtual memory segments.  Each virtual memory segment has one "
3929 "or more mappings to real memory pages (in the page table).  Each virtual "
3930 "memory segment has its own protection (access rights), which may cause a "
3931 "segmentation violation if the memory is accessed incorrectly (e.g., writing "
3932 "to a read-only segment).  Accessing virtual memory outside of the segments "
3933 "will also cause a segmentation violation."
3934 msgstr ""
3935
3936 #. type: Plain text
3937 #: build/C/man2/mremap.2:82
3938 msgid ""
3939 "B<mremap>()  uses the Linux page table scheme.  B<mremap>()  changes the "
3940 "mapping between virtual addresses and memory pages.  This can be used to "
3941 "implement a very efficient B<realloc>(3)."
3942 msgstr ""
3943
3944 #. type: Plain text
3945 #: build/C/man2/mremap.2:84
3946 msgid "The I<flags> bit-mask argument may be 0, or include the following flag:"
3947 msgstr ""
3948
3949 #. type: TP
3950 #: build/C/man2/mremap.2:84
3951 #, no-wrap
3952 msgid "B<MREMAP_MAYMOVE>"
3953 msgstr ""
3954
3955 #. type: Plain text
3956 #: build/C/man2/mremap.2:96
3957 msgid ""
3958 "By default, if there is not sufficient space to expand a mapping at its "
3959 "current location, then B<mremap>()  fails.  If this flag is specified, then "
3960 "the kernel is permitted to relocate the mapping to a new virtual address, if "
3961 "necessary.  If the mapping is relocated, then absolute pointers into the old "
3962 "mapping location become invalid (offsets relative to the starting address of "
3963 "the mapping should be employed)."
3964 msgstr ""
3965
3966 #. type: TP
3967 #: build/C/man2/mremap.2:96
3968 #, no-wrap
3969 msgid "B<MREMAP_FIXED> (since Linux 2.3.31)"
3970 msgstr ""
3971
3972 #. type: Plain text
3973 #: build/C/man2/mremap.2:118
3974 msgid ""
3975 "This flag serves a similar purpose to the B<MAP_FIXED> flag of B<mmap>(2).  "
3976 "If this flag is specified, then B<mremap>()  accepts a fifth argument, "
3977 "I<void *new_address>, which specifies a page-aligned address to which the "
3978 "mapping must be moved.  Any previous mapping at the address range specified "
3979 "by I<new_address> and I<new_size> is unmapped.  If B<MREMAP_FIXED> is "
3980 "specified, then B<MREMAP_MAYMOVE> must also be specified."
3981 msgstr ""
3982
3983 #. type: Plain text
3984 #: build/C/man2/mremap.2:128
3985 msgid ""
3986 "If the memory segment specified by I<old_address> and I<old_size> is locked "
3987 "(using B<mlock>(2)  or similar), then this lock is maintained when the "
3988 "segment is resized and/or relocated.  As a consequence, the amount of memory "
3989 "locked by the process may change."
3990 msgstr ""
3991
3992 #. type: Plain text
3993 #: build/C/man2/mremap.2:136
3994 msgid ""
3995 "On success B<mremap>()  returns a pointer to the new virtual memory area.  "
3996 "On error, the value B<MAP_FAILED> (that is, I<(void\\ *)\\ -1>) is returned, "
3997 "and I<errno> is set appropriately."
3998 msgstr ""
3999
4000 #. type: Plain text
4001 #: build/C/man2/mremap.2:143
4002 msgid ""
4003 "The caller tried to expand a memory segment that is locked, but this was not "
4004 "possible without exceeding the B<RLIMIT_MEMLOCK> resource limit."
4005 msgstr ""
4006
4007 #. type: Plain text
4008 #: build/C/man2/mremap.2:152
4009 msgid ""
4010 "\"Segmentation fault.\" Some address in the range I<old_address> to "
4011 "I<old_address>+I<old_size> is an invalid virtual memory address for this "
4012 "process.  You can also get B<EFAULT> even if there exist mappings that cover "
4013 "the whole address space requested, but those mappings are of different "
4014 "types."
4015 msgstr ""
4016
4017 #. type: Plain text
4018 #: build/C/man2/mremap.2:180
4019 msgid ""
4020 "An invalid argument was given.  Possible causes are: I<old_address> was not "
4021 "page aligned; a value other than B<MREMAP_MAYMOVE> or B<MREMAP_FIXED> was "
4022 "specified in I<flags>; I<new_size> was zero; I<new_size> or I<new_address> "
4023 "was invalid; or the new address range specified by I<new_address> and "
4024 "I<new_size> overlapped the old address range specified by I<old_address> and "
4025 "I<old_size>; or B<MREMAP_FIXED> was specified without also specifying "
4026 "B<MREMAP_MAYMOVE>."
4027 msgstr ""
4028
4029 #. type: Plain text
4030 #: build/C/man2/mremap.2:186
4031 msgid ""
4032 "The memory area cannot be expanded at the current virtual address, and the "
4033 "B<MREMAP_MAYMOVE> flag is not set in I<flags>.  Or, there is not enough "
4034 "(virtual) memory available."
4035 msgstr ""
4036
4037 #.  4.2BSD had a (never actually implemented)
4038 #.  .BR mremap (2)
4039 #.  call with completely different semantics.
4040 #. type: Plain text
4041 #: build/C/man2/mremap.2:192
4042 msgid ""
4043 "This call is Linux-specific, and should not be used in programs intended to "
4044 "be portable."
4045 msgstr ""
4046
4047 #. type: Plain text
4048 #: build/C/man2/mremap.2:200
4049 msgid ""
4050 "Prior to version 2.4, glibc did not expose the definition of "
4051 "B<MREMAP_FIXED>, and the prototype for B<mremap>()  did not allow for the "
4052 "I<new_address> argument."
4053 msgstr ""
4054
4055 #. type: Plain text
4056 #: build/C/man2/mremap.2:209
4057 msgid ""
4058 "B<brk>(2), B<getpagesize>(2), B<getrlimit>(2), B<mlock>(2), B<mmap>(2), "
4059 "B<sbrk>(2), B<malloc>(3), B<realloc>(3)"
4060 msgstr ""
4061
4062 #. type: Plain text
4063 #: build/C/man2/mremap.2:214
4064 msgid ""
4065 "Your favorite OS text book for more information on paged memory.  (I<Modern "
4066 "Operating Systems> by Andrew S. Tanenbaum, I<Inside Linux> by Randolf "
4067 "Bentson, I<The Design of the UNIX Operating System> by Maurice J. Bach.)"
4068 msgstr ""
4069
4070 #. type: TH
4071 #: build/C/man2/msync.2:25
4072 #, no-wrap
4073 msgid "MSYNC"
4074 msgstr ""
4075
4076 #. type: Plain text
4077 #: build/C/man2/msync.2:28
4078 msgid "msync - synchronize a file with a memory map"
4079 msgstr ""
4080
4081 #. type: Plain text
4082 #: build/C/man2/msync.2:32
4083 msgid "B<int msync(void *>I<addr>B<, size_t >I<length>B<, int >I<flags>B<);>"
4084 msgstr ""
4085
4086 #. type: Plain text
4087 #: build/C/man2/msync.2:48
4088 msgid ""
4089 "B<msync>()  flushes changes made to the in-core copy of a file that was "
4090 "mapped into memory using B<mmap>(2)  back to disk.  Without use of this call "
4091 "there is no guarantee that changes are written back before B<munmap>(2)  is "
4092 "called.  To be more precise, the part of the file that corresponds to the "
4093 "memory area starting at I<addr> and having length I<length> is updated."
4094 msgstr ""
4095
4096 #. type: Plain text
4097 #: build/C/man2/msync.2:68
4098 msgid ""
4099 "The I<flags> argument may have the bits B<MS_ASYNC>, B<MS_SYNC>, and "
4100 "B<MS_INVALIDATE> set, but not both B<MS_ASYNC> and B<MS_SYNC>.  B<MS_ASYNC> "
4101 "specifies that an update be scheduled, but the call returns immediately.  "
4102 "B<MS_SYNC> asks for an update and waits for it to complete.  "
4103 "B<MS_INVALIDATE> asks to invalidate other mappings of the same file (so that "
4104 "they can be updated with the fresh values just written)."
4105 msgstr ""
4106
4107 #. type: Plain text
4108 #: build/C/man2/msync.2:73
4109 msgid ""
4110 "On success, zero is returned.  On error, -1 is returned, and I<errno> is set "
4111 "appropriately."
4112 msgstr ""
4113
4114 #. type: TP
4115 #: build/C/man2/msync.2:74
4116 #, no-wrap
4117 msgid "B<EBUSY>"
4118 msgstr ""
4119
4120 #. type: Plain text
4121 #: build/C/man2/msync.2:80
4122 msgid ""
4123 "B<MS_INVALIDATE> was specified in I<flags>, and a memory lock exists for the "
4124 "specified address range."
4125 msgstr ""
4126
4127 #. type: Plain text
4128 #: build/C/man2/msync.2:93
4129 msgid ""
4130 "I<addr> is not a multiple of PAGESIZE; or any bit other than B<MS_ASYNC> | "
4131 "B<MS_INVALIDATE> | B<MS_SYNC> is set in I<flags>; or both B<MS_SYNC> and "
4132 "B<MS_ASYNC> are set in I<flags>."
4133 msgstr ""
4134
4135 #. type: Plain text
4136 #: build/C/man2/msync.2:96
4137 msgid "The indicated memory (or part of it) was not mapped."
4138 msgstr ""
4139
4140 #. type: Plain text
4141 #: build/C/man2/msync.2:98 build/C/man3/posix_fallocate.3:103 build/C/man3/shm_open.3:251 build/C/man7/shm_overview.7:103
4142 msgid "POSIX.1-2001."
4143 msgstr ""
4144
4145 #. type: Plain text
4146 #: build/C/man2/msync.2:105
4147 msgid ""
4148 "This call was introduced in Linux 1.3.21, and then used B<EFAULT> instead of "
4149 "B<ENOMEM>.  In Linux 2.4.19 this was changed to the POSIX value B<ENOMEM>."
4150 msgstr ""
4151
4152 #.  POSIX.1-2001: It shall be defined to -1 or 0 or 200112L.
4153 #.  -1: unavailable, 0: ask using sysconf().
4154 #.  glibc defines them to 1.
4155 #. type: Plain text
4156 #: build/C/man2/msync.2:118
4157 msgid ""
4158 "On POSIX systems on which B<msync>()  is available, both "
4159 "B<_POSIX_MAPPED_FILES> and B<_POSIX_SYNCHRONIZED_IO> are defined in "
4160 "I<E<lt>unistd.hE<gt>> to a value greater than 0.  (See also B<sysconf>(3).)"
4161 msgstr ""
4162
4163 #. type: TP
4164 #: build/C/man2/msync.2:120 build/C/man7/shm_overview.7:46
4165 #, no-wrap
4166 msgid "B<mmap>(2)"
4167 msgstr ""
4168
4169 #. type: TH
4170 #: build/C/man3/mtrace.3:23
4171 #, no-wrap
4172 msgid "MTRACE"
4173 msgstr ""
4174
4175 #. type: Plain text
4176 #: build/C/man3/mtrace.3:26
4177 msgid "mtrace, muntrace - malloc tracing"
4178 msgstr ""
4179
4180 #. type: Plain text
4181 #: build/C/man3/mtrace.3:28
4182 msgid "B<#include E<lt>mcheck.hE<gt>>"
4183 msgstr ""
4184
4185 #. type: Plain text
4186 #: build/C/man3/mtrace.3:30
4187 msgid "B<void mtrace(void);>"
4188 msgstr ""
4189
4190 #. type: Plain text
4191 #: build/C/man3/mtrace.3:32
4192 msgid "B<void muntrace(void);>"
4193 msgstr ""
4194
4195 #. type: Plain text
4196 #: build/C/man3/mtrace.3:44
4197 msgid ""
4198 "The B<mtrace>()  function installs hook functions for the memory-allocation "
4199 "functions (B<malloc>(3), B<realloc>(3)  B<memalign>(3), B<free>(3)).  These "
4200 "hook functions record tracing information about memory allocation and "
4201 "deallocation.  The tracing information can be used to discover memory leaks "
4202 "and attempts to free nonallocated memory in a program."
4203 msgstr ""
4204
4205 #. type: Plain text
4206 #: build/C/man3/mtrace.3:55
4207 msgid ""
4208 "The B<muntrace>()  function disables the hook functions installed by "
4209 "B<mtrace>(), so that tracing information is no longer recorded for the "
4210 "memory-allocation functions.  If no hook functions were successfully "
4211 "installed by B<mtrace>(), B<muntrace>()  does nothing."
4212 msgstr ""
4213
4214 #. type: Plain text
4215 #: build/C/man3/mtrace.3:63
4216 msgid ""
4217 "When B<mtrace>(3)  is called, it checks the value of the environment "
4218 "variable B<MALLOC_TRACE>, which should contain the pathname of a file in "
4219 "which the tracing information is to be recorded.  If the pathname is "
4220 "successfully opened, it is truncated to zero length."
4221 msgstr ""
4222
4223 #. type: Plain text
4224 #: build/C/man3/mtrace.3:76
4225 msgid ""
4226 "If B<MALLOC_TRACE> is not set, or the pathname it specifies is invalid or "
4227 "not writable, then no hook functions are installed, and B<mtrace>()  has no "
4228 "effect.  In set-user-ID and set-group-ID programs, B<MALLOC_TRACE> is "
4229 "ignored, and B<mtrace>()  has no effect."
4230 msgstr ""
4231
4232 #. type: Plain text
4233 #: build/C/man3/mtrace.3:84
4234 msgid ""
4235 "In normal usage, B<mtrace>()  is called once at the start of execution of a "
4236 "program, and B<muntrace>()  is never called."
4237 msgstr ""
4238
4239 #. type: Plain text
4240 #: build/C/man3/mtrace.3:94
4241 msgid ""
4242 "The tracing output produced after a call to B<mtrace>()  is textual, but not "
4243 "designed to be human readable.  The GNU C library provides a Perl script, "
4244 "B<mtrace>(1), that interprets the trace log and produces human-readable "
4245 "output.  For best results, the traced program should be compiled with "
4246 "debugging enabled, so that line-number information is recorded in the "
4247 "executable."
4248 msgstr ""
4249
4250 #. type: Plain text
4251 #: build/C/man3/mtrace.3:100
4252 msgid ""
4253 "The tracing performed by B<mtrace>()  incurs a performance penalty (if "
4254 "B<MALLOC_TRACE> points to a valid, writable pathname)."
4255 msgstr ""
4256
4257 #. type: Plain text
4258 #: build/C/man3/mtrace.3:106
4259 msgid ""
4260 "The line-number information produced by B<mtrace>(1)  is not always precise: "
4261 "the line number references may refer to the previous or following "
4262 "(non-blank)  line of the source code."
4263 msgstr ""
4264
4265 #. type: Plain text
4266 #: build/C/man3/mtrace.3:113
4267 msgid ""
4268 "The shell session below demonstrates the use of the B<mtrace>()  function "
4269 "and the B<mtrace>(1)  command in a program that has memory leaks at two "
4270 "different locations.  The demonstration uses the following program:"
4271 msgstr ""
4272
4273 #. type: Plain text
4274 #: build/C/man3/mtrace.3:120
4275 #, no-wrap
4276 msgid ""
4277 "$ B<cat t_mtrace.c>\n"
4278 "#include E<lt>mcheck.hE<gt>\n"
4279 "#include E<lt>stdlib.hE<gt>\n"
4280 "#include E<lt>stdio.hE<gt>\n"
4281 msgstr ""
4282
4283 #. type: Plain text
4284 #: build/C/man3/mtrace.3:125
4285 #, no-wrap
4286 msgid ""
4287 "int\n"
4288 "main(int argc, char *argv[])\n"
4289 "{\n"
4290 "    int j;\n"
4291 msgstr ""
4292
4293 #. type: Plain text
4294 #: build/C/man3/mtrace.3:127
4295 #, no-wrap
4296 msgid "    mtrace();\n"
4297 msgstr ""
4298
4299 #. type: Plain text
4300 #: build/C/man3/mtrace.3:130
4301 #, no-wrap
4302 msgid ""
4303 "    for (j = 0; j E<lt> 2; j++)\n"
4304 "        malloc(100);            /* Never freed--a memory leak */\n"
4305 msgstr ""
4306
4307 #. type: Plain text
4308 #: build/C/man3/mtrace.3:134
4309 #, no-wrap
4310 msgid ""
4311 "    calloc(16, 16);             /* Never freed--a memory leak */\n"
4312 "    exit(EXIT_SUCCESS);\n"
4313 "}\n"
4314 msgstr ""
4315
4316 #. type: Plain text
4317 #: build/C/man3/mtrace.3:140
4318 msgid ""
4319 "When we run the program as follows, we see that B<mtrace>()  diagnosed "
4320 "memory leaks at two different locations in the program:"
4321 msgstr ""
4322
4323 #. type: Plain text
4324 #: build/C/man3/mtrace.3:153
4325 #, no-wrap
4326 msgid ""
4327 "$ B<cc -g t_mtrace.c -o t_mtrace>\n"
4328 "$ B<export MALLOC_TRACE=/tmp/t>\n"
4329 "$ B<./t_mtrace>\n"
4330 "$ B<mtrace ./t_mtrace $MALLOC_TRACE>\n"
4331 "Memory not freed:\n"
4332 "-----------------\n"
4333 "   Address     Size     Caller\n"
4334 "0x084c9378     0x64  at /home/cecilia/t_mtrace.c:12\n"
4335 "0x084c93e0     0x64  at /home/cecilia/t_mtrace.c:12\n"
4336 "0x084c9448    0x100  at /home/cecilia/t_mtrace.c:16\n"
4337 msgstr ""
4338
4339 #. type: Plain text
4340 #: build/C/man3/mtrace.3:165
4341 msgid ""
4342 "The first two messages about unfreed memory correspond to the two "
4343 "B<malloc>(3)  calls inside the I<for> loop.  The final message corresponds "
4344 "to the call to B<calloc>(3)  (which in turn calls B<malloc>(3))."
4345 msgstr ""
4346
4347 #. type: Plain text
4348 #: build/C/man3/mtrace.3:169
4349 msgid "B<mtrace>(1), B<malloc>(3), B<malloc_hook>(3)"
4350 msgstr ""
4351
4352 #. type: TH
4353 #: build/C/man2/posix_fadvise.2:27
4354 #, no-wrap
4355 msgid "POSIX_FADVISE"
4356 msgstr ""
4357
4358 #. type: TH
4359 #: build/C/man2/posix_fadvise.2:27 build/C/man2/sync_file_range.2:30
4360 #, no-wrap
4361 msgid "2010-10-09"
4362 msgstr ""
4363
4364 #. type: Plain text
4365 #: build/C/man2/posix_fadvise.2:30
4366 msgid "posix_fadvise - predeclare an access pattern for file data"
4367 msgstr ""
4368
4369 #. type: Plain text
4370 #: build/C/man2/posix_fadvise.2:33 build/C/man3/posix_fallocate.3:29
4371 #, no-wrap
4372 msgid "B<#include E<lt>fcntl.hE<gt>>\n"
4373 msgstr ""
4374
4375 #. type: Plain text
4376 #: build/C/man2/posix_fadvise.2:36
4377 #, no-wrap
4378 msgid ""
4379 "B<int posix_fadvise(int >I<fd>B<, off_t >I<offset>B<, off_t >I<len>B<, int "
4380 ">I<advice>B<);>\n"
4381 msgstr ""
4382
4383 #. type: Plain text
4384 #: build/C/man2/posix_fadvise.2:45
4385 msgid "B<posix_fadvise>():"
4386 msgstr ""
4387
4388 #. type: Plain text
4389 #: build/C/man2/posix_fadvise.2:47 build/C/man3/posix_fallocate.3:42
4390 msgid "_XOPEN_SOURCE\\ E<gt>=\\ 600 || _POSIX_C_SOURCE\\ E<gt>=\\ 200112L"
4391 msgstr ""
4392
4393 #. type: Plain text
4394 #: build/C/man2/posix_fadvise.2:55
4395 msgid ""
4396 "Programs can use B<posix_fadvise>()  to announce an intention to access file "
4397 "data in a specific pattern in the future, thus allowing the kernel to "
4398 "perform appropriate optimizations."
4399 msgstr ""
4400
4401 #. type: Plain text
4402 #: build/C/man2/posix_fadvise.2:62
4403 msgid ""
4404 "The I<advice> applies to a (not necessarily existent) region starting at "
4405 "I<offset> and extending for I<len> bytes (or until the end of the file if "
4406 "I<len> is 0) within the file referred to by I<fd>.  The I<advice> is not "
4407 "binding; it merely constitutes an expectation on behalf of the application."
4408 msgstr ""
4409
4410 #. type: Plain text
4411 #: build/C/man2/posix_fadvise.2:64
4412 msgid "Permissible values for I<advice> include:"
4413 msgstr ""
4414
4415 #. type: TP
4416 #: build/C/man2/posix_fadvise.2:64
4417 #, no-wrap
4418 msgid "B<POSIX_FADV_NORMAL>"
4419 msgstr ""
4420
4421 #. type: Plain text
4422 #: build/C/man2/posix_fadvise.2:70
4423 msgid ""
4424 "Indicates that the application has no advice to give about its access "
4425 "pattern for the specified data.  If no advice is given for an open file, "
4426 "this is the default assumption."
4427 msgstr ""
4428
4429 #. type: TP
4430 #: build/C/man2/posix_fadvise.2:70
4431 #, no-wrap
4432 msgid "B<POSIX_FADV_SEQUENTIAL>"
4433 msgstr ""
4434
4435 #. type: Plain text
4436 #: build/C/man2/posix_fadvise.2:74
4437 msgid ""
4438 "The application expects to access the specified data sequentially (with "
4439 "lower offsets read before higher ones)."
4440 msgstr ""
4441
4442 #. type: TP
4443 #: build/C/man2/posix_fadvise.2:74
4444 #, no-wrap
4445 msgid "B<POSIX_FADV_RANDOM>"
4446 msgstr ""
4447
4448 #. type: Plain text
4449 #: build/C/man2/posix_fadvise.2:77
4450 msgid "The specified data will be accessed in random order."
4451 msgstr ""
4452
4453 #. type: TP
4454 #: build/C/man2/posix_fadvise.2:77
4455 #, no-wrap
4456 msgid "B<POSIX_FADV_NOREUSE>"
4457 msgstr ""
4458
4459 #. type: Plain text
4460 #: build/C/man2/posix_fadvise.2:80
4461 msgid "The specified data will be accessed only once."
4462 msgstr ""
4463
4464 #. type: TP
4465 #: build/C/man2/posix_fadvise.2:80
4466 #, no-wrap
4467 msgid "B<POSIX_FADV_WILLNEED>"
4468 msgstr ""
4469
4470 #. type: Plain text
4471 #: build/C/man2/posix_fadvise.2:83
4472 msgid "The specified data will be accessed in the near future."
4473 msgstr ""
4474
4475 #. type: TP
4476 #: build/C/man2/posix_fadvise.2:83
4477 #, no-wrap
4478 msgid "B<POSIX_FADV_DONTNEED>"
4479 msgstr ""
4480
4481 #. type: Plain text
4482 #: build/C/man2/posix_fadvise.2:86
4483 msgid "The specified data will not be accessed in the near future."
4484 msgstr ""
4485
4486 #. type: Plain text
4487 #: build/C/man2/posix_fadvise.2:89
4488 msgid "On success, zero is returned.  On error, an error number is returned."
4489 msgstr ""
4490
4491 #. type: Plain text
4492 #: build/C/man2/posix_fadvise.2:93
4493 msgid "The I<fd> argument was not a valid file descriptor."
4494 msgstr ""
4495
4496 #. type: Plain text
4497 #: build/C/man2/posix_fadvise.2:96
4498 msgid "An invalid value was specified for I<advice>."
4499 msgstr ""
4500
4501 #. type: Plain text
4502 #: build/C/man2/posix_fadvise.2:103
4503 msgid ""
4504 "The specified file descriptor refers to a pipe or FIFO.  (Linux actually "
4505 "returns B<EINVAL> in this case.)"
4506 msgstr ""
4507
4508 #.  of fadvise64_64()
4509 #. type: Plain text
4510 #: build/C/man2/posix_fadvise.2:111
4511 msgid ""
4512 "Kernel support first appeared in Linux 2.5.60; the underlying system call is "
4513 "called B<fadvise64>().  Library support has been provided since glibc "
4514 "version 2.2, via the wrapper function B<posix_fadvise>()."
4515 msgstr ""
4516
4517 #. type: Plain text
4518 #: build/C/man2/posix_fadvise.2:120
4519 msgid ""
4520 "POSIX.1-2001.  Note that the type of the I<len> argument was changed from "
4521 "I<size_t> to I<off_t> in POSIX.1-2003 TC1."
4522 msgstr ""
4523
4524 #. type: Plain text
4525 #: build/C/man2/posix_fadvise.2:126
4526 msgid ""
4527 "Under Linux, B<POSIX_FADV_NORMAL> sets the readahead window to the default "
4528 "size for the backing device; B<POSIX_FADV_SEQUENTIAL> doubles this size, and "
4529 "B<POSIX_FADV_RANDOM> disables file readahead entirely.  These changes affect "
4530 "the entire file, not just the specified region (but other open file handles "
4531 "to the same file are unaffected)."
4532 msgstr ""
4533
4534 #. type: Plain text
4535 #: build/C/man2/posix_fadvise.2:133
4536 msgid ""
4537 "B<POSIX_FADV_WILLNEED> initiates a nonblocking read of the specified region "
4538 "into the page cache.  The amount of data read may be decreased by the kernel "
4539 "depending on virtual memory load.  (A few megabytes will usually be fully "
4540 "satisfied, and more is rarely useful.)"
4541 msgstr ""
4542
4543 #. type: Plain text
4544 #: build/C/man2/posix_fadvise.2:137
4545 msgid ""
4546 "In kernels before 2.6.18, B<POSIX_FADV_NOREUSE> had the same semantics as "
4547 "B<POSIX_FADV_WILLNEED>.  This was probably a bug; since kernel 2.6.18, this "
4548 "flag is a no-op."
4549 msgstr ""
4550
4551 #. type: Plain text
4552 #: build/C/man2/posix_fadvise.2:145
4553 msgid ""
4554 "B<POSIX_FADV_DONTNEED> attempts to free cached pages associated with the "
4555 "specified region.  This is useful, for example, while streaming large "
4556 "files.  A program may periodically request the kernel to free cached data "
4557 "that has already been used, so that more useful cached pages are not "
4558 "discarded instead."
4559 msgstr ""
4560
4561 #. type: Plain text
4562 #: build/C/man2/posix_fadvise.2:153
4563 msgid ""
4564 "Pages that have not yet been written out will be unaffected, so if the "
4565 "application wishes to guarantee that pages will be released, it should call "
4566 "B<fsync>(2)  or B<fdatasync>(2)  first."
4567 msgstr ""
4568
4569 #. type: SS
4570 #: build/C/man2/posix_fadvise.2:153
4571 #, no-wrap
4572 msgid "arm_fadvise()"
4573 msgstr ""
4574
4575 #. type: Plain text
4576 #: build/C/man2/posix_fadvise.2:165
4577 msgid ""
4578 "The ARM architecture needs 64-bit arguments to be aligned in a suitable pair "
4579 "of registers.  On this architecture, the call signature of "
4580 "B<posix_fadvise>()  is flawed, since it forces a register to be wasted as "
4581 "padding between the I<fd> and I<len> arguments.  Therefore, since Linux "
4582 "2.6.14, ARM defines a different system call that orders the arguments "
4583 "suitably:"
4584 msgstr ""
4585
4586 #. type: Plain text
4587 #: build/C/man2/posix_fadvise.2:170
4588 #, no-wrap
4589 msgid ""
4590 "B<long arm_fadvise64_64(int >I<fd>B<, int >I<advice>B<,>\n"
4591 "B<                      loff_t >I<offset>B<, loff_t >I<len>B<);>\n"
4592 msgstr ""
4593
4594 #.  No ARM support in glibc.
4595 #. type: Plain text
4596 #: build/C/man2/posix_fadvise.2:177
4597 msgid ""
4598 "The behavior of this system call is otherwise exactly the same as "
4599 "B<posix_fadvise>().  No library support is provided for this system call in "
4600 "glibc."
4601 msgstr ""
4602
4603 #. type: Plain text
4604 #: build/C/man2/posix_fadvise.2:182
4605 msgid ""
4606 "In kernels before 2.6.6, if I<len> was specified as 0, then this was "
4607 "interpreted literally as \"zero bytes\", rather than as meaning \"all bytes "
4608 "through to the end of the file\"."
4609 msgstr ""
4610
4611 #.  FIXME . Write a posix_fadvise(3) page.
4612 #. type: Plain text
4613 #: build/C/man2/posix_fadvise.2:188
4614 msgid ""
4615 "B<readahead>(2), B<sync_file_range>(2), B<posix_fallocate>(3), "
4616 "B<posix_madvise>(3)"
4617 msgstr ""
4618
4619 #. type: TH
4620 #: build/C/man3/posix_fallocate.3:23
4621 #, no-wrap
4622 msgid "POSIX_FALLOCATE"
4623 msgstr ""
4624
4625 #. type: TH
4626 #: build/C/man3/posix_fallocate.3:23
4627 #, no-wrap
4628 msgid "2010-09-20"
4629 msgstr ""
4630
4631 #. type: Plain text
4632 #: build/C/man3/posix_fallocate.3:26
4633 msgid "posix_fallocate - allocate file space"
4634 msgstr ""
4635
4636 #. type: Plain text
4637 #: build/C/man3/posix_fallocate.3:31
4638 #, no-wrap
4639 msgid "B<int posix_fallocate(int >I<fd>B<, off_t >I<offset>B<, off_t >I<len>B<);>\n"
4640 msgstr ""
4641
4642 #. type: Plain text
4643 #: build/C/man3/posix_fallocate.3:40
4644 msgid "B<posix_fallocate>():"
4645 msgstr ""
4646
4647 #. type: Plain text
4648 #: build/C/man3/posix_fallocate.3:59
4649 msgid ""
4650 "The function B<posix_fallocate>()  ensures that disk space is allocated for "
4651 "the file referred to by the descriptor I<fd> for the bytes in the range "
4652 "starting at I<offset> and continuing for I<len> bytes.  After a successful "
4653 "call to B<posix_fallocate>(), subsequent writes to bytes in the specified "
4654 "range are guaranteed not to fail because of lack of disk space."
4655 msgstr ""
4656
4657 #. type: Plain text
4658 #: build/C/man3/posix_fallocate.3:64
4659 msgid ""
4660 "If the size of the file is less than I<offset>+I<len>, then the file is "
4661 "increased to this size; otherwise the file size is left unchanged."
4662 msgstr ""
4663
4664 #. type: Plain text
4665 #: build/C/man3/posix_fallocate.3:70
4666 msgid ""
4667 "B<posix_fallocate>()  returns zero on success, or an error number on "
4668 "failure.  Note that I<errno> is not set."
4669 msgstr ""
4670
4671 #. type: Plain text
4672 #: build/C/man3/posix_fallocate.3:79
4673 msgid "I<offset+len> exceeds the maximum file size."
4674 msgstr ""
4675
4676 #. type: Plain text
4677 #: build/C/man3/posix_fallocate.3:89
4678 msgid "I<fd> does not refer to a regular file."
4679 msgstr ""
4680
4681 #. type: Plain text
4682 #: build/C/man3/posix_fallocate.3:98
4683 msgid "I<fd> refers to a pipe."
4684 msgstr ""
4685
4686 #. type: Plain text
4687 #: build/C/man3/posix_fallocate.3:101
4688 msgid "B<posix_fallocate>()  is available since glibc 2.1.94."
4689 msgstr ""
4690
4691 #. type: Plain text
4692 #: build/C/man3/posix_fallocate.3:126
4693 msgid ""
4694 "POSIX.1-2008 says that an implementation I<shall> give the B<EINVAL> error "
4695 "if I<len> was 0, or I<offset> was less than 0.  POSIX.1-2001 says that an "
4696 "implementation I<shall> give the B<EINVAL> error if I<len> is less than 0, "
4697 "or I<offset> was less than 0, and I<may> give the error if I<len> equals "
4698 "zero."
4699 msgstr ""
4700
4701 #. type: Plain text
4702 #: build/C/man3/posix_fallocate.3:130
4703 msgid "B<fallocate>(2), B<lseek>(2), B<posix_fadvise>(2)"
4704 msgstr ""
4705
4706 #. type: TH
4707 #: build/C/man3/posix_memalign.3:28
4708 #, no-wrap
4709 msgid "POSIX_MEMALIGN"
4710 msgstr ""
4711
4712 #. type: TH
4713 #: build/C/man3/posix_memalign.3:28
4714 #, no-wrap
4715 msgid "2012-03-23"
4716 msgstr ""
4717
4718 #. type: Plain text
4719 #: build/C/man3/posix_memalign.3:31
4720 msgid ""
4721 "posix_memalign, aligned_alloc, memalign, valloc, pvalloc - Allocate aligned "
4722 "memory"
4723 msgstr ""
4724
4725 #. type: Plain text
4726 #: build/C/man3/posix_memalign.3:34
4727 #, no-wrap
4728 msgid "B<#include E<lt>stdlib.hE<gt>>\n"
4729 msgstr ""
4730
4731 #. type: Plain text
4732 #: build/C/man3/posix_memalign.3:38
4733 #, no-wrap
4734 msgid ""
4735 "B<int posix_memalign(void **>I<memptr>B<, size_t >I<alignment>B<, size_t "
4736 ">I<size>B<);>\n"
4737 "B<void *aligned_alloc(size_t >I<alignment>B<, size_t >I<size>B<);>\n"
4738 "B<void *valloc(size_t >I<size>B<);>\n"
4739 msgstr ""
4740
4741 #. type: Plain text
4742 #: build/C/man3/posix_memalign.3:43
4743 #, no-wrap
4744 msgid ""
4745 "B<void *memalign(size_t >I<alignment>B<, size_t >I<size>B<);>\n"
4746 "B<void *pvalloc(size_t >I<size>B<);>\n"
4747 msgstr ""
4748
4749 #. type: Plain text
4750 #: build/C/man3/posix_memalign.3:53
4751 msgid ""
4752 "B<posix_memalign>(): _POSIX_C_SOURCE\\ E<gt>=\\ 200112L || _XOPEN_SOURCE\\ "
4753 "E<gt>=\\ 600"
4754 msgstr ""
4755
4756 #. type: Plain text
4757 #: build/C/man3/posix_memalign.3:56
4758 msgid "B<aligned_alloc>(): _ISOC11_SOURCE"
4759 msgstr ""
4760
4761 #. type: Plain text
4762 #: build/C/man3/posix_memalign.3:58
4763 msgid "B<valloc>():"
4764 msgstr ""
4765
4766 #. type: TP
4767 #: build/C/man3/posix_memalign.3:61
4768 #, no-wrap
4769 msgid "Since glibc 2.12:"
4770 msgstr ""
4771
4772 #. type: Plain text
4773 #: build/C/man3/posix_memalign.3:68
4774 #, no-wrap
4775 msgid ""
4776 "_BSD_SOURCE ||\n"
4777 "    (_XOPEN_SOURCE\\ E<gt>=\\ 500 ||\n"
4778 "        _XOPEN_SOURCE\\ &&\\ _XOPEN_SOURCE_EXTENDED) &&\n"
4779 "    !(_POSIX_C_SOURCE\\ E<gt>=\\ 200112L || _XOPEN_SOURCE\\ E<gt>=\\ 600)\n"
4780 msgstr ""
4781
4782 #. type: TP
4783 #: build/C/man3/posix_memalign.3:70
4784 #, no-wrap
4785 msgid "Before glibc 2.12:"
4786 msgstr ""
4787
4788 #. type: Plain text
4789 #: build/C/man3/posix_memalign.3:74
4790 msgid ""
4791 "_BSD_SOURCE || _XOPEN_SOURCE\\ E<gt>=\\ 500 || _XOPEN_SOURCE\\ &&\\ "
4792 "_XOPEN_SOURCE_EXTENDED"
4793 msgstr ""
4794
4795 #. type: Plain text
4796 #: build/C/man3/posix_memalign.3:81
4797 msgid ""
4798 "(The (nonstandard) header file I<E<lt>malloc.hE<gt>> also exposes the "
4799 "declaration of B<valloc>(); no feature test macros are required.)"
4800 msgstr ""
4801
4802 #.  glibc does this:
4803 #. type: Plain text
4804 #: build/C/man3/posix_memalign.3:102
4805 msgid ""
4806 "The function B<posix_memalign>()  allocates I<size> bytes and places the "
4807 "address of the allocated memory in I<*memptr>.  The address of the allocated "
4808 "memory will be a multiple of I<alignment>, which must be a power of two and "
4809 "a multiple of I<sizeof(void *)>.  If I<size> is 0, then B<posix_memalign>()  "
4810 "returns either NULL, or a unique pointer value that can later be "
4811 "successfully passed to B<free>(3)."
4812 msgstr ""
4813
4814 #.  The behavior of memalign() for size==0 is as for posix_memalign()
4815 #.  but no standards govern this.
4816 #. type: Plain text
4817 #: build/C/man3/posix_memalign.3:113
4818 msgid ""
4819 "The obsolete function B<memalign>()  allocates I<size> bytes and returns a "
4820 "pointer to the allocated memory.  The memory address will be a multiple of "
4821 "I<alignment>, which must be a power of two."
4822 msgstr ""
4823
4824 #. type: Plain text
4825 #: build/C/man3/posix_memalign.3:122
4826 msgid ""
4827 "The function B<aligned_alloc>()  is the same as B<memalign>(), except for "
4828 "the added restriction that I<size> should be a multiple of I<alignment>."
4829 msgstr ""
4830
4831 #. type: Plain text
4832 #: build/C/man3/posix_memalign.3:132
4833 msgid ""
4834 "The obsolete function B<valloc>()  allocates I<size> bytes and returns a "
4835 "pointer to the allocated memory.  The memory address will be a multiple of "
4836 "the page size.  It is equivalent to I<memalign(sysconf(_SC_PAGESIZE),size)>."
4837 msgstr ""
4838
4839 #. type: Plain text
4840 #: build/C/man3/posix_memalign.3:139
4841 msgid ""
4842 "The obsolete function B<pvalloc>()  is similar to B<valloc>(), but rounds "
4843 "the size of the allocation up to the next multiple of the system page size."
4844 msgstr ""
4845
4846 #. type: Plain text
4847 #: build/C/man3/posix_memalign.3:141
4848 msgid "For all of these functions, the memory is not zeroed."
4849 msgstr ""
4850
4851 #. type: Plain text
4852 #: build/C/man3/posix_memalign.3:148
4853 msgid ""
4854 "B<aligned_alloc>(), B<memalign>(), B<valloc>(), and B<pvalloc>()  return a "
4855 "pointer to the allocated memory, or NULL if the request fails."
4856 msgstr ""
4857
4858 #. type: Plain text
4859 #: build/C/man3/posix_memalign.3:155
4860 msgid ""
4861 "B<posix_memalign>()  returns zero on success, or one of the error values "
4862 "listed in the next section on failure.  Note that I<errno> is not set."
4863 msgstr ""
4864
4865 #. type: Plain text
4866 #: build/C/man3/posix_memalign.3:162
4867 msgid ""
4868 "The I<alignment> argument was not a power of two, or was not a multiple of "
4869 "I<sizeof(void *)>."
4870 msgstr ""
4871
4872 #. type: Plain text
4873 #: build/C/man3/posix_memalign.3:165
4874 msgid "There was insufficient memory to fulfill the allocation request."
4875 msgstr ""
4876
4877 #. type: Plain text
4878 #: build/C/man3/posix_memalign.3:172
4879 msgid ""
4880 "The functions B<memalign>(), B<valloc>(), and B<pvalloc>()  have been "
4881 "available in all Linux libc libraries."
4882 msgstr ""
4883
4884 #. type: Plain text
4885 #: build/C/man3/posix_memalign.3:176
4886 msgid "The function B<aligned_alloc>()  was added to glibc in version 2.16."
4887 msgstr ""
4888
4889 #. type: Plain text
4890 #: build/C/man3/posix_memalign.3:180
4891 msgid "The function B<posix_memalign>()  is available since glibc 2.1.91."
4892 msgstr ""
4893
4894 #. type: Plain text
4895 #: build/C/man3/posix_memalign.3:187
4896 msgid ""
4897 "The function B<valloc>()  appeared in 3.0BSD.  It is documented as being "
4898 "obsolete in 4.3BSD, and as legacy in SUSv2.  It does not appear in "
4899 "POSIX.1-2001."
4900 msgstr ""
4901
4902 #. type: Plain text
4903 #: build/C/man3/posix_memalign.3:191
4904 msgid "The function B<pvalloc>()  is a GNU extension."
4905 msgstr ""
4906
4907 #. type: Plain text
4908 #: build/C/man3/posix_memalign.3:195
4909 msgid "The function B<memalign>()  appears in SunOS 4.1.3 but not in 4.4BSD."
4910 msgstr ""
4911
4912 #. type: Plain text
4913 #: build/C/man3/posix_memalign.3:199
4914 msgid "The function B<posix_memalign>()  comes from POSIX.1d."
4915 msgstr ""
4916
4917 #. type: Plain text
4918 #: build/C/man3/posix_memalign.3:204
4919 msgid "The function I<aligned_alloc ()> is specified in the C11 standard."
4920 msgstr ""
4921
4922 #. type: SS
4923 #: build/C/man3/posix_memalign.3:204
4924 #, no-wrap
4925 msgid "Headers"
4926 msgstr ""
4927
4928 #. type: Plain text
4929 #: build/C/man3/posix_memalign.3:208
4930 msgid ""
4931 "Everybody agrees that B<posix_memalign>()  is declared in "
4932 "I<E<lt>stdlib.hE<gt>>."
4933 msgstr ""
4934
4935 #. type: Plain text
4936 #: build/C/man3/posix_memalign.3:212
4937 msgid ""
4938 "On some systems B<memalign>()  is declared in I<E<lt>stdlib.hE<gt>> instead "
4939 "of I<E<lt>malloc.hE<gt>>."
4940 msgstr ""
4941
4942 #. type: Plain text
4943 #: build/C/man3/posix_memalign.3:219
4944 msgid ""
4945 "According to SUSv2, B<valloc>()  is declared in I<E<lt>stdlib.hE<gt>>.  "
4946 "Libc4,5 and glibc declare it in I<E<lt>malloc.hE<gt>>, and also in "
4947 "I<E<lt>stdlib.hE<gt>> if suitable feature test macros are defined (see "
4948 "above)."
4949 msgstr ""
4950
4951 #. type: Plain text
4952 #: build/C/man3/posix_memalign.3:228
4953 msgid ""
4954 "On many systems there are alignment restrictions, for example, on buffers "
4955 "used for direct block device I/O.  POSIX specifies the "
4956 "I<pathconf(path,_PC_REC_XFER_ALIGN)> call that tells what alignment is "
4957 "needed.  Now one can use B<posix_memalign>()  to satisfy this requirement."
4958 msgstr ""
4959
4960 #. type: Plain text
4961 #: build/C/man3/posix_memalign.3:237
4962 msgid ""
4963 "B<posix_memalign>()  verifies that I<alignment> matches the requirements "
4964 "detailed above.  B<memalign>()  may not check that the I<alignment> argument "
4965 "is correct."
4966 msgstr ""
4967
4968 #.  Other systems allow passing the result of
4969 #.  .IR valloc ()
4970 #.  to
4971 #.  .IR free (3),
4972 #.  but not to
4973 #.  .IR realloc (3).
4974 #. type: Plain text
4975 #: build/C/man3/posix_memalign.3:265
4976 msgid ""
4977 "POSIX requires that memory obtained from B<posix_memalign>()  can be freed "
4978 "using B<free>(3).  Some systems provide no way to reclaim memory allocated "
4979 "with B<memalign>()  or B<valloc>()  (because one can only pass to B<free>(3)  "
4980 "a pointer gotten from B<malloc>(3), while, for example, B<memalign>()  would "
4981 "call B<malloc>(3)  and then align the obtained value).  The glibc "
4982 "implementation allows memory obtained from any of these these functions to "
4983 "be reclaimed with B<free>(3)."
4984 msgstr ""
4985
4986 #. type: Plain text
4987 #: build/C/man3/posix_memalign.3:270
4988 msgid ""
4989 "The glibc B<malloc>(3)  always returns 8-byte aligned memory addresses, so "
4990 "these functions are only needed if you require larger alignment values."
4991 msgstr ""
4992
4993 #. type: Plain text
4994 #: build/C/man3/posix_memalign.3:275
4995 msgid "B<brk>(2), B<getpagesize>(2), B<free>(3), B<malloc>(3)"
4996 msgstr ""
4997
4998 #. type: TH
4999 #: build/C/man2/readahead.2:28
5000 #, no-wrap
5001 msgid "READAHEAD"
5002 msgstr ""
5003
5004 #. type: TH
5005 #: build/C/man2/readahead.2:28 build/C/man7/shm_overview.7:27
5006 #, no-wrap
5007 msgid "2010-09-10"
5008 msgstr ""
5009
5010 #. type: Plain text
5011 #: build/C/man2/readahead.2:31
5012 msgid "readahead - perform file readahead into page cache"
5013 msgstr ""
5014
5015 #. type: Plain text
5016 #: build/C/man2/readahead.2:37
5017 #, no-wrap
5018 msgid ""
5019 "B<ssize_t readahead(int >I<fd>B<, off64_t >I<offset>B<, size_t "
5020 ">I<count>B<);>\n"
5021 msgstr ""
5022
5023 #. type: Plain text
5024 #: build/C/man2/readahead.2:65
5025 msgid ""
5026 "B<readahead>()  populates the page cache with data from a file so that "
5027 "subsequent reads from that file will not block on disk I/O.  The I<fd> "
5028 "argument is a file descriptor identifying the file which is to be read.  The "
5029 "I<offset> argument specifies the starting point from which data is to be "
5030 "read and I<count> specifies the number of bytes to be read.  I/O is "
5031 "performed in whole pages, so that I<offset> is effectively rounded down to a "
5032 "page boundary and bytes are read up to the next page boundary greater than "
5033 "or equal to I<(offset+count)>.  B<readahead>()  does not read beyond the end "
5034 "of the file.  B<readahead>()  blocks until the specified data has been "
5035 "read.  The current file offset of the open file referred to by I<fd> is left "
5036 "unchanged."
5037 msgstr ""
5038
5039 #. type: Plain text
5040 #: build/C/man2/readahead.2:71
5041 msgid ""
5042 "On success, B<readahead>()  returns 0; on failure, -1 is returned, with "
5043 "I<errno> set to indicate the cause of the error."
5044 msgstr ""
5045
5046 #. type: Plain text
5047 #: build/C/man2/readahead.2:76
5048 msgid "I<fd> is not a valid file descriptor or is not open for reading."
5049 msgstr ""
5050
5051 #. type: Plain text
5052 #: build/C/man2/readahead.2:82
5053 msgid "I<fd> does not refer to a file type to which B<readahead>()  can be applied."
5054 msgstr ""
5055
5056 #. type: Plain text
5057 #: build/C/man2/readahead.2:87
5058 msgid ""
5059 "The B<readahead>()  system call appeared in Linux 2.4.13; glibc support has "
5060 "been provided since version 2.3."
5061 msgstr ""
5062
5063 #. type: Plain text
5064 #: build/C/man2/readahead.2:92
5065 msgid ""
5066 "The B<readahead>()  system call is Linux-specific, and its use should be "
5067 "avoided in portable applications."
5068 msgstr ""
5069
5070 #. type: Plain text
5071 #: build/C/man2/readahead.2:98
5072 msgid "B<lseek>(2), B<madvise>(2), B<mmap>(2), B<posix_fadvise>(2), B<read>(2)"
5073 msgstr ""
5074
5075 #. type: TH
5076 #: build/C/man2/remap_file_pages.2:26
5077 #, no-wrap
5078 msgid "REMAP_FILE_PAGES"
5079 msgstr ""
5080
5081 #. type: Plain text
5082 #: build/C/man2/remap_file_pages.2:29
5083 msgid "remap_file_pages - create a nonlinear file mapping"
5084 msgstr ""
5085
5086 #. type: Plain text
5087 #: build/C/man2/remap_file_pages.2:33
5088 #, no-wrap
5089 msgid ""
5090 "B<#define _GNU_SOURCE>         /* See feature_test_macros(7) */\n"
5091 "B<#include E<lt>sys/mman.hE<gt>>\n"
5092 msgstr ""
5093
5094 #. type: Plain text
5095 #: build/C/man2/remap_file_pages.2:36
5096 #, no-wrap
5097 msgid ""
5098 "B<int remap_file_pages(void *>I<addr>B<, size_t >I<size>B<, int "
5099 ">I<prot>B<,>\n"
5100 "B<                     ssize_t >I<pgoff>B<, int >I<flags>B<);>\n"
5101 msgstr ""
5102
5103 #. type: Plain text
5104 #: build/C/man2/remap_file_pages.2:49
5105 msgid ""
5106 "The B<remap_file_pages>()  system call is used to create a nonlinear "
5107 "mapping, that is, a mapping in which the pages of the file are mapped into a "
5108 "nonsequential order in memory.  The advantage of using B<remap_file_pages>()  "
5109 "over using repeated calls to B<mmap>(2)  is that the former approach does "
5110 "not require the kernel to create additional VMA (Virtual Memory Area) data "
5111 "structures."
5112 msgstr ""
5113
5114 #. type: Plain text
5115 #: build/C/man2/remap_file_pages.2:51
5116 msgid "To create a nonlinear mapping we perform the following steps:"
5117 msgstr ""
5118
5119 #. type: TP
5120 #: build/C/man2/remap_file_pages.2:51
5121 #, no-wrap
5122 msgid "1."
5123 msgstr ""
5124
5125 #. type: Plain text
5126 #: build/C/man2/remap_file_pages.2:59
5127 msgid ""
5128 "Use B<mmap>(2)  to create a mapping (which is initially linear).  This "
5129 "mapping must be created with the B<MAP_SHARED> flag."
5130 msgstr ""
5131
5132 #. type: TP
5133 #: build/C/man2/remap_file_pages.2:59
5134 #, no-wrap
5135 msgid "2."
5136 msgstr ""
5137
5138 #. type: Plain text
5139 #: build/C/man2/remap_file_pages.2:67
5140 msgid ""
5141 "Use one or more calls to B<remap_file_pages>()  to rearrange the "
5142 "correspondence between the pages of the mapping and the pages of the file.  "
5143 "It is possible to map the same page of a file into multiple locations within "
5144 "the mapped region."
5145 msgstr ""
5146
5147 #. type: Plain text
5148 #: build/C/man2/remap_file_pages.2:78
5149 msgid ""
5150 "The I<pgoff> and I<size> arguments specify the region of the file that is to "
5151 "be relocated within the mapping: I<pgoff> is a file offset in units of the "
5152 "system page size; I<size> is the length of the region in bytes."
5153 msgstr ""
5154
5155 #. type: Plain text
5156 #: build/C/man2/remap_file_pages.2:96
5157 msgid ""
5158 "The I<addr> argument serves two purposes.  First, it identifies the mapping "
5159 "whose pages we want to rearrange.  Thus, I<addr> must be an address that "
5160 "falls within a region previously mapped by a call to B<mmap>(2).  Second, "
5161 "I<addr> specifies the address at which the file pages identified by I<pgoff> "
5162 "and I<size> will be placed."
5163 msgstr ""
5164
5165 #.  This rounding is weird, and not consistent with the treatment of
5166 #.  the analogous arguments for munmap()/mprotect() and for mlock().
5167 #.  MTK, 14 Sep 2005
5168 #. type: Plain text
5169 #: build/C/man2/remap_file_pages.2:110
5170 msgid ""
5171 "The values specified in I<addr> and I<size> should be multiples of the "
5172 "system page size.  If they are not, then the kernel rounds I<both> values "
5173 "I<down> to the nearest multiple of the page size."
5174 msgstr ""
5175
5176 #. type: Plain text
5177 #: build/C/man2/remap_file_pages.2:114
5178 msgid "The I<prot> argument must be specified as 0."
5179 msgstr ""
5180
5181 #. type: Plain text
5182 #: build/C/man2/remap_file_pages.2:122
5183 msgid ""
5184 "The I<flags> argument has the same meaning as for B<mmap>(2), but all flags "
5185 "other than B<MAP_NONBLOCK> are ignored."
5186 msgstr ""
5187
5188 #. type: Plain text
5189 #: build/C/man2/remap_file_pages.2:129
5190 msgid ""
5191 "On success, B<remap_file_pages>()  returns 0.  On error, -1 is returned, and "
5192 "I<errno> is set appropriately."
5193 msgstr ""
5194
5195 #. type: Plain text
5196 #: build/C/man2/remap_file_pages.2:137
5197 msgid ""
5198 "I<addr> does not refer to a valid mapping created with the B<MAP_SHARED> "
5199 "flag."
5200 msgstr ""
5201
5202 #.  And possibly others from vma->vm_ops->populate()
5203 #. type: Plain text
5204 #: build/C/man2/remap_file_pages.2:146
5205 msgid "I<addr>, I<size>, I<prot>, or I<pgoff> is invalid."
5206 msgstr ""
5207
5208 #. type: Plain text
5209 #: build/C/man2/remap_file_pages.2:151
5210 msgid ""
5211 "The B<remap_file_pages>()  system call appeared in Linux 2.5.46; glibc "
5212 "support was added in version 2.3.3."
5213 msgstr ""
5214
5215 #. type: Plain text
5216 #: build/C/man2/remap_file_pages.2:155
5217 msgid "The B<remap_file_pages>()  system call is Linux-specific."
5218 msgstr ""
5219
5220 #. type: Plain text
5221 #: build/C/man2/remap_file_pages.2:162
5222 msgid ""
5223 "B<getpagesize>(2), B<mmap>(2), B<mmap2>(2), B<mprotect>(2), B<mremap>(2), "
5224 "B<msync>(2)"
5225 msgstr ""
5226
5227 #. type: TH
5228 #: build/C/man3/shm_open.3:26
5229 #, no-wrap
5230 msgid "SHM_OPEN"
5231 msgstr ""
5232
5233 #. type: TH
5234 #: build/C/man3/shm_open.3:26
5235 #, no-wrap
5236 msgid "2009-02-25"
5237 msgstr ""
5238
5239 #. type: Plain text
5240 #: build/C/man3/shm_open.3:29
5241 msgid "shm_open, shm_unlink - Create/open or unlink POSIX shared memory objects"
5242 msgstr ""
5243
5244 #. type: Plain text
5245 #: build/C/man3/shm_open.3:33
5246 msgid "B<#include E<lt>sys/stat.hE<gt>> /* For mode constants */"
5247 msgstr ""
5248
5249 #. type: Plain text
5250 #: build/C/man3/shm_open.3:35
5251 msgid "B<#include E<lt>fcntl.hE<gt>> /* For O_* constants */"
5252 msgstr ""
5253
5254 #. type: Plain text
5255 #: build/C/man3/shm_open.3:37
5256 msgid "B<int shm_open(const char *>I<name>B<, int >I<oflag>B<, mode_t >I<mode>B<);>"
5257 msgstr ""
5258
5259 #. type: Plain text
5260 #: build/C/man3/shm_open.3:39
5261 msgid "B<int shm_unlink(const char *>I<name>B<);>"
5262 msgstr ""
5263
5264 #. type: Plain text
5265 #: build/C/man3/shm_open.3:41
5266 msgid "Link with I<-lrt>."
5267 msgstr ""
5268
5269 #. type: Plain text
5270 #: build/C/man3/shm_open.3:53
5271 msgid ""
5272 "B<shm_open>()  creates and opens a new, or opens an existing, POSIX shared "
5273 "memory object.  A POSIX shared memory object is in effect a handle which can "
5274 "be used by unrelated processes to B<mmap>(2)  the same region of shared "
5275 "memory.  The B<shm_unlink>()  function performs the converse operation, "
5276 "removing an object previously created by B<shm_open>()."
5277 msgstr ""
5278
5279 #.  glibc allows the initial slash to be omitted, and makes
5280 #.  multiple initial slashes equivalent to a single slash.
5281 #.  This differs from the implementation of POSIX message queues.
5282 #.  glibc allows subdirectory components in the name, in which
5283 #.  case the subdirectory must exist under /dev/shm, and allow the
5284 #.  required permissions if a user wants to create a shared memory
5285 #.  object in that subdirectory.
5286 #. type: Plain text
5287 #: build/C/man3/shm_open.3:74
5288 msgid ""
5289 "The operation of B<shm_open>()  is analogous to that of B<open>(2).  I<name> "
5290 "specifies the shared memory object to be created or opened.  For portable "
5291 "use, a shared memory object should be identified by a name of the form "
5292 "I</somename>; that is, a null-terminated string of up to B<NAME_MAX> (i.e., "
5293 "255) characters consisting of an initial slash, followed by one or more "
5294 "characters, none of which are slashes."
5295 msgstr ""
5296
5297 #. type: Plain text
5298 #: build/C/man3/shm_open.3:81
5299 msgid ""
5300 "I<oflag> is a bit mask created by ORing together exactly one of B<O_RDONLY> "
5301 "or B<O_RDWR> and any of the other flags listed here:"
5302 msgstr ""
5303
5304 #. type: TP
5305 #: build/C/man3/shm_open.3:81
5306 #, no-wrap
5307 msgid "B<O_RDONLY>"
5308 msgstr ""
5309
5310 #. type: Plain text
5311 #: build/C/man3/shm_open.3:87
5312 msgid ""
5313 "Open the object for read access.  A shared memory object opened in this way "
5314 "can only be B<mmap>(2)ed for read (B<PROT_READ>) access."
5315 msgstr ""
5316
5317 #. type: TP
5318 #: build/C/man3/shm_open.3:87
5319 #, no-wrap
5320 msgid "B<O_RDWR>"
5321 msgstr ""
5322
5323 #. type: Plain text
5324 #: build/C/man3/shm_open.3:90
5325 msgid "Open the object for read-write access."
5326 msgstr ""
5327
5328 #. type: TP
5329 #: build/C/man3/shm_open.3:90
5330 #, no-wrap
5331 msgid "B<O_CREAT>"
5332 msgstr ""
5333
5334 #.  In truth it is actually the file system IDs on Linux, but these
5335 #.  are nearly always the same as the effective IDs.  (MTK, Jul 05)
5336 #. type: Plain text
5337 #: build/C/man3/shm_open.3:110
5338 msgid ""
5339 "Create the shared memory object if it does not exist.  The user and group "
5340 "ownership of the object are taken from the corresponding effective IDs of "
5341 "the calling process, and the object's permission bits are set according to "
5342 "the low-order 9 bits of I<mode>, except that those bits set in the process "
5343 "file mode creation mask (see B<umask>(2))  are cleared for the new object.  "
5344 "A set of macro constants which can be used to define I<mode> is listed in "
5345 "B<open>(2).  (Symbolic definitions of these constants can be obtained by "
5346 "including I<E<lt>sys/stat.hE<gt>>.)"
5347 msgstr ""
5348
5349 #. type: Plain text
5350 #: build/C/man3/shm_open.3:116
5351 msgid ""
5352 "A new shared memory object initially has zero length\\(emthe size of the "
5353 "object can be set using B<ftruncate>(2).  The newly allocated bytes of a "
5354 "shared memory object are automatically initialized to 0."
5355 msgstr ""
5356
5357 #. type: TP
5358 #: build/C/man3/shm_open.3:116
5359 #, no-wrap
5360 msgid "B<O_EXCL>"
5361 msgstr ""
5362
5363 #. type: Plain text
5364 #: build/C/man3/shm_open.3:125
5365 msgid ""
5366 "If B<O_CREAT> was also specified, and a shared memory object with the given "
5367 "I<name> already exists, return an error.  The check for the existence of the "
5368 "object, and its creation if it does not exist, are performed atomically."
5369 msgstr ""
5370
5371 #. type: TP
5372 #: build/C/man3/shm_open.3:125
5373 #, no-wrap
5374 msgid "B<O_TRUNC>"
5375 msgstr ""
5376
5377 #. type: Plain text
5378 #: build/C/man3/shm_open.3:128
5379 msgid "If the shared memory object already exists, truncate it to zero bytes."
5380 msgstr ""
5381
5382 #. type: Plain text
5383 #: build/C/man3/shm_open.3:131
5384 msgid ""
5385 "Definitions of these flag values can be obtained by including "
5386 "I<E<lt>fcntl.hE<gt>>."
5387 msgstr ""
5388
5389 #. type: Plain text
5390 #: build/C/man3/shm_open.3:142
5391 msgid ""
5392 "On successful completion B<shm_open>()  returns a new file descriptor "
5393 "referring to the shared memory object.  This file descriptor is guaranteed "
5394 "to be the lowest-numbered file descriptor not previously opened within the "
5395 "process.  The B<FD_CLOEXEC> flag (see B<fcntl>(2))  is set for the file "
5396 "descriptor."
5397 msgstr ""
5398
5399 #. type: Plain text
5400 #: build/C/man3/shm_open.3:151
5401 msgid ""
5402 "The file descriptor is normally used in subsequent calls to B<ftruncate>(2)  "
5403 "(for a newly created object) and B<mmap>(2).  After a call to B<mmap>(2)  "
5404 "the file descriptor may be closed without affecting the memory mapping."
5405 msgstr ""
5406
5407 #. type: Plain text
5408 #: build/C/man3/shm_open.3:169
5409 msgid ""
5410 "The operation of B<shm_unlink>()  is analogous to B<unlink>(2): it removes a "
5411 "shared memory object name, and, once all processes have unmapped the object, "
5412 "de-allocates and destroys the contents of the associated memory region.  "
5413 "After a successful B<shm_unlink>(), attempts to B<shm_open>()  an object "
5414 "with the same I<name> will fail (unless B<O_CREAT> was specified, in which "
5415 "case a new, distinct object is created)."
5416 msgstr ""
5417
5418 #. type: Plain text
5419 #: build/C/man3/shm_open.3:178
5420 msgid ""
5421 "On success, B<shm_open>()  returns a nonnegative file descriptor.  On "
5422 "failure, B<shm_open>()  returns -1.  B<shm_unlink>()  returns 0 on success, "
5423 "or -1 on error."
5424 msgstr ""
5425
5426 #. type: Plain text
5427 #: build/C/man3/shm_open.3:185
5428 msgid ""
5429 "On failure, I<errno> is set to indicate the cause of the error.  Values "
5430 "which may appear in I<errno> include the following:"
5431 msgstr ""
5432
5433 #. type: Plain text
5434 #: build/C/man3/shm_open.3:190
5435 msgid "Permission to B<shm_unlink>()  the shared memory object was denied."
5436 msgstr ""
5437
5438 #. type: Plain text
5439 #: build/C/man3/shm_open.3:200
5440 msgid ""
5441 "Permission was denied to B<shm_open>()  I<name> in the specified I<mode>, or "
5442 "B<O_TRUNC> was specified and the caller does not have write permission on "
5443 "the object."
5444 msgstr ""
5445
5446 #. type: TP
5447 #: build/C/man3/shm_open.3:200 build/C/man2/shmget.2:192
5448 #, no-wrap
5449 msgid "B<EEXIST>"
5450 msgstr ""
5451
5452 #. type: Plain text
5453 #: build/C/man3/shm_open.3:211
5454 msgid ""
5455 "Both B<O_CREAT> and B<O_EXCL> were specified to B<shm_open>()  and the "
5456 "shared memory object specified by I<name> already exists."
5457 msgstr ""
5458
5459 #. type: Plain text
5460 #: build/C/man3/shm_open.3:218
5461 msgid "The I<name> argument to B<shm_open>()  was invalid."
5462 msgstr ""
5463
5464 #. type: TP
5465 #: build/C/man3/shm_open.3:218
5466 #, no-wrap
5467 msgid "B<EMFILE>"
5468 msgstr ""
5469
5470 #. type: Plain text
5471 #: build/C/man3/shm_open.3:221
5472 msgid "The process already has the maximum number of files open."
5473 msgstr ""
5474
5475 #. type: TP
5476 #: build/C/man3/shm_open.3:221
5477 #, no-wrap
5478 msgid "B<ENAMETOOLONG>"
5479 msgstr ""
5480
5481 #. type: Plain text
5482 #: build/C/man3/shm_open.3:227
5483 msgid "The length of I<name> exceeds B<PATH_MAX>."
5484 msgstr ""
5485
5486 #. type: Plain text
5487 #: build/C/man3/shm_open.3:231
5488 msgid "The limit on the total number of files open on the system has been reached."
5489 msgstr ""
5490
5491 #. type: TP
5492 #: build/C/man3/shm_open.3:231 build/C/man3/shm_open.3:240 build/C/man2/shmget.2:206
5493 #, no-wrap
5494 msgid "B<ENOENT>"
5495 msgstr ""
5496
5497 #. type: Plain text
5498 #: build/C/man3/shm_open.3:240
5499 msgid ""
5500 "An attempt was made to B<shm_open>()  a I<name> that did not exist, and "
5501 "B<O_CREAT> was not specified."
5502 msgstr ""
5503
5504 #. type: Plain text
5505 #: build/C/man3/shm_open.3:247
5506 msgid "An attempt was to made to B<shm_unlink>()  a I<name> that does not exist."
5507 msgstr ""
5508
5509 #. type: Plain text
5510 #: build/C/man3/shm_open.3:249
5511 msgid "These functions are provided in glibc 2.2 and later."
5512 msgstr ""
5513
5514 #. type: Plain text
5515 #: build/C/man3/shm_open.3:255
5516 msgid ""
5517 "POSIX.1-2001 says that the group ownership of a newly created shared memory "
5518 "object is set to either the calling process's effective group ID or \"a "
5519 "system default group ID\"."
5520 msgstr ""
5521
5522 #. type: Plain text
5523 #: build/C/man3/shm_open.3:264
5524 msgid ""
5525 "POSIX leaves the behavior of the combination of B<O_RDONLY> and B<O_TRUNC> "
5526 "unspecified.  On Linux, this will successfully truncate an existing shared "
5527 "memory object\\(emthis may not be so on other UNIX systems."
5528 msgstr ""
5529
5530 #. type: Plain text
5531 #: build/C/man3/shm_open.3:269
5532 msgid ""
5533 "The POSIX shared memory object implementation on Linux 2.4 makes use of a "
5534 "dedicated file system, which is normally mounted under I</dev/shm>."
5535 msgstr ""
5536
5537 #. type: Plain text
5538 #: build/C/man3/shm_open.3:280
5539 msgid ""
5540 "B<close>(2), B<fchmod>(2), B<fchown>(2), B<fcntl>(2), B<fstat>(2), "
5541 "B<ftruncate>(2), B<mmap>(2), B<open>(2), B<umask>(2), B<shm_overview>(7)"
5542 msgstr ""
5543
5544 #. type: TH
5545 #: build/C/man7/shm_overview.7:27
5546 #, no-wrap
5547 msgid "SHM_OVERVIEW"
5548 msgstr ""
5549
5550 #. type: Plain text
5551 #: build/C/man7/shm_overview.7:30
5552 msgid "shm_overview - Overview of POSIX shared memory"
5553 msgstr ""
5554
5555 #. type: Plain text
5556 #: build/C/man7/shm_overview.7:33
5557 msgid ""
5558 "The POSIX shared memory API allows processes to communicate information by "
5559 "sharing a region of memory."
5560 msgstr ""
5561
5562 #. type: Plain text
5563 #: build/C/man7/shm_overview.7:35
5564 msgid "The interfaces employed in the API are:"
5565 msgstr ""
5566
5567 #. type: TP
5568 #: build/C/man7/shm_overview.7:35
5569 #, no-wrap
5570 msgid "B<shm_open>(3)"
5571 msgstr ""
5572
5573 #. type: Plain text
5574 #: build/C/man7/shm_overview.7:42
5575 msgid ""
5576 "Create and open a new object, or open an existing object.  This is analogous "
5577 "to B<open>(2).  The call returns a file descriptor for use by the other "
5578 "interfaces listed below."
5579 msgstr ""
5580
5581 #. type: TP
5582 #: build/C/man7/shm_overview.7:42
5583 #, no-wrap
5584 msgid "B<ftruncate>(2)"
5585 msgstr ""
5586
5587 #. type: Plain text
5588 #: build/C/man7/shm_overview.7:46
5589 msgid ""
5590 "Set the size of the shared memory object.  (A newly created shared memory "
5591 "object has a length of zero.)"
5592 msgstr ""
5593
5594 #. type: Plain text
5595 #: build/C/man7/shm_overview.7:50
5596 msgid ""
5597 "Map the shared memory object into the virtual address space of the calling "
5598 "process."
5599 msgstr ""
5600
5601 #. type: TP
5602 #: build/C/man7/shm_overview.7:50
5603 #, no-wrap
5604 msgid "B<munmap>(2)"
5605 msgstr ""
5606
5607 #. type: Plain text
5608 #: build/C/man7/shm_overview.7:54
5609 msgid ""
5610 "Unmap the shared memory object from the virtual address space of the calling "
5611 "process."
5612 msgstr ""
5613
5614 #. type: TP
5615 #: build/C/man7/shm_overview.7:54
5616 #, no-wrap
5617 msgid "B<shm_unlink>(3)"
5618 msgstr ""
5619
5620 #. type: Plain text
5621 #: build/C/man7/shm_overview.7:57
5622 msgid "Remove a shared memory object name."
5623 msgstr ""
5624
5625 #. type: TP
5626 #: build/C/man7/shm_overview.7:57
5627 #, no-wrap
5628 msgid "B<close>(2)"
5629 msgstr ""
5630
5631 #. type: Plain text
5632 #: build/C/man7/shm_overview.7:62
5633 msgid ""
5634 "Close the file descriptor allocated by B<shm_open>(3)  when it is no longer "
5635 "needed."
5636 msgstr ""
5637
5638 #. type: TP
5639 #: build/C/man7/shm_overview.7:62
5640 #, no-wrap
5641 msgid "B<fstat>(2)"
5642 msgstr ""
5643
5644 #. type: Plain text
5645 #: build/C/man7/shm_overview.7:76
5646 msgid ""
5647 "Obtain a I<stat> structure that describes the shared memory object.  Among "
5648 "the information returned by this call are the object's size (I<st_size>), "
5649 "permissions (I<st_mode>), owner (I<st_uid>), and group (I<st_gid>)."
5650 msgstr ""
5651
5652 #. type: TP
5653 #: build/C/man7/shm_overview.7:76
5654 #, no-wrap
5655 msgid "B<fchown>(2)"
5656 msgstr ""
5657
5658 #. type: Plain text
5659 #: build/C/man7/shm_overview.7:79
5660 msgid "To change the ownership of a shared memory object."
5661 msgstr ""
5662
5663 #. type: TP
5664 #: build/C/man7/shm_overview.7:79
5665 #, no-wrap
5666 msgid "B<fchmod>(2)"
5667 msgstr ""
5668
5669 #. type: Plain text
5670 #: build/C/man7/shm_overview.7:82
5671 msgid "To change the permissions of a shared memory object."
5672 msgstr ""
5673
5674 #. type: SS
5675 #: build/C/man7/shm_overview.7:82
5676 #, no-wrap
5677 msgid "Versions"
5678 msgstr ""
5679
5680 #. type: Plain text
5681 #: build/C/man7/shm_overview.7:84
5682 msgid "POSIX shared memory is supported since Linux 2.4 and glibc 2.2."
5683 msgstr ""
5684
5685 #. type: SS
5686 #: build/C/man7/shm_overview.7:84
5687 #, no-wrap
5688 msgid "Persistence"
5689 msgstr ""
5690
5691 #. type: Plain text
5692 #: build/C/man7/shm_overview.7:89
5693 msgid ""
5694 "POSIX shared memory objects have kernel persistence: a shared memory object "
5695 "will exist until the system is shut down, or until all processes have "
5696 "unmapped the object and it has been deleted with B<shm_unlink>(3)"
5697 msgstr ""
5698
5699 #. type: SS
5700 #: build/C/man7/shm_overview.7:89
5701 #, no-wrap
5702 msgid "Linking"
5703 msgstr ""
5704
5705 #. type: Plain text
5706 #: build/C/man7/shm_overview.7:94
5707 msgid ""
5708 "Programs using the POSIX shared memory API must be compiled with I<cc -lrt> "
5709 "to link against the real-time library, I<librt>."
5710 msgstr ""
5711
5712 #. type: SS
5713 #: build/C/man7/shm_overview.7:94
5714 #, no-wrap
5715 msgid "Accessing shared memory objects via the file system"
5716 msgstr ""
5717
5718 #. type: Plain text
5719 #: build/C/man7/shm_overview.7:101
5720 msgid ""
5721 "On Linux, shared memory objects are created in a (I<tmpfs>)  virtual file "
5722 "system, normally mounted under I</dev/shm>.  Since kernel 2.6.19, Linux "
5723 "supports the use of access control lists (ACLs)  to control the permissions "
5724 "of objects in the virtual file system."
5725 msgstr ""
5726
5727 #. type: Plain text
5728 #: build/C/man7/shm_overview.7:106
5729 msgid ""
5730 "Typically, processes must synchronize their access to a shared memory "
5731 "object, using, for example, POSIX semaphores."
5732 msgstr ""
5733
5734 #. type: Plain text
5735 #: build/C/man7/shm_overview.7:114
5736 msgid ""
5737 "System V shared memory (B<shmget>(2), B<shmop>(2), etc.) is an older shared "
5738 "memory API.  POSIX shared memory provides a simpler, and better designed "
5739 "interface; on the other hand POSIX shared memory is somewhat less widely "
5740 "available (especially on older systems) than System V shared memory."
5741 msgstr ""
5742
5743 #. type: Plain text
5744 #: build/C/man7/shm_overview.7:127
5745 msgid ""
5746 "B<fchmod>(2), B<fchown>(2), B<fstat>(2), B<ftruncate>(2), B<mmap>(2), "
5747 "B<mprotect>(2), B<munmap>(2), B<shmget>(2), B<shmop>(2), B<shm_open>(3), "
5748 "B<shm_unlink>(3), B<sem_overview>(7)"
5749 msgstr ""
5750
5751 #. type: TH
5752 #: build/C/man2/shmctl.2:43
5753 #, no-wrap
5754 msgid "SHMCTL"
5755 msgstr ""
5756
5757 #. type: TH
5758 #: build/C/man2/shmctl.2:43
5759 #, no-wrap
5760 msgid "2008-08-07"
5761 msgstr ""
5762
5763 #. type: Plain text
5764 #: build/C/man2/shmctl.2:46
5765 msgid "shmctl - shared memory control"
5766 msgstr ""
5767
5768 #. type: Plain text
5769 #: build/C/man2/shmctl.2:49 build/C/man2/shmget.2:42
5770 msgid "B<#include E<lt>sys/ipc.hE<gt>>"
5771 msgstr ""
5772
5773 #. type: Plain text
5774 #: build/C/man2/shmctl.2:51 build/C/man2/shmget.2:44
5775 msgid "B<#include E<lt>sys/shm.hE<gt>>"
5776 msgstr ""
5777
5778 #. type: Plain text
5779 #: build/C/man2/shmctl.2:53
5780 msgid "B<int shmctl(int >I<shmid>B<, int >I<cmd>B<, struct shmid_ds *>I<buf>B<);>"
5781 msgstr ""
5782
5783 #. type: Plain text
5784 #: build/C/man2/shmctl.2:60
5785 msgid ""
5786 "B<shmctl>()  performs the control operation specified by I<cmd> on the "
5787 "shared memory segment whose identifier is given in I<shmid>."
5788 msgstr ""
5789
5790 #. type: Plain text
5791 #: build/C/man2/shmctl.2:65
5792 msgid ""
5793 "The I<buf> argument is a pointer to a I<shmid_ds> structure, defined in "
5794 "I<E<lt>sys/shm.hE<gt>> as follows:"
5795 msgstr ""
5796
5797 #. type: Plain text
5798 #: build/C/man2/shmctl.2:79
5799 #, no-wrap
5800 msgid ""
5801 "struct shmid_ds {\n"
5802 "    struct ipc_perm shm_perm;    /* Ownership and permissions */\n"
5803 "    size_t          shm_segsz;   /* Size of segment (bytes) */\n"
5804 "    time_t          shm_atime;   /* Last attach time */\n"
5805 "    time_t          shm_dtime;   /* Last detach time */\n"
5806 "    time_t          shm_ctime;   /* Last change time */\n"
5807 "    pid_t           shm_cpid;    /* PID of creator */\n"
5808 "    pid_t           shm_lpid;    /* PID of last shmat(2)/shmdt(2) */\n"
5809 "    shmatt_t        shm_nattch;  /* No. of current attaches */\n"
5810 "    ...\n"
5811 "};\n"
5812 msgstr ""
5813
5814 #. type: Plain text
5815 #: build/C/man2/shmctl.2:87
5816 msgid ""
5817 "The I<ipc_perm> structure is defined in I<E<lt>sys/ipc.hE<gt>> as follows "
5818 "(the highlighted fields are settable using B<IPC_SET>):"
5819 msgstr ""
5820
5821 #. type: Plain text
5822 #: build/C/man2/shmctl.2:100
5823 #, no-wrap
5824 msgid ""
5825 "struct ipc_perm {\n"
5826 "    key_t          __key;    /* Key supplied to shmget(2) */\n"
5827 "    uid_t          B<uid>;      /* Effective UID of owner */\n"
5828 "    gid_t          B<gid>;      /* Effective GID of owner */\n"
5829 "    uid_t          cuid;     /* Effective UID of creator */\n"
5830 "    gid_t          cgid;     /* Effective GID of creator */\n"
5831 "    unsigned short B<mode>;     /* B<Permissions> + SHM_DEST and\n"
5832 "                                SHM_LOCKED flags */\n"
5833 "    unsigned short __seq;    /* Sequence number */\n"
5834 "};\n"
5835 msgstr ""
5836
5837 #. type: Plain text
5838 #: build/C/man2/shmctl.2:106
5839 msgid "Valid values for I<cmd> are:"
5840 msgstr ""
5841
5842 #. type: TP
5843 #: build/C/man2/shmctl.2:107
5844 #, no-wrap
5845 msgid "B<IPC_STAT>"
5846 msgstr ""
5847
5848 #. type: Plain text
5849 #: build/C/man2/shmctl.2:116
5850 msgid ""
5851 "Copy information from the kernel data structure associated with I<shmid> "
5852 "into the I<shmid_ds> structure pointed to by I<buf>.  The caller must have "
5853 "read permission on the shared memory segment."
5854 msgstr ""
5855
5856 #. type: TP
5857 #: build/C/man2/shmctl.2:116
5858 #, no-wrap
5859 msgid "B<IPC_SET>"
5860 msgstr ""
5861
5862 #. type: Plain text
5863 #: build/C/man2/shmctl.2:134
5864 msgid ""
5865 "Write the values of some members of the I<shmid_ds> structure pointed to by "
5866 "I<buf> to the kernel data structure associated with this shared memory "
5867 "segment, updating also its I<shm_ctime> member.  The following fields can be "
5868 "changed: I<shm_perm.uid>, I<shm_perm.gid>, and (the least significant 9 bits "
5869 "of) I<shm_perm.mode>.  The effective UID of the calling process must match "
5870 "the owner (I<shm_perm.uid>)  or creator (I<shm_perm.cuid>)  of the shared "
5871 "memory segment, or the caller must be privileged."
5872 msgstr ""
5873
5874 #. type: TP
5875 #: build/C/man2/shmctl.2:134
5876 #, no-wrap
5877 msgid "B<IPC_RMID>"
5878 msgstr ""
5879
5880 #. type: Plain text
5881 #: build/C/man2/shmctl.2:151
5882 msgid ""
5883 "Mark the segment to be destroyed.  The segment will only actually be "
5884 "destroyed after the last process detaches it (i.e., when the I<shm_nattch> "
5885 "member of the associated structure I<shmid_ds> is zero).  The caller must be "
5886 "the owner or creator, or be privileged.  If a segment has been marked for "
5887 "destruction, then the (nonstandard)  B<SHM_DEST> flag of the "
5888 "I<shm_perm.mode> field in the associated data structure retrieved by "
5889 "B<IPC_STAT> will be set."
5890 msgstr ""
5891
5892 #. type: Plain text
5893 #: build/C/man2/shmctl.2:154
5894 msgid ""
5895 "The caller I<must> ensure that a segment is eventually destroyed; otherwise "
5896 "its pages that were faulted in will remain in memory or swap."
5897 msgstr ""
5898
5899 #. type: TP
5900 #: build/C/man2/shmctl.2:154
5901 #, no-wrap
5902 msgid "B<IPC_INFO> (Linux-specific)"
5903 msgstr ""
5904
5905 #. type: Plain text
5906 #: build/C/man2/shmctl.2:167
5907 msgid ""
5908 "Returns information about system-wide shared memory limits and parameters in "
5909 "the structure pointed to by I<buf>.  This structure is of type I<shminfo> "
5910 "(thus, a cast is required), defined in I<E<lt>sys/shm.hE<gt>> if the "
5911 "B<_GNU_SOURCE> feature test macro is defined:"
5912 msgstr ""
5913
5914 #. type: Plain text
5915 #: build/C/man2/shmctl.2:181
5916 #, no-wrap
5917 msgid ""
5918 "struct  shminfo {\n"
5919 "    unsigned long shmmax; /* Maximum segment size */\n"
5920 "    unsigned long shmmin; /* Minimum segment size;\n"
5921 "                             always 1 */\n"
5922 "    unsigned long shmmni; /* Maximum number of segments */\n"
5923 "    unsigned long shmseg; /* Maximum number of segments\n"
5924 "                             that a process can attach;\n"
5925 "                             unused within kernel */\n"
5926 "    unsigned long shmall; /* Maximum number of pages of\n"
5927 "                             shared memory, system-wide */\n"
5928 "};\n"
5929 msgstr ""
5930
5931 #. type: Plain text
5932 #: build/C/man2/shmctl.2:194
5933 msgid ""
5934 "The I<shmmni>, I<shmmax>, and I<shmall> settings can be changed via I</proc> "
5935 "files of the same name; see B<proc>(5)  for details."
5936 msgstr ""
5937
5938 #. type: TP
5939 #: build/C/man2/shmctl.2:194
5940 #, no-wrap
5941 msgid "B<SHM_INFO> (Linux-specific)"
5942 msgstr ""
5943
5944 #. type: Plain text
5945 #: build/C/man2/shmctl.2:205
5946 msgid ""
5947 "Returns a I<shm_info> structure whose fields contain information about "
5948 "system resources consumed by shared memory.  This structure is defined in "
5949 "I<E<lt>sys/shm.hE<gt>> if the B<_GNU_SOURCE> feature test macro is defined:"
5950 msgstr ""
5951
5952 #. type: Plain text
5953 #: build/C/man2/shmctl.2:222
5954 #, no-wrap
5955 msgid ""
5956 "struct shm_info {\n"
5957 "    int           used_ids; /* # of currently existing\n"
5958 "                               segments */\n"
5959 "    unsigned long shm_tot;  /* Total number of shared\n"
5960 "                               memory pages */\n"
5961 "    unsigned long shm_rss;  /* # of resident shared\n"
5962 "                               memory pages */\n"
5963 "    unsigned long shm_swp;  /* # of swapped shared\n"
5964 "                               memory pages */\n"
5965 "    unsigned long swap_attempts;\n"
5966 "                            /* Unused since Linux 2.4 */\n"
5967 "    unsigned long swap_successes;\n"
5968 "                            /* Unused since Linux 2.4 */\n"
5969 "};\n"
5970 msgstr ""
5971
5972 #. type: TP
5973 #: build/C/man2/shmctl.2:224
5974 #, no-wrap
5975 msgid "B<SHM_STAT> (Linux-specific)"
5976 msgstr ""
5977
5978 #. type: Plain text
5979 #: build/C/man2/shmctl.2:235
5980 msgid ""
5981 "Returns a I<shmid_ds> structure as for B<IPC_STAT>.  However, the I<shmid> "
5982 "argument is not a segment identifier, but instead an index into the kernel's "
5983 "internal array that maintains information about all shared memory segments "
5984 "on the system."
5985 msgstr ""
5986
5987 #. type: Plain text
5988 #: build/C/man2/shmctl.2:238
5989 msgid ""
5990 "The caller can prevent or allow swapping of a shared memory segment with the "
5991 "following I<cmd> values:"
5992 msgstr ""
5993
5994 #. type: TP
5995 #: build/C/man2/shmctl.2:239
5996 #, no-wrap
5997 msgid "B<SHM_LOCK> (Linux-specific)"
5998 msgstr ""
5999
6000 #. type: Plain text
6001 #: build/C/man2/shmctl.2:251
6002 msgid ""
6003 "Prevent swapping of the shared memory segment.  The caller must fault in any "
6004 "pages that are required to be present after locking is enabled.  If a "
6005 "segment has been locked, then the (nonstandard)  B<SHM_LOCKED> flag of the "
6006 "I<shm_perm.mode> field in the associated data structure retrieved by "
6007 "B<IPC_STAT> will be set."
6008 msgstr ""
6009
6010 #. type: TP
6011 #: build/C/man2/shmctl.2:251
6012 #, no-wrap
6013 msgid "B<SHM_UNLOCK> (Linux-specific)"
6014 msgstr ""
6015
6016 #. type: Plain text
6017 #: build/C/man2/shmctl.2:254
6018 msgid "Unlock the segment, allowing it to be swapped out."
6019 msgstr ""
6020
6021 #.  There was some weirdness in 2.6.9: SHM_LOCK and SHM_UNLOCK could
6022 #.  be applied to a segment, regardless of ownership of the segment.
6023 #.  This was a botch-up in the move to RLIMIT_MEMLOCK, and was fixed
6024 #.  in 2.6.10.  MTK, May 2005
6025 #. type: Plain text
6026 #: build/C/man2/shmctl.2:272
6027 msgid ""
6028 "In kernels before 2.6.10, only a privileged process could employ B<SHM_LOCK> "
6029 "and B<SHM_UNLOCK>.  Since kernel 2.6.10, an unprivileged process can employ "
6030 "these operations if its effective UID matches the owner or creator UID of "
6031 "the segment, and (for B<SHM_LOCK>)  the amount of memory to be locked falls "
6032 "within the B<RLIMIT_MEMLOCK> resource limit (see B<setrlimit>(2))."
6033 msgstr ""
6034
6035 #. type: Plain text
6036 #: build/C/man2/shmctl.2:290
6037 msgid ""
6038 "A successful B<IPC_INFO> or B<SHM_INFO> operation returns the index of the "
6039 "highest used entry in the kernel's internal array recording information "
6040 "about all shared memory segments.  (This information can be used with "
6041 "repeated B<SHM_STAT> operations to obtain information about all shared "
6042 "memory segments on the system.)  A successful B<SHM_STAT> operation returns "
6043 "the identifier of the shared memory segment whose index was given in "
6044 "I<shmid>.  Other operations return 0 on success."
6045 msgstr ""
6046
6047 #. type: Plain text
6048 #: build/C/man2/shmctl.2:294
6049 msgid "On error, -1 is returned, and I<errno> is set appropriately."
6050 msgstr ""
6051
6052 #. type: Plain text
6053 #: build/C/man2/shmctl.2:303
6054 msgid ""
6055 "B<IPC_STAT> or B<SHM_STAT> is requested and I<shm_perm.mode> does not allow "
6056 "read access for I<shmid>, and the calling process does not have the "
6057 "B<CAP_IPC_OWNER> capability."
6058 msgstr ""
6059
6060 #. type: Plain text
6061 #: build/C/man2/shmctl.2:314
6062 msgid ""
6063 "The argument I<cmd> has value B<IPC_SET> or B<IPC_STAT> but the address "
6064 "pointed to by I<buf> isn't accessible."
6065 msgstr ""
6066
6067 #. type: TP
6068 #: build/C/man2/shmctl.2:314
6069 #, no-wrap
6070 msgid "B<EIDRM>"
6071 msgstr ""
6072
6073 #. type: Plain text
6074 #: build/C/man2/shmctl.2:317
6075 msgid "I<shmid> points to a removed identifier."
6076 msgstr ""
6077
6078 #. type: Plain text
6079 #: build/C/man2/shmctl.2:326
6080 msgid ""
6081 "I<shmid> is not a valid identifier, or I<cmd> is not a valid command.  Or: "
6082 "for a B<SHM_STAT> operation, the index value specified in I<shmid> referred "
6083 "to an array slot that is currently unused."
6084 msgstr ""
6085
6086 #. type: Plain text
6087 #: build/C/man2/shmctl.2:337
6088 msgid ""
6089 "(In kernels since 2.6.9), B<SHM_LOCK> was specified and the size of the "
6090 "to-be-locked segment would mean that the total bytes in locked shared memory "
6091 "segments would exceed the limit for the real user ID of the calling "
6092 "process.  This limit is defined by the B<RLIMIT_MEMLOCK> soft resource limit "
6093 "(see B<setrlimit>(2))."
6094 msgstr ""
6095
6096 #. type: TP
6097 #: build/C/man2/shmctl.2:337
6098 #, no-wrap
6099 msgid "B<EOVERFLOW>"
6100 msgstr ""
6101
6102 #. type: Plain text
6103 #: build/C/man2/shmctl.2:342
6104 msgid ""
6105 "B<IPC_STAT> is attempted, and the GID or UID value is too large to be stored "
6106 "in the structure pointed to by I<buf>."
6107 msgstr ""
6108
6109 #. type: Plain text
6110 #: build/C/man2/shmctl.2:354
6111 msgid ""
6112 "B<IPC_SET> or B<IPC_RMID> is attempted, and the effective user ID of the "
6113 "calling process is not that of the creator (found in I<shm_perm.cuid>), or "
6114 "the owner (found in I<shm_perm.uid>), and the process was not privileged "
6115 "(Linux: did not have the B<CAP_SYS_ADMIN> capability)."
6116 msgstr ""
6117
6118 #. type: Plain text
6119 #: build/C/man2/shmctl.2:366
6120 msgid ""
6121 "Or (in kernels before 2.6.9), B<SHM_LOCK> or B<SHM_UNLOCK> was specified, "
6122 "but the process was not privileged (Linux: did not have the B<CAP_IPC_LOCK> "
6123 "capability).  (Since Linux 2.6.9, this error can also occur if the "
6124 "B<RLIMIT_MEMLOCK> is 0 and the caller is not privileged.)"
6125 msgstr ""
6126
6127 #.  SVr4 documents an additional error condition EMFILE.
6128 #. type: Plain text
6129 #: build/C/man2/shmctl.2:371 build/C/man2/shmget.2:232 build/C/man2/shmop.2:229
6130 msgid "SVr4, POSIX.1-2001."
6131 msgstr ""
6132
6133 #. type: Plain text
6134 #: build/C/man2/shmctl.2:382
6135 msgid ""
6136 "The B<IPC_INFO>, B<SHM_STAT> and B<SHM_INFO> operations are used by the "
6137 "B<ipcs>(1)  program to provide information on allocated resources.  In the "
6138 "future these may modified or moved to a /proc file system interface."
6139 msgstr ""
6140
6141 #. type: Plain text
6142 #: build/C/man2/shmctl.2:390
6143 msgid ""
6144 "Linux permits a process to attach (B<shmat>(2))  a shared memory segment "
6145 "that has already been marked for deletion using I<shmctl(IPC_RMID)>.  This "
6146 "feature is not available on other UNIX implementations; portable "
6147 "applications should avoid relying on it."
6148 msgstr ""
6149
6150 #. type: Plain text
6151 #: build/C/man2/shmctl.2:403
6152 msgid ""
6153 "Various fields in a I<struct shmid_ds> were typed as I<short> under Linux "
6154 "2.2 and have become I<long> under Linux 2.4.  To take advantage of this, a "
6155 "recompilation under glibc-2.1.91 or later should suffice.  (The kernel "
6156 "distinguishes old and new calls by an B<IPC_64> flag in I<cmd>.)"
6157 msgstr ""
6158
6159 #. type: Plain text
6160 #: build/C/man2/shmctl.2:410
6161 msgid ""
6162 "B<mlock>(2), B<setrlimit>(2), B<shmget>(2), B<shmop>(2), B<capabilities>(7), "
6163 "B<svipc>(7)"
6164 msgstr ""
6165
6166 #. type: TH
6167 #: build/C/man2/shmget.2:36
6168 #, no-wrap
6169 msgid "SHMGET"
6170 msgstr ""
6171
6172 #. type: TH
6173 #: build/C/man2/shmget.2:36
6174 #, no-wrap
6175 msgid "2006-05-02"
6176 msgstr ""
6177
6178 #. type: Plain text
6179 #: build/C/man2/shmget.2:39
6180 msgid "shmget - allocates a shared memory segment"
6181 msgstr ""
6182
6183 #. type: Plain text
6184 #: build/C/man2/shmget.2:46
6185 msgid "B<int shmget(key_t >I<key>B<, size_t >I<size>B<, int >I<shmflg>B<);>"
6186 msgstr ""
6187
6188 #. type: Plain text
6189 #: build/C/man2/shmget.2:70
6190 msgid ""
6191 "B<shmget>()  returns the identifier of the shared memory segment associated "
6192 "with the value of the argument I<key>.  A new shared memory segment, with "
6193 "size equal to the value of I<size> rounded up to a multiple of B<PAGE_SIZE>, "
6194 "is created if I<key> has the value B<IPC_PRIVATE> or I<key> isn't "
6195 "B<IPC_PRIVATE>, no shared memory segment corresponding to I<key> exists, and "
6196 "B<IPC_CREAT> is specified in I<shmflg>."
6197 msgstr ""
6198
6199 #. type: Plain text
6200 #: build/C/man2/shmget.2:89
6201 msgid ""
6202 "If I<shmflg> specifies both B<IPC_CREAT> and B<IPC_EXCL> and a shared memory "
6203 "segment already exists for I<key>, then B<shmget>()  fails with I<errno> set "
6204 "to B<EEXIST>.  (This is analogous to the effect of the combination B<O_CREAT "
6205 "| O_EXCL> for B<open>(2).)"
6206 msgstr ""
6207
6208 #. type: Plain text
6209 #: build/C/man2/shmget.2:93
6210 msgid "The value I<shmflg> is composed of:"
6211 msgstr ""
6212
6213 #. type: TP
6214 #: build/C/man2/shmget.2:93
6215 #, no-wrap
6216 msgid "B<IPC_CREAT>"
6217 msgstr ""
6218
6219 #. type: Plain text
6220 #: build/C/man2/shmget.2:100
6221 msgid ""
6222 "to create a new segment.  If this flag is not used, then B<shmget>()  will "
6223 "find the segment associated with I<key> and check to see if the user has "
6224 "permission to access the segment."
6225 msgstr ""
6226
6227 #. type: TP
6228 #: build/C/man2/shmget.2:100
6229 #, no-wrap
6230 msgid "B<IPC_EXCL>"
6231 msgstr ""
6232
6233 #. type: Plain text
6234 #: build/C/man2/shmget.2:103
6235 msgid "used with B<IPC_CREAT> to ensure failure if the segment already exists."
6236 msgstr ""
6237
6238 #. type: TP
6239 #: build/C/man2/shmget.2:103
6240 #, no-wrap
6241 msgid "I<mode_flags>"
6242 msgstr ""
6243
6244 #. type: Plain text
6245 #: build/C/man2/shmget.2:113
6246 msgid ""
6247 "(least significant 9 bits)  specifying the permissions granted to the owner, "
6248 "group, and world.  These bits have the same format, and the same meaning, as "
6249 "the I<mode> argument of B<open>(2).  Presently, the execute permissions are "
6250 "not used by the system."
6251 msgstr ""
6252
6253 #. type: TP
6254 #: build/C/man2/shmget.2:113
6255 #, no-wrap
6256 msgid "B<SHM_HUGETLB> (since Linux 2.6)"
6257 msgstr ""
6258
6259 #. type: Plain text
6260 #: build/C/man2/shmget.2:119
6261 msgid ""
6262 "Allocate the segment using \"huge pages.\" See the kernel source file "
6263 "I<Documentation/vm/hugetlbpage.txt> for further information."
6264 msgstr ""
6265
6266 #. type: TP
6267 #: build/C/man2/shmget.2:119
6268 #, no-wrap
6269 msgid "B<SHM_NORESERVE> (since Linux 2.6.15)"
6270 msgstr ""
6271
6272 #.  As at 2.6.17-rc2, this flag has no effect if SHM_HUGETLB was also
6273 #.  specified.
6274 #. type: Plain text
6275 #: build/C/man2/shmget.2:138
6276 msgid ""
6277 "This flag serves the same purpose as the B<mmap>(2)  B<MAP_NORESERVE> flag.  "
6278 "Do not reserve swap space for this segment.  When swap space is reserved, "
6279 "one has the guarantee that it is possible to modify the segment.  When swap "
6280 "space is not reserved one might get B<SIGSEGV> upon a write if no physical "
6281 "memory is available.  See also the discussion of the file "
6282 "I</proc/sys/vm/overcommit_memory> in B<proc>(5)."
6283 msgstr ""
6284
6285 #. type: Plain text
6286 #: build/C/man2/shmget.2:146
6287 msgid ""
6288 "When a new shared memory segment is created, its contents are initialized to "
6289 "zero values, and its associated data structure, I<shmid_ds> (see "
6290 "B<shmctl>(2)), is initialized as follows:"
6291 msgstr ""
6292
6293 #. type: Plain text
6294 #: build/C/man2/shmget.2:151
6295 msgid ""
6296 "I<shm_perm.cuid> and I<shm_perm.uid> are set to the effective user ID of the "
6297 "calling process."
6298 msgstr ""
6299
6300 #. type: Plain text
6301 #: build/C/man2/shmget.2:156
6302 msgid ""
6303 "I<shm_perm.cgid> and I<shm_perm.gid> are set to the effective group ID of "
6304 "the calling process."
6305 msgstr ""
6306
6307 #. type: Plain text
6308 #: build/C/man2/shmget.2:161
6309 msgid ""
6310 "The least significant 9 bits of I<shm_perm.mode> are set to the least "
6311 "significant 9 bit of I<shmflg>."
6312 msgstr ""
6313
6314 #. type: Plain text
6315 #: build/C/man2/shmget.2:165
6316 msgid "I<shm_segsz> is set to the value of I<size>."
6317 msgstr ""
6318
6319 #. type: Plain text
6320 #: build/C/man2/shmget.2:172
6321 msgid "I<shm_lpid>, I<shm_nattch>, I<shm_atime> and I<shm_dtime> are set to 0."
6322 msgstr ""
6323
6324 #. type: Plain text
6325 #: build/C/man2/shmget.2:175
6326 msgid "I<shm_ctime> is set to the current time."
6327 msgstr ""
6328
6329 #. type: Plain text
6330 #: build/C/man2/shmget.2:178
6331 msgid ""
6332 "If the shared memory segment already exists, the permissions are verified, "
6333 "and a check is made to see if it is marked for destruction."
6334 msgstr ""
6335
6336 #. type: Plain text
6337 #: build/C/man2/shmget.2:182
6338 msgid "A valid segment identifier, I<shmid>, is returned on success, -1 on error."
6339 msgstr ""
6340
6341 #. type: Plain text
6342 #: build/C/man2/shmget.2:186
6343 msgid "On failure, I<errno> is set to one of the following:"
6344 msgstr ""
6345
6346 #. type: Plain text
6347 #: build/C/man2/shmget.2:192
6348 msgid ""
6349 "The user does not have permission to access the shared memory segment, and "
6350 "does not have the B<CAP_IPC_OWNER> capability."
6351 msgstr ""
6352
6353 #. type: Plain text
6354 #: build/C/man2/shmget.2:196
6355 msgid "B<IPC_CREAT | IPC_EXCL> was specified and the segment exists."
6356 msgstr ""
6357
6358 #. type: Plain text
6359 #: build/C/man2/shmget.2:202
6360 msgid ""
6361 "A new segment was to be created and I<size> E<lt> B<SHMMIN> or I<size> E<gt> "
6362 "B<SHMMAX>, or no new segment was to be created, a segment with given key "
6363 "existed, but I<size> is greater than the size of that segment."
6364 msgstr ""
6365
6366 #. type: Plain text
6367 #: build/C/man2/shmget.2:211
6368 msgid "No segment exists for the given I<key>, and B<IPC_CREAT> was not specified."
6369 msgstr ""
6370
6371 #. type: Plain text
6372 #: build/C/man2/shmget.2:214
6373 msgid "No memory could be allocated for segment overhead."
6374 msgstr ""
6375
6376 #. type: Plain text
6377 #: build/C/man2/shmget.2:222
6378 msgid ""
6379 "All possible shared memory IDs have been taken (B<SHMMNI>), or allocating a "
6380 "segment of the requested I<size> would cause the system to exceed the "
6381 "system-wide limit on shared memory (B<SHMALL>)."
6382 msgstr ""
6383
6384 #. type: Plain text
6385 #: build/C/man2/shmget.2:229
6386 msgid ""
6387 "The B<SHM_HUGETLB> flag was specified, but the caller was not privileged "
6388 "(did not have the B<CAP_IPC_LOCK> capability)."
6389 msgstr ""
6390
6391 #. type: Plain text
6392 #: build/C/man2/shmget.2:235
6393 msgid "B<SHM_HUGETLB> is a nonportable Linux extension."
6394 msgstr ""
6395
6396 #. type: Plain text
6397 #: build/C/man2/shmget.2:245
6398 msgid ""
6399 "B<IPC_PRIVATE> isn't a flag field but a I<key_t> type.  If this special "
6400 "value is used for I<key>, the system call ignores everything but the least "
6401 "significant 9 bits of I<shmflg> and creates a new shared memory segment (on "
6402 "success)."
6403 msgstr ""
6404
6405 #. type: Plain text
6406 #: build/C/man2/shmget.2:249
6407 msgid ""
6408 "The following limits on shared memory segment resources affect the "
6409 "B<shmget>()  call:"
6410 msgstr ""
6411
6412 #. type: TP
6413 #: build/C/man2/shmget.2:249
6414 #, no-wrap
6415 msgid "B<SHMALL>"
6416 msgstr ""
6417
6418 #. type: Plain text
6419 #: build/C/man2/shmget.2:254
6420 msgid ""
6421 "System wide maximum of shared memory pages (on Linux, this limit can be read "
6422 "and modified via I</proc/sys/kernel/shmall>)."
6423 msgstr ""
6424
6425 #. type: TP
6426 #: build/C/man2/shmget.2:254
6427 #, no-wrap
6428 msgid "B<SHMMAX>"
6429 msgstr ""
6430
6431 #. type: Plain text
6432 #: build/C/man2/shmget.2:259
6433 msgid ""
6434 "Maximum size in bytes for a shared memory segment: policy dependent (on "
6435 "Linux, this limit can be read and modified via I</proc/sys/kernel/shmmax>)."
6436 msgstr ""
6437
6438 #. type: TP
6439 #: build/C/man2/shmget.2:259
6440 #, no-wrap
6441 msgid "B<SHMMIN>"
6442 msgstr ""
6443
6444 #. type: Plain text
6445 #: build/C/man2/shmget.2:265
6446 msgid ""
6447 "Minimum size in bytes for a shared memory segment: implementation dependent "
6448 "(currently 1 byte, though B<PAGE_SIZE> is the effective minimum size)."
6449 msgstr ""
6450
6451 #. type: TP
6452 #: build/C/man2/shmget.2:265
6453 #, no-wrap
6454 msgid "B<SHMMNI>"
6455 msgstr ""
6456
6457 #.  Kernels between 2.4.x and 2.6.8 had an off-by-one error that meant
6458 #.  that we could create one more segment than SHMMNI -- MTK
6459 #.  This /proc file is not available in Linux 2.2 and earlier -- MTK
6460 #. type: Plain text
6461 #: build/C/man2/shmget.2:274
6462 msgid ""
6463 "System wide maximum number of shared memory segments: implementation "
6464 "dependent (currently 4096, was 128 before Linux 2.3.99; on Linux, this limit "
6465 "can be read and modified via I</proc/sys/kernel/shmmni>)."
6466 msgstr ""
6467
6468 #. type: Plain text
6469 #: build/C/man2/shmget.2:278
6470 msgid ""
6471 "The implementation has no specific limits for the per-process maximum number "
6472 "of shared memory segments (B<SHMSEG>)."
6473 msgstr ""
6474
6475 #. type: Plain text
6476 #: build/C/man2/shmget.2:284
6477 msgid ""
6478 "Until version 2.3.30 Linux would return B<EIDRM> for a B<shmget>()  on a "
6479 "shared memory segment scheduled for deletion."
6480 msgstr ""
6481
6482 #. type: Plain text
6483 #: build/C/man2/shmget.2:290
6484 msgid ""
6485 "The name choice B<IPC_PRIVATE> was perhaps unfortunate, B<IPC_NEW> would "
6486 "more clearly show its function."
6487 msgstr ""
6488
6489 #. type: Plain text
6490 #: build/C/man2/shmget.2:298
6491 msgid ""
6492 "B<shmat>(2), B<shmctl>(2), B<shmdt>(2), B<ftok>(3), B<capabilities>(7), "
6493 "B<shm_overview>(7), B<svipc>(7)"
6494 msgstr ""
6495
6496 #. type: TH
6497 #: build/C/man2/shmop.2:39
6498 #, no-wrap
6499 msgid "SHMOP"
6500 msgstr ""
6501
6502 #. type: TH
6503 #: build/C/man2/shmop.2:39
6504 #, no-wrap
6505 msgid "2008-06-03"
6506 msgstr ""
6507
6508 #. type: Plain text
6509 #: build/C/man2/shmop.2:42
6510 msgid "shmat, shmdt - shared memory operations"
6511 msgstr ""
6512
6513 #. type: Plain text
6514 #: build/C/man2/shmop.2:46
6515 #, no-wrap
6516 msgid ""
6517 "B<#include E<lt>sys/types.hE<gt>>\n"
6518 "B<#include E<lt>sys/shm.hE<gt>>\n"
6519 msgstr ""
6520
6521 #. type: Plain text
6522 #: build/C/man2/shmop.2:48
6523 #, no-wrap
6524 msgid ""
6525 "B<void *shmat(int >I<shmid>B<, const void *>I<shmaddr>B<, int "
6526 ">I<shmflg>B<);>\n"
6527 msgstr ""
6528
6529 #. type: Plain text
6530 #: build/C/man2/shmop.2:50
6531 #, no-wrap
6532 msgid "B<int shmdt(const void *>I<shmaddr>B<);>\n"
6533 msgstr ""
6534
6535 #. type: Plain text
6536 #: build/C/man2/shmop.2:59
6537 msgid ""
6538 "B<shmat>()  attaches the shared memory segment identified by I<shmid> to the "
6539 "address space of the calling process.  The attaching address is specified by "
6540 "I<shmaddr> with one of the following criteria:"
6541 msgstr ""
6542
6543 #. type: Plain text
6544 #: build/C/man2/shmop.2:65
6545 msgid ""
6546 "If I<shmaddr> is NULL, the system chooses a suitable (unused) address at "
6547 "which to attach the segment."
6548 msgstr ""
6549
6550 #. type: Plain text
6551 #: build/C/man2/shmop.2:80
6552 msgid ""
6553 "If I<shmaddr> isn't NULL and B<SHM_RND> is specified in I<shmflg>, the "
6554 "attach occurs at the address equal to I<shmaddr> rounded down to the nearest "
6555 "multiple of B<SHMLBA>.  Otherwise I<shmaddr> must be a page-aligned address "
6556 "at which the attach occurs."
6557 msgstr ""
6558
6559 #. type: Plain text
6560 #: build/C/man2/shmop.2:90
6561 msgid ""
6562 "If B<SHM_RDONLY> is specified in I<shmflg>, the segment is attached for "
6563 "reading and the process must have read permission for the segment.  "
6564 "Otherwise the segment is attached for read and write and the process must "
6565 "have read and write permission for the segment.  There is no notion of a "
6566 "write-only shared memory segment."
6567 msgstr ""
6568
6569 #. type: Plain text
6570 #: build/C/man2/shmop.2:105
6571 msgid ""
6572 "The (Linux-specific)  B<SHM_REMAP> flag may be specified in I<shmflg> to "
6573 "indicate that the mapping of the segment should replace any existing mapping "
6574 "in the range starting at I<shmaddr> and continuing for the size of the "
6575 "segment.  (Normally an B<EINVAL> error would result if a mapping already "
6576 "exists in this address range.)  In this case, I<shmaddr> must not be NULL."
6577 msgstr ""
6578
6579 #. type: Plain text
6580 #: build/C/man2/shmop.2:112
6581 msgid ""
6582 "The B<brk>(2)  value of the calling process is not altered by the attach.  "
6583 "The segment will automatically be detached at process exit.  The same "
6584 "segment may be attached as a read and as a read-write one, and more than "
6585 "once, in the process's address space."
6586 msgstr ""
6587
6588 #. type: Plain text
6589 #: build/C/man2/shmop.2:120
6590 msgid ""
6591 "A successful B<shmat>()  call updates the members of the I<shmid_ds> "
6592 "structure (see B<shmctl>(2))  associated with the shared memory segment as "
6593 "follows:"
6594 msgstr ""
6595
6596 #. type: Plain text
6597 #: build/C/man2/shmop.2:123
6598 msgid "I<shm_atime> is set to the current time."
6599 msgstr ""
6600
6601 #. type: Plain text
6602 #: build/C/man2/shmop.2:126 build/C/man2/shmop.2:152
6603 msgid "I<shm_lpid> is set to the process-ID of the calling process."
6604 msgstr ""
6605
6606 #. type: Plain text
6607 #: build/C/man2/shmop.2:129
6608 msgid "I<shm_nattch> is incremented by one."
6609 msgstr ""
6610
6611 #. type: Plain text
6612 #: build/C/man2/shmop.2:140
6613 msgid ""
6614 "B<shmdt>()  detaches the shared memory segment located at the address "
6615 "specified by I<shmaddr> from the address space of the calling process.  The "
6616 "to-be-detached segment must be currently attached with I<shmaddr> equal to "
6617 "the value returned by the attaching B<shmat>()  call."
6618 msgstr ""
6619
6620 #. type: Plain text
6621 #: build/C/man2/shmop.2:146
6622 msgid ""
6623 "On a successful B<shmdt>()  call the system updates the members of the "
6624 "I<shmid_ds> structure associated with the shared memory segment as follows:"
6625 msgstr ""
6626
6627 #. type: Plain text
6628 #: build/C/man2/shmop.2:149
6629 msgid "I<shm_dtime> is set to the current time."
6630 msgstr ""
6631
6632 #. type: Plain text
6633 #: build/C/man2/shmop.2:157
6634 msgid ""
6635 "I<shm_nattch> is decremented by one.  If it becomes 0 and the segment is "
6636 "marked for deletion, the segment is deleted."
6637 msgstr ""
6638
6639 #. type: Plain text
6640 #: build/C/man2/shmop.2:161
6641 msgid "After a B<fork>(2)  the child inherits the attached shared memory segments."
6642 msgstr ""
6643
6644 #. type: Plain text
6645 #: build/C/man2/shmop.2:165
6646 msgid ""
6647 "After an B<execve>(2)  all attached shared memory segments are detached from "
6648 "the process."
6649 msgstr ""
6650
6651 #. type: Plain text
6652 #: build/C/man2/shmop.2:169
6653 msgid ""
6654 "Upon B<_exit>(2)  all attached shared memory segments are detached from the "
6655 "process."
6656 msgstr ""
6657
6658 #. type: Plain text
6659 #: build/C/man2/shmop.2:177
6660 msgid ""
6661 "On success B<shmat>()  returns the address of the attached shared memory "
6662 "segment; on error I<(void\\ *)\\ -1> is returned, and I<errno> is set to "
6663 "indicate the cause of the error."
6664 msgstr ""
6665
6666 #. type: Plain text
6667 #: build/C/man2/shmop.2:183
6668 msgid ""
6669 "On success B<shmdt>()  returns 0; on error -1 is returned, and I<errno> is "
6670 "set to indicate the cause of the error."
6671 msgstr ""
6672
6673 #. type: Plain text
6674 #: build/C/man2/shmop.2:189
6675 msgid "When B<shmat>()  fails, I<errno> is set to one of the following:"
6676 msgstr ""
6677
6678 #. type: Plain text
6679 #: build/C/man2/shmop.2:195
6680 msgid ""
6681 "The calling process does not have the required permissions for the requested "
6682 "attach type, and does not have the B<CAP_IPC_OWNER> capability."
6683 msgstr ""
6684
6685 #. type: Plain text
6686 #: build/C/man2/shmop.2:209
6687 msgid ""
6688 "Invalid I<shmid> value, unaligned (i.e., not page-aligned and B<SHM_RND> was "
6689 "not specified) or invalid I<shmaddr> value, or can't attach segment at "
6690 "I<shmaddr>, or B<SHM_REMAP> was specified and I<shmaddr> was NULL."
6691 msgstr ""
6692
6693 #. type: Plain text
6694 #: build/C/man2/shmop.2:212
6695 msgid "Could not allocate memory for the descriptor or for the page tables."
6696 msgstr ""
6697
6698 #. type: Plain text
6699 #: build/C/man2/shmop.2:218
6700 msgid "When B<shmdt>()  fails, I<errno> is set as follows:"
6701 msgstr ""
6702
6703 #.  The following since 2.6.17-rc1:
6704 #. type: Plain text
6705 #: build/C/man2/shmop.2:226
6706 msgid ""
6707 "There is no shared memory segment attached at I<shmaddr>; or, I<shmaddr> is "
6708 "not aligned on a page boundary."
6709 msgstr ""
6710
6711 #. type: Plain text
6712 #: build/C/man2/shmop.2:245
6713 msgid ""
6714 "In SVID 3 (or perhaps earlier)  the type of the I<shmaddr> argument was "
6715 "changed from I<char *> into I<const void *>, and the returned type of "
6716 "B<shmat>()  from I<char *> into I<void *>.  (Linux libc4 and libc5 have the "
6717 "I<char *> prototypes; glibc2 has I<void *>.)"
6718 msgstr ""
6719
6720 #. type: Plain text
6721 #: build/C/man2/shmop.2:257
6722 msgid ""
6723 "Using B<shmat>()  with I<shmaddr> equal to NULL is the preferred, portable "
6724 "way of attaching a shared memory segment.  Be aware that the shared memory "
6725 "segment attached in this way may be attached at different addresses in "
6726 "different processes.  Therefore, any pointers maintained within the shared "
6727 "memory must be made relative (typically to the starting address of the "
6728 "segment), rather than absolute."
6729 msgstr ""
6730
6731 #. type: Plain text
6732 #: build/C/man2/shmop.2:262
6733 msgid ""
6734 "On Linux, it is possible to attach a shared memory segment even if it is "
6735 "already marked to be deleted.  However, POSIX.1-2001 does not specify this "
6736 "behavior and many other implementations do not support it."
6737 msgstr ""
6738
6739 #. type: Plain text
6740 #: build/C/man2/shmop.2:265
6741 msgid "The following system parameter affects B<shmat>():"
6742 msgstr ""
6743
6744 #.  FIXME A good explanation of the rationale for the existence
6745 #.  of SHMLBA would be useful here
6746 #. type: TP
6747 #: build/C/man2/shmop.2:265
6748 #, no-wrap
6749 msgid "B<SHMLBA>"
6750 msgstr ""
6751
6752 #.  FIXME That last sentence isn't true for all Linux
6753 #.  architectures (i.e., SHMLBA != PAGE_SIZE for some architectures)
6754 #.  -- MTK, Nov 04
6755 #. type: Plain text
6756 #: build/C/man2/shmop.2:278
6757 msgid ""
6758 "Segment low boundary address multiple.  Must be page aligned.  For the "
6759 "current implementation the B<SHMLBA> value is B<PAGE_SIZE>."
6760 msgstr ""
6761
6762 #. type: Plain text
6763 #: build/C/man2/shmop.2:282
6764 msgid ""
6765 "The implementation places no intrinsic limit on the per-process maximum "
6766 "number of shared memory segments (B<SHMSEG>)."
6767 msgstr ""
6768
6769 #. type: Plain text
6770 #: build/C/man2/shmop.2:290
6771 msgid ""
6772 "B<brk>(2), B<mmap>(2), B<shmctl>(2), B<shmget>(2), B<capabilities>(7), "
6773 "B<shm_overview>(7), B<svipc>(7)"
6774 msgstr ""
6775
6776 #. type: TH
6777 #: build/C/man2/subpage_prot.2:28
6778 #, no-wrap
6779 msgid "SUBPAGE_PROT"
6780 msgstr ""
6781
6782 #. type: TH
6783 #: build/C/man2/subpage_prot.2:28
6784 #, no-wrap
6785 msgid "2010-10-30"
6786 msgstr ""
6787
6788 #. type: Plain text
6789 #: build/C/man2/subpage_prot.2:31
6790 msgid "subpage_prot - define a subpage protection for an address range"
6791 msgstr ""
6792
6793 #. type: Plain text
6794 #: build/C/man2/subpage_prot.2:35
6795 #, no-wrap
6796 msgid ""
6797 "B<long subpage_prot(unsigned long >I<addr>B<, unsigned long >I<len>B<,>\n"
6798 "B<                  uint32_t *>I<map>B<);>\n"
6799 msgstr ""
6800
6801 #. type: Plain text
6802 #: build/C/man2/subpage_prot.2:42
6803 msgid ""
6804 "The PowerPC-specific B<subpage_prot>()  system call provides the facility to "
6805 "control the access permissions on individual 4kB subpages on systems "
6806 "configured with a page size of 64kB."
6807 msgstr ""
6808
6809 #. type: Plain text
6810 #: build/C/man2/subpage_prot.2:49
6811 msgid ""
6812 "The protection map is applied to the memory pages in the region starting at "
6813 "I<addr> and continuing for I<len> bytes.  Both of these arguments must be "
6814 "aligned to a 64-kB boundary."
6815 msgstr ""
6816
6817 #. type: Plain text
6818 #: build/C/man2/subpage_prot.2:61
6819 msgid ""
6820 "The protection map is specified in the buffer pointed to by I<map>.  The map "
6821 "has 2 bits per 4kB subpage; thus each 32-bit word specifies the protections "
6822 "of 16 4kB subpages inside a 64kB page (so, the number of 32-bit words "
6823 "pointed to by I<map> should equate to the number of 64-kB pages specified by "
6824 "I<len>).  Each 2-bit field in the protection map is either 0 to allow any "
6825 "access, 1 to prevent writes, or 2 or 3 to prevent all accesses."
6826 msgstr ""
6827
6828 #. type: Plain text
6829 #: build/C/man2/subpage_prot.2:66
6830 msgid ""
6831 "On success, B<subpage_prot>()  returns 0.  Otherwise, one of the error codes "
6832 "specified below is returned."
6833 msgstr ""
6834
6835 #. type: Plain text
6836 #: build/C/man2/subpage_prot.2:72
6837 msgid "The buffer referred to by I<map> is not accessible."
6838 msgstr ""
6839
6840 #. type: Plain text
6841 #: build/C/man2/subpage_prot.2:82
6842 msgid ""
6843 "The I<addr> or I<len> arguments are incorrect.  Both of these arguments must "
6844 "be aligned to a multiple of the system page size, and they must not refer to "
6845 "a region outside of the address space of the process or to a region that "
6846 "consists of huge pages."
6847 msgstr ""
6848
6849 #. type: Plain text
6850 #: build/C/man2/subpage_prot.2:85 build/C/man2/sync_file_range.2:166
6851 msgid "Out of memory."
6852 msgstr ""
6853
6854 #. type: Plain text
6855 #: build/C/man2/subpage_prot.2:91
6856 msgid ""
6857 "This system call is provided on the PowerPC architecture since Linux "
6858 "2.6.25.  The system call is provided only if the kernel is configured with "
6859 "B<CONFIG_PPC_64K_PAGES>.  No library support is provided."
6860 msgstr ""
6861
6862 #. type: Plain text
6863 #: build/C/man2/subpage_prot.2:98
6864 msgid ""
6865 "Normal page protections (at the 64-kB page level) also apply; the subpage "
6866 "protection mechanism is an additional constraint, so putting 0 in a 2-bit "
6867 "field won't allow writes to a page that is otherwise write-protected."
6868 msgstr ""
6869
6870 #. type: SS
6871 #: build/C/man2/subpage_prot.2:98
6872 #, no-wrap
6873 msgid "Rationale"
6874 msgstr ""
6875
6876 #.  In the initial implementation, it was the case that:
6877 #.      In fact the whole process is switched to use 4k hardware pages when the
6878 #.      subpage_prot system call is used, but this could be improved in future
6879 #.      to switch only the affected segments.
6880 #.  But Paul Mackerass says (Oct 2010): I'm pretty sure we now only switch
6881 #.  the affected segment, not the whole process.
6882 #. type: Plain text
6883 #: build/C/man2/subpage_prot.2:120
6884 msgid ""
6885 "This system call is provided to assist writing emulators that operate using "
6886 "64-kB pages on PowerPC systems.  When emulating systems such as x86, which "
6887 "uses a smaller page size, the emulator can no longer use the "
6888 "memory-management unit (MMU)  and normal system calls for controlling page "
6889 "protections.  (The emulator could emulate the MMU by checking and possibly "
6890 "remapping the address for each memory access in software, but that is slow.)  "
6891 "The idea is that the emulator supplies an array of protection masks to apply "
6892 "to a specified range of virtual addresses.  These masks are applied at the "
6893 "level where hardware page-table entries (PTEs)  are inserted into the "
6894 "hardware page table based on the Linux PTEs, so the Linux PTEs are not "
6895 "affected.  Implicit in this is that the regions of the address space that "
6896 "are protected are switched to use 4-kB hardware pages rather than 64-kB "
6897 "hardware pages (on machines with hardware 64-kB page support)."
6898 msgstr ""
6899
6900 #. type: Plain text
6901 #: build/C/man2/subpage_prot.2:123
6902 msgid "B<mprotect>(2), B<syscall>(2);"
6903 msgstr ""
6904
6905 #. type: Plain text
6906 #: build/C/man2/subpage_prot.2:126
6907 msgid "the kernel source file I<Documentation/vm/hugetlbpage.txt>."
6908 msgstr ""
6909
6910 #. type: TH
6911 #: build/C/man2/sync_file_range.2:30
6912 #, no-wrap
6913 msgid "SYNC_FILE_RANGE"
6914 msgstr ""
6915
6916 #. type: Plain text
6917 #: build/C/man2/sync_file_range.2:33
6918 msgid "sync_file_range - sync a file segment with disk"
6919 msgstr ""
6920
6921 #. type: Plain text
6922 #: build/C/man2/sync_file_range.2:37
6923 #, no-wrap
6924 msgid ""
6925 "B<#define _GNU_SOURCE>         /* See feature_test_macros(7) */\n"
6926 "B<#include E<lt>fcntl.hE<gt>>\n"
6927 msgstr ""
6928
6929 #. type: Plain text
6930 #: build/C/man2/sync_file_range.2:40
6931 #, no-wrap
6932 msgid ""
6933 "B<int sync_file_range(int >I<fd>B<, off64_t >I<offset>B<, off64_t "
6934 ">I<nbytes>B<,>\n"
6935 "B<                    unsigned int >I<flags>B<);>\n"
6936 msgstr ""
6937
6938 #. type: Plain text
6939 #: build/C/man2/sync_file_range.2:47
6940 msgid ""
6941 "B<sync_file_range>()  permits fine control when synchronizing the open file "
6942 "referred to by the file descriptor I<fd> with disk."
6943 msgstr ""
6944
6945 #. type: Plain text
6946 #: build/C/man2/sync_file_range.2:61
6947 msgid ""
6948 "I<offset> is the starting byte of the file range to be synchronized.  "
6949 "I<nbytes> specifies the length of the range to be synchronized, in bytes; if "
6950 "I<nbytes> is zero, then all bytes from I<offset> through to the end of file "
6951 "are synchronized.  Synchronization is in units of the system page size: "
6952 "I<offset> is rounded down to a page boundary; I<(offset+nbytes-1)> is "
6953 "rounded up to a page boundary."
6954 msgstr ""
6955
6956 #. type: Plain text
6957 #: build/C/man2/sync_file_range.2:65
6958 msgid "The I<flags> bit-mask argument can include any of the following values:"
6959 msgstr ""
6960
6961 #. type: TP
6962 #: build/C/man2/sync_file_range.2:65
6963 #, no-wrap
6964 msgid "B<SYNC_FILE_RANGE_WAIT_BEFORE>"
6965 msgstr ""
6966
6967 #. type: Plain text
6968 #: build/C/man2/sync_file_range.2:70
6969 msgid ""
6970 "Wait upon write-out of all pages in the specified range that have already "
6971 "been submitted to the device driver for write-out before performing any "
6972 "write."
6973 msgstr ""
6974
6975 #. type: TP
6976 #: build/C/man2/sync_file_range.2:70 build/C/man2/sync_file_range.2:120
6977 #, no-wrap
6978 msgid "B<SYNC_FILE_RANGE_WRITE>"
6979 msgstr ""
6980
6981 #. type: Plain text
6982 #: build/C/man2/sync_file_range.2:76
6983 msgid ""
6984 "Initiate write-out of all dirty pages in the specified range which are not "
6985 "presently submitted write-out.  Note that even this may block if you attempt "
6986 "to write more than request queue size."
6987 msgstr ""
6988
6989 #. type: TP
6990 #: build/C/man2/sync_file_range.2:76
6991 #, no-wrap
6992 msgid "B<SYNC_FILE_RANGE_WAIT_AFTER>"
6993 msgstr ""
6994
6995 #. type: Plain text
6996 #: build/C/man2/sync_file_range.2:80
6997 msgid "Wait upon write-out of all pages in the range after performing any write."
6998 msgstr ""
6999
7000 #. type: Plain text
7001 #: build/C/man2/sync_file_range.2:84
7002 msgid "Specifying I<flags> as 0 is permitted, as a no-op."
7003 msgstr ""
7004
7005 #. type: SS
7006 #: build/C/man2/sync_file_range.2:84
7007 #, no-wrap
7008 msgid "Warning"
7009 msgstr ""
7010
7011 #. type: Plain text
7012 #: build/C/man2/sync_file_range.2:100
7013 msgid ""
7014 "This system call is extremely dangerous and should not be used in portable "
7015 "programs.  None of these operations writes out the file's metadata.  "
7016 "Therefore, unless the application is strictly performing overwrites of "
7017 "already-instantiated disk blocks, there are no guarantees that the data will "
7018 "be available after a crash.  There is no user interface to know if a write "
7019 "is purely an overwrite.  On file systems using copy-on-write semantics "
7020 "(e.g., I<btrfs>)  an overwrite of existing allocated blocks is impossible.  "
7021 "When writing into preallocated space, many file systems also require calls "
7022 "into the block allocator, which this system call does not sync out to disk.  "
7023 "This system call does not flush disk write caches and thus does not provide "
7024 "any data integrity on systems with volatile disk write caches."
7025 msgstr ""
7026
7027 #. type: SS
7028 #: build/C/man2/sync_file_range.2:100
7029 #, no-wrap
7030 msgid "Some details"
7031 msgstr ""
7032
7033 #. type: Plain text
7034 #: build/C/man2/sync_file_range.2:108
7035 msgid ""
7036 "B<SYNC_FILE_RANGE_WAIT_BEFORE> and B<SYNC_FILE_RANGE_WAIT_AFTER> will detect "
7037 "any I/O errors or B<ENOSPC> conditions and will return these to the caller."
7038 msgstr ""
7039
7040 #. type: Plain text
7041 #: build/C/man2/sync_file_range.2:112
7042 msgid "Useful combinations of the I<flags> bits are:"
7043 msgstr ""
7044
7045 #. type: TP
7046 #: build/C/man2/sync_file_range.2:112
7047 #, no-wrap
7048 msgid "B<SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE>"
7049 msgstr ""
7050
7051 #. type: Plain text
7052 #: build/C/man2/sync_file_range.2:120
7053 msgid ""
7054 "Ensures that all pages in the specified range which were dirty when "
7055 "B<sync_file_range>()  was called are placed under write-out.  This is a "
7056 "start-write-for-data-integrity operation."
7057 msgstr ""
7058
7059 #. type: Plain text
7060 #: build/C/man2/sync_file_range.2:127
7061 msgid ""
7062 "Start write-out of all dirty pages in the specified range which are not "
7063 "presently under write-out.  This is an asynchronous flush-to-disk "
7064 "operation.  This is not suitable for data integrity operations."
7065 msgstr ""
7066
7067 #. type: TP
7068 #: build/C/man2/sync_file_range.2:127
7069 #, no-wrap
7070 msgid "B<SYNC_FILE_RANGE_WAIT_BEFORE> (or B<SYNC_FILE_RANGE_WAIT_AFTER>)"
7071 msgstr ""
7072
7073 #. type: Plain text
7074 #: build/C/man2/sync_file_range.2:134
7075 msgid ""
7076 "Wait for completion of write-out of all pages in the specified range.  This "
7077 "can be used after an earlier B<SYNC_FILE_RANGE_WAIT_BEFORE | "
7078 "SYNC_FILE_RANGE_WRITE> operation to wait for completion of that operation, "
7079 "and obtain its result."
7080 msgstr ""
7081
7082 #. type: TP
7083 #: build/C/man2/sync_file_range.2:134
7084 #, no-wrap
7085 msgid ""
7086 "B<SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE | "
7087 "SYNC_FILE_RANGE_WAIT_AFTER>"
7088 msgstr ""
7089
7090 #. type: Plain text
7091 #: build/C/man2/sync_file_range.2:141
7092 msgid ""
7093 "This is a write-for-data-integrity operation that will ensure that all pages "
7094 "in the specified range which were dirty when B<sync_file_range>()  was "
7095 "called are committed to disk."
7096 msgstr ""
7097
7098 #. type: Plain text
7099 #: build/C/man2/sync_file_range.2:147
7100 msgid ""
7101 "On success, B<sync_file_range>()  returns 0; on failure -1 is returned and "
7102 "I<errno> is set to indicate the error."
7103 msgstr ""
7104
7105 #. type: Plain text
7106 #: build/C/man2/sync_file_range.2:152
7107 msgid "I<fd> is not a valid file descriptor."
7108 msgstr ""
7109
7110 #. type: Plain text
7111 #: build/C/man2/sync_file_range.2:160
7112 msgid "I<flags> specifies an invalid bit; or I<offset> or I<nbytes> is invalid."
7113 msgstr ""
7114
7115 #. type: Plain text
7116 #: build/C/man2/sync_file_range.2:163
7117 msgid "I/O error."
7118 msgstr ""
7119
7120 #. type: Plain text
7121 #: build/C/man2/sync_file_range.2:169
7122 msgid "Out of disk space."
7123 msgstr ""
7124
7125 #.  FIXME . (bug?) Actually, how can 'fd' refer to a symbolic link (S_ISLNK)?
7126 #.  (In userspace at least) it isn't possible to obtain a file descriptor
7127 #.  for a symbolic link.
7128 #. type: Plain text
7129 #: build/C/man2/sync_file_range.2:177
7130 msgid ""
7131 "I<fd> refers to something other than a regular file, a block device, a "
7132 "directory, or a symbolic link."
7133 msgstr ""
7134
7135 #. type: Plain text
7136 #: build/C/man2/sync_file_range.2:180
7137 msgid "B<sync_file_range>()  appeared on Linux in kernel 2.6.17."
7138 msgstr ""
7139
7140 #. type: Plain text
7141 #: build/C/man2/sync_file_range.2:183
7142 msgid ""
7143 "This system call is Linux-specific, and should be avoided in portable "
7144 "programs."
7145 msgstr ""
7146
7147 #.  See kernel commit edd5cd4a9424f22b0fa08bef5e299d41befd5622
7148 #. type: Plain text
7149 #: build/C/man2/sync_file_range.2:196
7150 msgid ""
7151 "Some architectures (e.g., PowerPC, ARM)  need 64-bit arguments to be aligned "
7152 "in a suitable pair of registers.  On such architectures, the call signature "
7153 "of B<sync_file_range>()  is flawed, since it forces a register to be wasted "
7154 "as padding between the I<fd> and I<offset> arguments.  Therefore, these "
7155 "architectures define a different system call that orders the arguments "
7156 "suitably:"
7157 msgstr ""
7158
7159 #. type: Plain text
7160 #: build/C/man2/sync_file_range.2:201
7161 #, no-wrap
7162 msgid ""
7163 "B<int sync_file_range2(int >I<fd>B<, unsigned int >I<flags>B<,>\n"
7164 "B<                     off64_t >I<offset>B<, off64_t >I<nbytes>B<);>\n"
7165 msgstr ""
7166
7167 #. type: Plain text
7168 #: build/C/man2/sync_file_range.2:206
7169 msgid ""
7170 "The behavior of this system call is otherwise exactly the same as "
7171 "B<sync_file_range>()."
7172 msgstr ""
7173
7174 #. type: Plain text
7175 #: build/C/man2/sync_file_range.2:217
7176 msgid ""
7177 "A system call with this signature first appeared on the ARM architecture in "
7178 "Linux 2.6.20, with the name B<arm_sync_file_range>().  It was renamed in "
7179 "Linux 2.6.22, when the analogous system call was added for PowerPC.  On "
7180 "architectures where glibc support is provided, glibc transparently wraps "
7181 "B<sync_file_range2>()  under the name B<sync_file_range>()."
7182 msgstr ""
7183
7184 #. type: Plain text
7185 #: build/C/man2/sync_file_range.2:222
7186 msgid "B<fdatasync>(2), B<fsync>(2), B<msync>(2), B<sync>(2)"
7187 msgstr ""