OSDN Git Service

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