OSDN Git Service

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