Debian Codegraph @

templates/man2/mmap.2.pot

raw
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: 2026-06-05 06:31+0200\n"
11 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
12 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13 "Language-Team: LANGUAGE <[email protected]>\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 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
21 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
22 #, no-wrap
23 msgid "mmap"
24 msgstr ""
25
26 #. type: TH
27 #: archlinux debian-unstable opensuse-leap-16-1 opensuse-tumbleweed
28 #, no-wrap
29 msgid "2026-03-19"
30 msgstr ""
31
32 #. type: TH
33 #: archlinux debian-unstable
34 #, no-wrap
35 msgid "Linux man-pages 6.18"
36 msgstr ""
37
38 #. type: SH
39 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
40 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
41 #, no-wrap
42 msgid "NAME"
43 msgstr ""
44
45 #. type: Plain text
46 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
47 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
48 msgid "mmap, munmap - map or unmap files or devices into memory"
49 msgstr ""
50
51 #. type: SH
52 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
53 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
54 #, no-wrap
55 msgid "LIBRARY"
56 msgstr ""
57
58 #. type: Plain text
59 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
60 #: opensuse-leap-16-1 opensuse-tumbleweed
61 msgid "Standard C library (I<libc>,\\ I<-lc>)"
62 msgstr ""
63
64 #. type: SH
65 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
66 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
67 #, no-wrap
68 msgid "SYNOPSIS"
69 msgstr ""
70
71 #. type: Plain text
72 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
73 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
74 #, no-wrap
75 msgid "B<#include E<lt>sys/mman.hE<gt>>\n"
76 msgstr ""
77
78 #. type: Plain text
79 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
80 #: opensuse-tumbleweed
81 #, no-wrap
82 msgid ""
83 "B<void *mmap(>size_t length;\n"
84 "B< void >I<addr>B<[>I<length>B<], size_t >I<length>B<, int >I<prot>B<, int >I<flags>B<,>\n"
85 "B< int >I<fd>B<, off_t >I<offset>B<);>\n"
86 "B<int munmap(>size_t length;\n"
87 "B< void >I<addr>B<[>I<length>B<], size_t >I<length>B<);>\n"
88 msgstr ""
89
90 #. type: Plain text
91 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
92 #: opensuse-leap-16-1 opensuse-tumbleweed
93 msgid "See VERSIONS for information on feature test macro requirements."
94 msgstr ""
95
96 #. type: SH
97 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
98 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
99 #, no-wrap
100 msgid "DESCRIPTION"
101 msgstr ""
102
103 #. type: Plain text
104 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
105 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
106 msgid ""
107 "B<mmap>() creates a new mapping in the virtual address space of the calling "
108 "process. The starting address for the new mapping is specified in I<addr>. "
109 "The I<length> argument specifies the length of the mapping (which must be "
110 "greater than 0)."
111 msgstr ""
112
113 #. Before Linux 2.6.24, the address was rounded up to the next page
114 #. boundary; since Linux 2.6.24, it is rounded down!
115 #. type: Plain text
116 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
117 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
118 msgid ""
119 "If I<addr> is NULL, then the kernel chooses the (page-aligned) address at "
120 "which to create the mapping; this is the most portable method of creating a "
121 "new mapping. If I<addr> is not NULL, then the kernel takes it as a hint "
122 "about where to place the mapping; on Linux, the kernel will pick a nearby "
123 "page boundary (but always above or equal to the value specified by I</proc/"
124 "sys/vm/mmap_min_addr>) and attempt to create the mapping there. If another "
125 "mapping already exists there, the kernel picks a new address that may or may "
126 "not depend on the hint. The address of the new mapping is returned as the "
127 "result of the call."
128 msgstr ""
129
130 #. type: Plain text
131 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
132 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
133 msgid ""
134 "The contents of a file mapping (as opposed to an anonymous mapping; see "
135 "B<MAP_ANONYMOUS> below), are initialized using I<length> bytes starting at "
136 "offset I<offset> in the file (or other object) referred to by the file "
137 "descriptor I<fd>. I<offset> must be a multiple of the page size as returned "
138 "by I<sysconf(_SC_PAGE_SIZE)>."
139 msgstr ""
140
141 #. type: Plain text
142 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
143 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
144 msgid ""
145 "After the B<mmap>() call has returned, the file descriptor, I<fd>, can be "
146 "closed immediately without invalidating the mapping."
147 msgstr ""
148
149 #. type: Plain text
150 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
151 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
152 msgid ""
153 "The I<prot> argument describes the desired memory protection of the mapping "
154 "(and must not conflict with the open mode of the file). It is either "
155 "B<PROT_NONE> or the bitwise OR of one or more of the following flags:"
156 msgstr ""
157
158 #. type: TP
159 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
160 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
161 #, no-wrap
162 msgid "B<PROT_EXEC>"
163 msgstr ""
164
165 #. type: Plain text
166 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
167 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
168 msgid "Pages may be executed."
169 msgstr ""
170
171 #. type: TP
172 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
173 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
174 #, no-wrap
175 msgid "B<PROT_READ>"
176 msgstr ""
177
178 #. type: Plain text
179 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
180 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
181 msgid "Pages may be read."
182 msgstr ""
183
184 #. type: TP
185 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
186 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
187 #, no-wrap
188 msgid "B<PROT_WRITE>"
189 msgstr ""
190
191 #. type: Plain text
192 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
193 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
194 msgid "Pages may be written."
195 msgstr ""
196
197 #. type: TP
198 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
199 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
200 #, no-wrap
201 msgid "B<PROT_NONE>"
202 msgstr ""
203
204 #. type: Plain text
205 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
206 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
207 msgid "Pages may not be accessed."
208 msgstr ""
209
210 #. type: SS
211 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
212 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
213 #, no-wrap
214 msgid "The flags argument"
215 msgstr ""
216
217 #. type: Plain text
218 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
219 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
220 msgid ""
221 "The I<flags> argument determines whether updates to the mapping are visible "
222 "to other processes mapping the same region, and whether updates are carried "
223 "through to the underlying file. This behavior is determined by including "
224 "exactly one of the following values in I<flags>:"
225 msgstr ""
226
227 #. type: TP
228 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
229 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
230 #, no-wrap
231 msgid "B<MAP_SHARED>"
232 msgstr ""
233
234 #. type: Plain text
235 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
236 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
237 msgid ""
238 "Share this mapping. Updates to the mapping are visible to other processes "
239 "mapping the same region, and (in the case of file-backed mappings) are "
240 "carried through to the underlying file. (To precisely control when updates "
241 "are carried through to the underlying file requires the use of B<msync>(2).)"
242 msgstr ""
243
244 #. type: TP
245 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
246 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
247 #, no-wrap
248 msgid "B<MAP_SHARED_VALIDATE> (since Linux 4.15)"
249 msgstr ""
250
251 #. type: Plain text
252 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
253 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
254 msgid ""
255 "This flag provides the same behavior as B<MAP_SHARED> except that "
256 "B<MAP_SHARED> mappings ignore unknown flags in I<flags>. By contrast, when "
257 "creating a mapping using B<MAP_SHARED_VALIDATE>, the kernel verifies all "
258 "passed flags are known and fails the mapping with the error B<EOPNOTSUPP> "
259 "for unknown flags. This mapping type is also required to be able to use "
260 "some mapping flags (e.g., B<MAP_SYNC>)."
261 msgstr ""
262
263 #. type: TP
264 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
265 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
266 #, no-wrap
267 msgid "B<MAP_PRIVATE>"
268 msgstr ""
269
270 #. type: Plain text
271 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
272 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
273 msgid ""
274 "Create a private copy-on-write mapping. Updates to the mapping are not "
275 "visible to other processes mapping the same file, and are not carried "
276 "through to the underlying file. It is unspecified whether changes made to "
277 "the file after the B<mmap>() call are visible in the mapped region."
278 msgstr ""
279
280 #. type: Plain text
281 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
282 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
283 msgid ""
284 "Both B<MAP_SHARED> and B<MAP_PRIVATE> are described in POSIX.1-2001 and "
285 "POSIX.1-2008. B<MAP_SHARED_VALIDATE> is a Linux extension."
286 msgstr ""
287
288 #. type: Plain text
289 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
290 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
291 msgid ""
292 "In addition, zero or more of the following values can be ORed in I<flags>:"
293 msgstr ""
294
295 #. type: TP
296 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
297 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
298 #, no-wrap
299 msgid "B<MAP_32BIT> (since Linux 2.4.20, 2.6)"
300 msgstr ""
301
302 #. See http://lwn.net/Articles/294642 "Tangled up in threads", 19 Aug 08
303 #. type: Plain text
304 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
305 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
306 msgid ""
307 "Put the mapping into the first 2 Gigabytes of the process address space. "
308 "This flag is supported only on x86-64, for 64-bit programs. It was added to "
309 "allow thread stacks to be allocated somewhere in the first 2\\ GB of memory, "
310 "so as to improve context-switch performance on some early 64-bit "
311 "processors. Modern x86-64 processors no longer have this performance "
312 "problem, so use of this flag is not required on those systems. The "
313 "B<MAP_32BIT> flag is ignored when B<MAP_FIXED> is set."
314 msgstr ""
315
316 #. type: TP
317 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
318 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
319 #, no-wrap
320 msgid "B<MAP_ANON>"
321 msgstr ""
322
323 #. type: Plain text
324 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
325 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
326 msgid ""
327 "Synonym for B<MAP_ANONYMOUS>; provided for compatibility with other "
328 "implementations."
329 msgstr ""
330
331 #. type: TP
332 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
333 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
334 #, no-wrap
335 msgid "B<MAP_ANONYMOUS>"
336 msgstr ""
337
338 #. See the pgoff overflow check in do_mmap().
339 #. See the offset check in sys_mmap in arch/x86/kernel/sys_x86_64.c.
340 #. type: Plain text
341 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
342 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
343 msgid ""
344 "The mapping is not backed by any file; its contents are initialized to "
345 "zero. The I<fd> argument is ignored; however, some implementations require "
346 "I<fd> to be -1 if B<MAP_ANONYMOUS> (or B<MAP_ANON>) is specified, and "
347 "portable applications should ensure this. The I<offset> argument should be "
348 "zero. Support for B<MAP_ANONYMOUS> in conjunction with B<MAP_SHARED> was "
349 "added in Linux 2.4."
350 msgstr ""
351
352 #. type: TP
353 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
354 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
355 #, no-wrap
356 msgid "B<MAP_DENYWRITE>"
357 msgstr ""
358
359 #. Introduced in 1.1.36, removed in 1.3.24.
360 #. type: Plain text
361 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
362 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
363 msgid ""
364 "This flag is ignored. (Long ago\\[em]Linux 2.0 and earlier\\[em]it signaled "
365 "that attempts to write to the underlying file should fail with B<ETXTBSY>. "
366 "But this was a source of denial-of-service attacks.)"
367 msgstr ""
368
369 #. type: TP
370 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
371 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
372 #, no-wrap
373 msgid "B<MAP_EXECUTABLE>"
374 msgstr ""
375
376 #. #-#-#-#-# archlinux: mmap.2.pot (PACKAGE VERSION) #-#-#-#-#
377 #. Introduced in 1.1.38, removed in 1.3.24. Flag tested in proc_follow_link.
378 #. (Long ago, it signaled that the underlying file is an executable.
379 #. However, that information was not really used anywhere.)
380 #. Linus talked about DOS related to MAP_EXECUTABLE, but he was thinking of
381 #. MAP_DENYWRITE?
382 #. type: Plain text
383 #. #-#-#-#-# debian-trixie: mmap.2.pot (PACKAGE VERSION) #-#-#-#-#
384 #. Introduced in 1.1.38, removed in 1.3.24. Flag tested in proc_follow_link.
385 #. (Long ago, it signaled that the underlying file is an executable.
386 #. However, that information was not really used anywhere.)
387 #. Linus talked about DOS related to MAP_EXECUTABLE, but he was thinking of
388 #. MAP_DENYWRITE?
389 #. type: Plain text
390 #. #-#-#-#-# debian-unstable: mmap.2.pot (PACKAGE VERSION) #-#-#-#-#
391 #. Introduced in 1.1.38, removed in 1.3.24. Flag tested in proc_follow_link.
392 #. (Long ago, it signaled that the underlying file is an executable.
393 #. However, that information was not really used anywhere.)
394 #. Linus talked about DOS related to MAP_EXECUTABLE, but he was thinking of
395 #. MAP_DENYWRITE?
396 #. type: Plain text
397 #. #-#-#-#-# fedora-44: mmap.2.pot (PACKAGE VERSION) #-#-#-#-#
398 #. Introduced in 1.1.38, removed in 1.3.24. Flag tested in proc_follow_link.
399 #. (Long ago, it signaled that the underlying file is an executable.
400 #. However, that information was not really used anywhere.)
401 #. Linus talked about DOS related to MAP_EXECUTABLE, but he was thinking of
402 #. MAP_DENYWRITE?
403 #. type: Plain text
404 #. #-#-#-#-# fedora-rawhide: mmap.2.pot (PACKAGE VERSION) #-#-#-#-#
405 #. Introduced in 1.1.38, removed in 1.3.24. Flag tested in proc_follow_link.
406 #. (Long ago, it signaled that the underlying file is an executable.
407 #. However, that information was not really used anywhere.)
408 #. Linus talked about DOS related to MAP_EXECUTABLE, but he was thinking of
409 #. MAP_DENYWRITE?
410 #. type: Plain text
411 #. #-#-#-#-# mageia-cauldron: mmap.2.pot (PACKAGE VERSION) #-#-#-#-#
412 #. Introduced in 1.1.38, removed in 1.3.24. Flag tested in proc_follow_link.
413 #. (Long ago, it signaled that the underlying file is an executable.
414 #. However, that information was not really used anywhere.)
415 #. Linus talked about DOS related to MAP_EXECUTABLE, but he was thinking of
416 #. MAP_DENYWRITE?
417 #. type: Plain text
418 #. #-#-#-#-# opensuse-leap-16-1: mmap.2.pot (PACKAGE VERSION) #-#-#-#-#
419 #. Introduced in 1.1.38, removed in 1.3.24. Flag tested in proc_follow_link.
420 #. (Long ago, it signaled that the underlying file is an executable.
421 #. However, that information was not really used anywhere.)
422 #. Linus talked about DOS related to MAP_EXECUTABLE, but he was thinking of
423 #. MAP_DENYWRITE?
424 #. type: Plain text
425 #. #-#-#-#-# opensuse-tumbleweed: mmap.2.pot (PACKAGE VERSION) #-#-#-#-#
426 #. Introduced in 1.1.38, removed in 1.3.24. Flag tested in proc_follow_link.
427 #. (Long ago, it signaled that the underlying file is an executable.
428 #. However, that information was not really used anywhere.)
429 #. Linus talked about DOS related to MAP_EXECUTABLE, but he was thinking of
430 #. MAP_DENYWRITE?
431 #. type: Plain text
432 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
433 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
434 msgid "This flag is ignored."
435 msgstr ""
436
437 #. type: TP
438 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
439 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
440 #, no-wrap
441 msgid "B<MAP_FILE>"
442 msgstr ""
443
444 #. On some systems, this was required as the opposite of
445 #. MAP_ANONYMOUS -- mtk, 1 May 2007
446 #. type: Plain text
447 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
448 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
449 msgid "Compatibility flag. Ignored."
450 msgstr ""
451
452 #. type: TP
453 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
454 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
455 #, no-wrap
456 msgid "B<MAP_FIXED>"
457 msgstr ""
458
459 #. type: Plain text
460 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
461 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
462 msgid ""
463 "Don't interpret I<addr> as a hint: place the mapping at exactly that "
464 "address. I<addr> must be suitably aligned: for most architectures a "
465 "multiple of the page size is sufficient; however, some architectures may "
466 "impose additional restrictions. If the memory region specified by I<addr> "
467 "and I<length> overlaps pages of any existing mapping(s), then the overlapped "
468 "part of the existing mapping(s) will be discarded. If the specified address "
469 "cannot be used, B<mmap>() will fail."
470 msgstr ""
471
472 #. type: Plain text
473 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
474 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
475 msgid ""
476 "Software that aspires to be portable should use the B<MAP_FIXED> flag with "
477 "care, keeping in mind that the exact layout of a process's memory mappings "
478 "is allowed to change significantly between Linux versions, C library "
479 "versions, and operating system releases. I<Carefully read the discussion of "
480 "this flag in NOTES!>"
481 msgstr ""
482
483 #. type: TP
484 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
485 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
486 #, no-wrap
487 msgid "B<MAP_FIXED_NOREPLACE> (since Linux 4.17)"
488 msgstr ""
489
490 #. commit a4ff8e8620d3f4f50ac4b41e8067b7d395056843
491 #. type: Plain text
492 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
493 #: opensuse-tumbleweed
494 msgid ""
495 "This flag provides behavior that is similar to B<MAP_FIXED> with respect to "
496 "the I<addr> enforcement, but differs in that B<MAP_FIXED_NOREPLACE> never "
497 "clobbers a preexisting mapped range. If the requested range would collide "
498 "with an existing mapping, then this call fails with the error B<EEXIST.> "
499 "This flag can therefore be used as a way to atomically (with respect to "
500 "other threads) attempt to map an address range: one thread will succeed; "
501 "all others will report failure."
502 msgstr ""
503
504 #. type: Plain text
505 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
506 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
507 msgid ""
508 "Note that older kernels which do not recognize the B<MAP_FIXED_NOREPLACE> "
509 "flag will typically (upon detecting a collision with a preexisting mapping) "
510 "fall back to a \\[lq]non-B<MAP_FIXED>\\[rq] type of behavior: they will "
511 "return an address that is different from the requested address. Therefore, "
512 "backward-compatible software should check the returned address against the "
513 "requested address."
514 msgstr ""
515
516 #. type: TP
517 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
518 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
519 #, no-wrap
520 msgid "B<MAP_GROWSDOWN>"
521 msgstr ""
522
523 #. type: Plain text
524 #: archlinux debian-unstable opensuse-leap-16-1 opensuse-tumbleweed
525 msgid ""
526 "This flag is used for stacks. It indicates to the kernel virtual memory "
527 "system that the mapping should extend downward in memory. Touching an "
528 "address in the \"guard\" page below the mapping will cause the mapping to "
529 "grow by a page. This growth can be repeated until the mapping grows to "
530 "within a page of the high end of the next lower mapping, at which point "
531 "touching the \"guard\" page will result in a B<SIGSEGV> signal."
532 msgstr ""
533
534 #. type: TP
535 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
536 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
537 #, no-wrap
538 msgid "B<MAP_HUGETLB> (since Linux 2.6.32)"
539 msgstr ""
540
541 #. type: Plain text
542 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
543 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
544 msgid ""
545 "Allocate the mapping using \"huge\" pages. See the Linux kernel source file "
546 "I<Documentation/admin-guide/mm/hugetlbpage.rst> for further information, as "
547 "well as NOTES, below."
548 msgstr ""
549
550 #. type: TP
551 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
552 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
553 #, no-wrap
554 msgid "B<MAP_HUGE_2MB>"
555 msgstr ""
556
557 #. type: TQ
558 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
559 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
560 #, no-wrap
561 msgid "B<MAP_HUGE_1GB> (since Linux 3.8)"
562 msgstr ""
563
564 #. See https://lwn.net/Articles/533499/
565 #. type: Plain text
566 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
567 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
568 msgid ""
569 "Used in conjunction with B<MAP_HUGETLB> to select alternative hugetlb page "
570 "sizes (respectively, 2\\ MB and 1\\ GB) on systems that support multiple "
571 "hugetlb page sizes."
572 msgstr ""
573
574 #. type: Plain text
575 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
576 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
577 msgid ""
578 "More generally, the desired huge page size can be configured by encoding the "
579 "base-2 logarithm of the desired page size in the six bits at the offset "
580 "B<MAP_HUGE_SHIFT>. (A value of zero in this bit field provides the default "
581 "huge page size; the default huge page size can be discovered via the "
582 "I<Hugepagesize> field exposed by I</proc/meminfo>.) Thus, the above two "
583 "constants are defined as:"
584 msgstr ""
585
586 #. type: Plain text
587 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
588 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
589 #, no-wrap
590 msgid ""
591 "#define MAP_HUGE_2MB (21 E<lt>E<lt> MAP_HUGE_SHIFT)\n"
592 "#define MAP_HUGE_1GB (30 E<lt>E<lt> MAP_HUGE_SHIFT)\n"
593 msgstr ""
594
595 #. type: Plain text
596 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
597 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
598 msgid ""
599 "The range of huge page sizes that are supported by the system can be "
600 "discovered by listing the subdirectories in I</sys/kernel/mm/hugepages>."
601 msgstr ""
602
603 #. type: TP
604 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
605 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
606 #, no-wrap
607 msgid "B<MAP_LOCKED> (since Linux 2.5.37)"
608 msgstr ""
609
610 #. If set, the mapped pages will not be swapped out.
611 #. type: Plain text
612 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
613 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
614 msgid ""
615 "Mark the mapped region to be locked in the same way as B<mlock>(2). This "
616 "implementation will try to populate (prefault) the whole range but the "
617 "B<mmap>() call doesn't fail with B<ENOMEM> if this fails. Therefore major "
618 "faults might happen later on. So the semantic is not as strong as "
619 "B<mlock>(2). One should use B<mmap>() plus B<mlock>(2) when major faults "
620 "are not acceptable after the initialization of the mapping. The "
621 "B<MAP_LOCKED> flag is ignored in older kernels."
622 msgstr ""
623
624 #. type: TP
625 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
626 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
627 #, no-wrap
628 msgid "B<MAP_NONBLOCK> (since Linux 2.5.46)"
629 msgstr ""
630
631 #. commit 54cb8821de07f2ffcd28c380ce9b93d5784b40d7
632 #. type: Plain text
633 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
634 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
635 msgid ""
636 "This flag is meaningful only in conjunction with B<MAP_POPULATE>. Don't "
637 "perform read-ahead: create page tables entries only for pages that are "
638 "already present in RAM. Since Linux 2.6.23, this flag causes "
639 "B<MAP_POPULATE> to do nothing. One day, the combination of B<MAP_POPULATE> "
640 "and B<MAP_NONBLOCK> may be reimplemented."
641 msgstr ""
642
643 #. type: TP
644 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
645 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
646 #, no-wrap
647 msgid "B<MAP_NORESERVE>"
648 msgstr ""
649
650 #. type: Plain text
651 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
652 #: opensuse-tumbleweed
653 msgid ""
654 "Do not reserve swap space for this mapping. When swap space is reserved, "
655 "one has the guarantee that it is possible to modify the mapping. When swap "
656 "space is not reserved one might get B<SIGSEGV> upon a write if no physical "
657 "memory is available. See also the discussion of the file I</proc/sys/vm/"
658 "overcommit_memory> in B<proc_sys_vm>(5). Before Linux 2.6, this flag had "
659 "effect only for private writable mappings."
660 msgstr ""
661
662 #. type: TP
663 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
664 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
665 #, no-wrap
666 msgid "B<MAP_POPULATE> (since Linux 2.5.46)"
667 msgstr ""
668
669 #. type: Plain text
670 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
671 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
672 msgid ""
673 "Populate (prefault) page tables for a mapping. For a file mapping, this "
674 "causes read-ahead on the file. This will help to reduce blocking on page "
675 "faults later. The B<mmap>() call doesn't fail if the mapping cannot be "
676 "populated (for example, due to limitations on the number of mapped huge "
677 "pages when using B<MAP_HUGETLB>). Support for B<MAP_POPULATE> in "
678 "conjunction with private mappings was added in Linux 2.6.23."
679 msgstr ""
680
681 #. type: TP
682 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
683 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
684 #, no-wrap
685 msgid "B<MAP_STACK> (since Linux 2.6.27)"
686 msgstr ""
687
688 #. type: Plain text
689 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
690 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
691 msgid ""
692 "Allocate the mapping at an address suitable for a process or thread stack."
693 msgstr ""
694
695 #. See http://lwn.net/Articles/294642 "Tangled up in threads", 19 Aug 08
696 #. commit cd98a04a59e2f94fa64d5bf1e26498d27427d5e7
697 #. http://thread.gmane.org/gmane.linux.kernel/720412
698 #. "pthread_create() slow for many threads; also time to revisit 64b
699 #. context switch optimization?"
700 #. type: Plain text
701 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
702 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
703 msgid ""
704 "This flag is currently a no-op on Linux. However, by employing this flag, "
705 "applications can ensure that they transparently obtain support if the flag "
706 "is implemented in the future. Thus, it is used in the glibc threading "
707 "implementation to allow for the fact that some architectures may (later) "
708 "require special treatment for stack allocations. A further reason to employ "
709 "this flag is portability: B<MAP_STACK> exists (and has an effect) on some "
710 "other systems (e.g., some of the BSDs)."
711 msgstr ""
712
713 #. type: TP
714 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
715 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
716 #, no-wrap
717 msgid "B<MAP_SYNC> (since Linux 4.15)"
718 msgstr ""
719
720 #. type: Plain text
721 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
722 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
723 msgid ""
724 "This flag is available only with the B<MAP_SHARED_VALIDATE> mapping type; "
725 "mappings of type B<MAP_SHARED> will silently ignore this flag. This flag is "
726 "supported only for files supporting DAX (direct mapping of persistent "
727 "memory). For other files, creating a mapping with this flag results in an "
728 "B<EOPNOTSUPP> error."
729 msgstr ""
730
731 #. type: Plain text
732 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
733 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
734 msgid ""
735 "Shared file mappings with this flag provide the guarantee that while some "
736 "memory is mapped writable in the address space of the process, it will be "
737 "visible in the same file at the same offset even after the system crashes or "
738 "is rebooted. In conjunction with the use of appropriate CPU instructions, "
739 "this provides users of such mappings with a more efficient way of making "
740 "data modifications persistent."
741 msgstr ""
742
743 #. type: TP
744 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
745 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
746 #, no-wrap
747 msgid "B<MAP_UNINITIALIZED> (since Linux 2.6.33)"
748 msgstr ""
749
750 #. type: Plain text
751 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
752 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
753 msgid ""
754 "Don't clear anonymous pages. This flag is intended to improve performance "
755 "on embedded devices. This flag is honored only if the kernel was configured "
756 "with the B<CONFIG_MMAP_ALLOW_UNINITIALIZED> option. Because of the security "
757 "implications, that option is normally enabled only on embedded devices "
758 "(i.e., devices where one has complete control of the contents of user "
759 "memory)."
760 msgstr ""
761
762 #. FIXME . for later review when Issue 8 is one day released...
763 #. POSIX may add MAP_ANON in the future
764 #. http://austingroupbugs.net/tag_view_page.php?tag_id=8
765 #. http://austingroupbugs.net/view.php?id=850
766 #. type: Plain text
767 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
768 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
769 msgid ""
770 "Of the above flags, only B<MAP_FIXED> is specified in POSIX.1-2001 and "
771 "POSIX.1-2008. However, most systems also support B<MAP_ANONYMOUS> (or its "
772 "synonym B<MAP_ANON>)."
773 msgstr ""
774
775 #. type: SS
776 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
777 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
778 #, no-wrap
779 msgid "munmap()"
780 msgstr ""
781
782 #. type: Plain text
783 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
784 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
785 msgid ""
786 "The B<munmap>() system call deletes the mappings for the specified address "
787 "range, and causes further references to addresses within the range to "
788 "generate invalid memory references. The region is also automatically "
789 "unmapped when the process is terminated. On the other hand, closing the "
790 "file descriptor does not unmap the region."
791 msgstr ""
792
793 #. type: Plain text
794 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
795 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
796 msgid ""
797 "The address I<addr> must be a multiple of the page size (but I<length> need "
798 "not be). All pages containing a part of the indicated range are unmapped, "
799 "and subsequent references to these pages will generate B<SIGSEGV>. It is "
800 "not an error if the indicated range does not contain any mapped pages."
801 msgstr ""
802
803 #. type: SH
804 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
805 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
806 #, no-wrap
807 msgid "RETURN VALUE"
808 msgstr ""
809
810 #. type: Plain text
811 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
812 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
813 msgid ""
814 "On success, B<mmap>() returns a pointer to the mapped area. On error, the "
815 "value B<MAP_FAILED> (that is, I<(void\\ *)\\ -1>) is returned, and I<errno> "
816 "is set to indicate the error."
817 msgstr ""
818
819 #. type: Plain text
820 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
821 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
822 msgid ""
823 "On success, B<munmap>() returns 0. On failure, it returns -1, and I<errno> "
824 "is set to indicate the error (probably to B<EINVAL>)."
825 msgstr ""
826
827 #. type: SH
828 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
829 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
830 #, no-wrap
831 msgid "ERRORS"
832 msgstr ""
833
834 #. type: TP
835 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
836 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
837 #, no-wrap
838 msgid "B<EACCES>"
839 msgstr ""
840
841 #. type: Plain text
842 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
843 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
844 msgid ""
845 "A file descriptor refers to a non-regular file. Or a file mapping was "
846 "requested, but I<fd> is not open for reading. Or B<MAP_SHARED> was "
847 "requested and B<PROT_WRITE> is set, but I<fd> is not open in read/write "
848 "(B<O_RDWR>) mode. Or B<PROT_WRITE> is set, but the file is append-only."
849 msgstr ""
850
851 #. type: TP
852 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
853 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
854 #, no-wrap
855 msgid "B<EAGAIN>"
856 msgstr ""
857
858 #. type: Plain text
859 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
860 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
861 msgid ""
862 "The file has been locked, or too much memory has been locked (see "
863 "B<setrlimit>(2))."
864 msgstr ""
865
866 #. type: TP
867 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
868 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
869 #, no-wrap
870 msgid "B<EBADF>"
871 msgstr ""
872
873 #. type: Plain text
874 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
875 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
876 msgid ""
877 "I<fd> is not a valid file descriptor (and B<MAP_ANONYMOUS> was not set)."
878 msgstr ""
879
880 #. type: TP
881 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
882 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
883 #, no-wrap
884 msgid "B<EEXIST>"
885 msgstr ""
886
887 #. type: Plain text
888 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
889 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
890 msgid ""
891 "B<MAP_FIXED_NOREPLACE> was specified in I<flags>, and the range covered by "
892 "I<addr> and I<length> clashes with an existing mapping."
893 msgstr ""
894
895 #. type: TP
896 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
897 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
898 #, no-wrap
899 msgid "B<EINVAL>"
900 msgstr ""
901
902 #. type: Plain text
903 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
904 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
905 msgid ""
906 "We don't like I<addr>, I<length>, or I<offset> (e.g., they are too large, or "
907 "not aligned on a page boundary)."
908 msgstr ""
909
910 #. type: Plain text
911 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
912 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
913 msgid "(since Linux 2.6.12) I<length> was 0."
914 msgstr ""
915
916 #. type: Plain text
917 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
918 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
919 msgid ""
920 "I<flags> contained none of B<MAP_PRIVATE>, B<MAP_SHARED>, or "
921 "B<MAP_SHARED_VALIDATE>."
922 msgstr ""
923
924 #. type: TP
925 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
926 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
927 #, no-wrap
928 msgid "B<ENFILE>"
929 msgstr ""
930
931 #. This is for shared anonymous segments
932 #. [2.6.7] shmem_zero_setup()-->shmem_file_setup()-->get_empty_filp()
933 #. .TP
934 #. .B ENOEXEC
935 #. A file could not be mapped for reading.
936 #. type: Plain text
937 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
938 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
939 msgid ""
940 "The system-wide limit on the total number of open files has been reached."
941 msgstr ""
942
943 #. type: TP
944 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
945 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
946 #, no-wrap
947 msgid "B<ENODEV>"
948 msgstr ""
949
950 #. type: Plain text
951 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
952 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
953 msgid ""
954 "The underlying filesystem of the specified file does not support memory "
955 "mapping."
956 msgstr ""
957
958 #. type: TP
959 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
960 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
961 #, no-wrap
962 msgid "B<ENOMEM>"
963 msgstr ""
964
965 #. type: Plain text
966 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
967 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
968 msgid "No memory is available."
969 msgstr ""
970
971 #. type: Plain text
972 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
973 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
974 msgid ""
975 "The process's maximum number of mappings would have been exceeded. This "
976 "error can also occur for B<munmap>(), when unmapping a region in the middle "
977 "of an existing mapping, since this results in two smaller mappings on either "
978 "side of the region being unmapped."
979 msgstr ""
980
981 #. type: Plain text
982 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
983 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
984 msgid ""
985 "(since Linux 4.7) The process's B<RLIMIT_DATA> limit, described in "
986 "B<getrlimit>(2), would have been exceeded."
987 msgstr ""
988
989 #. type: Plain text
990 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
991 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
992 msgid ""
993 "We don't like I<addr>, because it exceeds the virtual address space of the "
994 "CPU."
995 msgstr ""
996
997 #. type: TP
998 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
999 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1000 #, no-wrap
1001 msgid "B<EOVERFLOW>"
1002 msgstr ""
1003
1004 #. type: Plain text
1005 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1006 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1007 msgid ""
1008 "On 32-bit architecture together with the large file extension (i.e., using "
1009 "64-bit I<off_t>): the number of pages used for I<length> plus number of "
1010 "pages used for I<offset> would overflow I<unsigned long> (32 bits)."
1011 msgstr ""
1012
1013 #. type: TP
1014 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1015 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1016 #, no-wrap
1017 msgid "B<EPERM>"
1018 msgstr ""
1019
1020 #. (Since Linux 2.4.25 / Linux 2.6.0.)
1021 #. type: Plain text
1022 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1023 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1024 msgid ""
1025 "The I<prot> argument asks for B<PROT_EXEC> but the mapped area belongs to a "
1026 "file on a filesystem that was mounted no-exec."
1027 msgstr ""
1028
1029 #. type: Plain text
1030 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1031 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1032 msgid "The operation was prevented by a file seal; see B<fcntl>(2)."
1033 msgstr ""
1034
1035 #. type: Plain text
1036 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1037 #: opensuse-tumbleweed
1038 msgid ""
1039 "The B<MAP_HUGETLB> flag was specified, but the caller was not privileged "
1040 "(did not have the B<CAP_IPC_LOCK> capability) and is not a member of the "
1041 "I<hugetlb_shm_group> group; see the description of I</proc/sys/vm/"
1042 "hugetlb_shm_group> in B<proc_sys_vm>(5)."
1043 msgstr ""
1044
1045 #. type: TP
1046 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1047 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1048 #, no-wrap
1049 msgid "B<ETXTBSY>"
1050 msgstr ""
1051
1052 #. type: Plain text
1053 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1054 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1055 msgid ""
1056 "B<MAP_DENYWRITE> was set but the object specified by I<fd> is open for "
1057 "writing."
1058 msgstr ""
1059
1060 #. type: Plain text
1061 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1062 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1063 msgid "Use of a mapped region can result in these signals:"
1064 msgstr ""
1065
1066 #. type: TP
1067 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1068 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1069 #, no-wrap
1070 msgid "B<SIGSEGV>"
1071 msgstr ""
1072
1073 #. type: Plain text
1074 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1075 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1076 msgid "Attempted write into a region mapped as read-only."
1077 msgstr ""
1078
1079 #. type: TP
1080 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1081 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1082 #, no-wrap
1083 msgid "B<SIGBUS>"
1084 msgstr ""
1085
1086 #. type: Plain text
1087 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1088 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1089 msgid ""
1090 "Attempted access to a page of the buffer that lies beyond the end of the "
1091 "mapped file. For an explanation of the treatment of the bytes in the page "
1092 "that corresponds to the end of a mapped file that is not a multiple of the "
1093 "page size, see NOTES."
1094 msgstr ""
1095
1096 #. type: SH
1097 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1098 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1099 #, no-wrap
1100 msgid "ATTRIBUTES"
1101 msgstr ""
1102
1103 #. type: Plain text
1104 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1105 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1106 msgid ""
1107 "For an explanation of the terms used in this section, see B<attributes>(7)."
1108 msgstr ""
1109
1110 #. type: tbl table
1111 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1112 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1113 #, no-wrap
1114 msgid "Interface"
1115 msgstr ""
1116
1117 #. type: tbl table
1118 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1119 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1120 #, no-wrap
1121 msgid "Attribute"
1122 msgstr ""
1123
1124 #. type: tbl table
1125 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1126 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1127 #, no-wrap
1128 msgid "Value"
1129 msgstr ""
1130
1131 #. type: tbl table
1132 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1133 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1134 #, no-wrap
1135 msgid ".na\n"
1136 msgstr ""
1137
1138 #. type: tbl table
1139 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1140 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1141 #, no-wrap
1142 msgid ".nh\n"
1143 msgstr ""
1144
1145 #. type: tbl table
1146 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1147 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1148 #, no-wrap
1149 msgid ""
1150 "B<mmap>(),\n"
1151 "B<munmap>()"
1152 msgstr ""
1153
1154 #. type: tbl table
1155 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1156 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1157 #, no-wrap
1158 msgid "Thread safety"
1159 msgstr ""
1160
1161 #. type: tbl table
1162 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1163 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1164 #, no-wrap
1165 msgid "MT-Safe"
1166 msgstr ""
1167
1168 #. type: SH
1169 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1170 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1171 #, no-wrap
1172 msgid "VERSIONS"
1173 msgstr ""
1174
1175 #. type: Plain text
1176 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1177 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1178 msgid ""
1179 "On some hardware architectures (e.g., i386), B<PROT_WRITE> implies "
1180 "B<PROT_READ>. It is architecture dependent whether B<PROT_READ> implies "
1181 "B<PROT_EXEC> or not. Portable programs should always set B<PROT_EXEC> if "
1182 "they intend to execute code in the new mapping."
1183 msgstr ""
1184
1185 #. type: Plain text
1186 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1187 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1188 msgid ""
1189 "The portable way to create a mapping is to specify I<addr> as 0 (NULL), and "
1190 "omit B<MAP_FIXED> from I<flags>. In this case, the system chooses the "
1191 "address for the mapping; the address is chosen so as not to conflict with "
1192 "any existing mapping, and will not be 0. If the B<MAP_FIXED> flag is "
1193 "specified, and I<addr> is 0 (NULL), then the mapped address will be 0 (NULL)."
1194 msgstr ""
1195
1196 #. type: Plain text
1197 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1198 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1199 msgid ""
1200 "Certain I<flags> constants are defined only if suitable feature test macros "
1201 "are defined (possibly by default): B<_DEFAULT_SOURCE> with glibc 2.19 or "
1202 "later; or B<_BSD_SOURCE> or B<_SVID_SOURCE> in glibc 2.19 and earlier. "
1203 "(Employing B<_GNU_SOURCE> also suffices, and requiring that macro "
1204 "specifically would have been more logical, since these flags are all Linux-"
1205 "specific.) The relevant flags are: B<MAP_32BIT>, B<MAP_ANONYMOUS> (and the "
1206 "synonym B<MAP_ANON>), B<MAP_DENYWRITE>, B<MAP_EXECUTABLE>, B<MAP_FILE>, "
1207 "B<MAP_GROWSDOWN>, B<MAP_HUGETLB>, B<MAP_LOCKED>, B<MAP_NONBLOCK>, "
1208 "B<MAP_NORESERVE>, B<MAP_POPULATE>, and B<MAP_STACK>."
1209 msgstr ""
1210
1211 #. type: SS
1212 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1213 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1214 #, no-wrap
1215 msgid "C library/kernel differences"
1216 msgstr ""
1217
1218 #. Since around glibc 2.1/2.2, depending on the platform.
1219 #. type: Plain text
1220 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1221 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1222 msgid ""
1223 "This page describes the interface provided by the glibc B<mmap>() wrapper "
1224 "function. Originally, this function invoked a system call of the same "
1225 "name. Since Linux 2.4, that system call has been superseded by B<mmap2>(2), "
1226 "and nowadays the glibc B<mmap>() wrapper function invokes B<mmap2>(2) with "
1227 "a suitably adjusted value for I<offset>."
1228 msgstr ""
1229
1230 #. type: SH
1231 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1232 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1233 #, no-wrap
1234 msgid "STANDARDS"
1235 msgstr ""
1236
1237 #. type: Plain text
1238 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1239 #: opensuse-tumbleweed
1240 msgid "POSIX.1-2024."
1241 msgstr ""
1242
1243 #. type: SH
1244 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1245 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1246 #, no-wrap
1247 msgid "HISTORY"
1248 msgstr ""
1249
1250 #. SVr4 documents additional error codes ENXIO and ENODEV.
1251 #. SUSv2 documents additional error codes EMFILE and EOVERFLOW.
1252 #. type: Plain text
1253 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1254 #: opensuse-tumbleweed
1255 msgid "SVr4, 4.4BSD, SUSv1, POSIX.1-1996."
1256 msgstr ""
1257
1258 #. POSIX.1-2001: It shall be defined to -1 or 0 or 200112L.
1259 #. -1: unavailable, 0: ask using sysconf().
1260 #. glibc defines it to 1.
1261 #. type: Plain text
1262 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1263 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1264 msgid ""
1265 "On POSIX systems on which B<mmap>(), B<msync>(2), and B<munmap>() are "
1266 "available, B<_POSIX_MAPPED_FILES> is defined in I<E<lt>unistd.hE<gt>> to a "
1267 "value greater than 0. (See also B<sysconf>(3).)"
1268 msgstr ""
1269
1270 #. type: SH
1271 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1272 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1273 #, no-wrap
1274 msgid "NOTES"
1275 msgstr ""
1276
1277 #. type: Plain text
1278 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1279 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1280 msgid ""
1281 "Memory mapped by B<mmap>() is preserved across B<fork>(2), with the same "
1282 "attributes."
1283 msgstr ""
1284
1285 #. type: Plain text
1286 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1287 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1288 msgid ""
1289 "A file is mapped in multiples of the page size. For a file that is not a "
1290 "multiple of the page size, the remaining bytes in the partial page at the "
1291 "end of the mapping are zeroed when mapped, and modifications to that region "
1292 "are not written out to the file. The effect of changing the size of the "
1293 "underlying file of a mapping on the pages that correspond to added or "
1294 "removed regions of the file is unspecified."
1295 msgstr ""
1296
1297 #. type: Plain text
1298 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1299 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1300 msgid ""
1301 "An application can determine which pages of a mapping are currently resident "
1302 "in the buffer/page cache using B<mincore>(2)."
1303 msgstr ""
1304
1305 #. type: SS
1306 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1307 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1308 #, no-wrap
1309 msgid "Using MAP_FIXED safely"
1310 msgstr ""
1311
1312 #. type: Plain text
1313 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1314 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1315 msgid ""
1316 "The only safe use for B<MAP_FIXED> is where the address range specified by "
1317 "I<addr> and I<length> was previously reserved using another mapping; "
1318 "otherwise, the use of B<MAP_FIXED> is hazardous because it forcibly removes "
1319 "preexisting mappings, making it easy for a multithreaded process to corrupt "
1320 "its own address space."
1321 msgstr ""
1322
1323 #. type: Plain text
1324 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1325 #: opensuse-tumbleweed
1326 msgid ""
1327 "For example, suppose that thread A looks through I</proc/>pidI</maps> in "
1328 "order to locate an unused address range that it can map using B<MAP_FIXED>, "
1329 "while thread B simultaneously acquires part or all of that same address "
1330 "range. When thread A subsequently employs B<mmap(MAP_FIXED)>, it will "
1331 "effectively clobber the mapping that thread B created. In this scenario, "
1332 "thread B need not create a mapping directly; simply making a library call "
1333 "that, internally, uses B<dlopen>(3) to load some other shared library, will "
1334 "suffice. The B<dlopen>(3) call will map the library into the process's "
1335 "address space. Furthermore, almost any library call may be implemented in a "
1336 "way that adds memory mappings to the address space, either with this "
1337 "technique, or by simply allocating memory. Examples include B<brk>(2), "
1338 "B<malloc>(3), B<pthread_create>(3), and the PAM libraries E<.UR http:\\://"
1339 "www.linux-pam.org> E<.UE .>"
1340 msgstr ""
1341
1342 #. type: Plain text
1343 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1344 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1345 msgid ""
1346 "Since Linux 4.17, a multithreaded program can use the B<MAP_FIXED_NOREPLACE> "
1347 "flag to avoid the hazard described above when attempting to create a mapping "
1348 "at a fixed address that has not been reserved by a preexisting mapping."
1349 msgstr ""
1350
1351 #. type: SS
1352 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1353 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1354 #, no-wrap
1355 msgid "Timestamps changes for file-backed mappings"
1356 msgstr ""
1357
1358 #. type: Plain text
1359 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1360 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1361 msgid ""
1362 "For file-backed mappings, the I<st_atime> field for the mapped file may be "
1363 "updated at any time between the B<mmap>() and the corresponding unmapping; "
1364 "the first reference to a mapped page will update the field if it has not "
1365 "been already."
1366 msgstr ""
1367
1368 #. type: Plain text
1369 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1370 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1371 msgid ""
1372 "The I<st_ctime> and I<st_mtime> field for a file mapped with B<PROT_WRITE> "
1373 "and B<MAP_SHARED> will be updated after a write to the mapped region, and "
1374 "before a subsequent B<msync>(2) with the B<MS_SYNC> or B<MS_ASYNC> flag, if "
1375 "one occurs."
1376 msgstr ""
1377
1378 #. type: SS
1379 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1380 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1381 #, no-wrap
1382 msgid "Huge page (Huge TLB) mappings"
1383 msgstr ""
1384
1385 #. type: Plain text
1386 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1387 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1388 msgid ""
1389 "For mappings that employ huge pages, the requirements for the arguments of "
1390 "B<mmap>() and B<munmap>() differ somewhat from the requirements for "
1391 "mappings that use the native system page size."
1392 msgstr ""
1393
1394 #. type: Plain text
1395 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1396 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1397 msgid ""
1398 "For B<mmap>(), I<offset> must be a multiple of the underlying huge page "
1399 "size. The system automatically aligns I<length> to be a multiple of the "
1400 "underlying huge page size."
1401 msgstr ""
1402
1403 #. type: Plain text
1404 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1405 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1406 msgid ""
1407 "For B<munmap>(), I<addr>, and I<length> must both be a multiple of the "
1408 "underlying huge page size."
1409 msgstr ""
1410
1411 #. type: SH
1412 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1413 #: opensuse-tumbleweed
1414 #, no-wrap
1415 msgid "CAVEATS"
1416 msgstr ""
1417
1418 #. type: Plain text
1419 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1420 #: opensuse-tumbleweed
1421 msgid ""
1422 "Unlike typical B<malloc>(3) implementations, B<mmap>() does not prevent "
1423 "creating objects larger than B<PTRDIFF_MAX>. Objects that are larger than "
1424 "B<PTRDIFF_MAX> only work in limited ways in C (in particular, pointer "
1425 "subtraction results in undefined behavior if the result would be bigger than "
1426 "B<PTRDIFF_MAX>). On top of that, GCC also assumes that no object is bigger "
1427 "than B<PTRDIFF_MAX>. B<PTRDIFF_MAX> is usually half of the address space "
1428 "size; so for 32-bit processes, it is usually B<0x7fffffff> (almost 2 GiB)."
1429 msgstr ""
1430
1431 #. type: SH
1432 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1433 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1434 #, no-wrap
1435 msgid "BUGS"
1436 msgstr ""
1437
1438 #. type: Plain text
1439 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1440 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1441 msgid ""
1442 "On Linux, there are no guarantees like those suggested above under "
1443 "B<MAP_NORESERVE>. By default, any process can be killed at any moment when "
1444 "the system runs out of memory."
1445 msgstr ""
1446
1447 #. type: Plain text
1448 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1449 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1450 msgid ""
1451 "Before Linux 2.6.7, the B<MAP_POPULATE> flag has effect only if I<prot> is "
1452 "specified as B<PROT_NONE>."
1453 msgstr ""
1454
1455 #. type: Plain text
1456 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1457 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1458 msgid ""
1459 "SUSv3 specifies that B<mmap>() should fail if I<length> is 0. However, "
1460 "before Linux 2.6.12, B<mmap>() succeeded in this case: no mapping was "
1461 "created and the call returned I<addr>. Since Linux 2.6.12, B<mmap>() fails "
1462 "with the error B<EINVAL> for this case."
1463 msgstr ""
1464
1465 #. type: Plain text
1466 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1467 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1468 msgid ""
1469 "POSIX specifies that the system shall always zero fill any partial page at "
1470 "the end of the object and that system will never write any modification of "
1471 "the object beyond its end. On Linux, when you write data to such partial "
1472 "page after the end of the object, the data stays in the page cache even "
1473 "after the file is closed and unmapped and even though the data is never "
1474 "written to the file itself, subsequent mappings may see the modified "
1475 "content. In some cases, this could be fixed by calling B<msync>(2) before "
1476 "the unmap takes place; however, this doesn't work on B<tmpfs>(5) (for "
1477 "example, when using the POSIX shared memory interface documented in "
1478 "B<shm_overview>(7))."
1479 msgstr ""
1480
1481 #. type: SH
1482 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1483 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1484 #, no-wrap
1485 msgid "EXAMPLES"
1486 msgstr ""
1487
1488 #. FIXME . Add an example here that uses an anonymous shared region for
1489 #. IPC between parent and child.
1490 #. type: Plain text
1491 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1492 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1493 msgid ""
1494 "The following program prints part of the file specified in its first command-"
1495 "line argument to standard output. The range of bytes to be printed is "
1496 "specified via offset and length values in the second and third command-line "
1497 "arguments. The program creates a memory mapping of the required pages of "
1498 "the file and then uses B<write>(2) to output the desired bytes."
1499 msgstr ""
1500
1501 #. type: SS
1502 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1503 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1504 #, no-wrap
1505 msgid "Program source"
1506 msgstr ""
1507
1508 #. type: Plain text
1509 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1510 #: opensuse-tumbleweed
1511 #, no-wrap
1512 msgid ""
1513 "#include E<lt>err.hE<gt>\n"
1514 "#include E<lt>fcntl.hE<gt>\n"
1515 "#include E<lt>stdio.hE<gt>\n"
1516 "#include E<lt>stdlib.hE<gt>\n"
1517 "#include E<lt>sys/mman.hE<gt>\n"
1518 "#include E<lt>sys/stat.hE<gt>\n"
1519 "#include E<lt>sys/types.hE<gt>\n"
1520 "#include E<lt>unistd.hE<gt>\n"
1521 "\\&\n"
1522 "int\n"
1523 "main(int argc, char *argv[])\n"
1524 "{\n"
1525 " int fd;\n"
1526 " char *addr;\n"
1527 " off_t offset, pa_offset;\n"
1528 " size_t length;\n"
1529 " ssize_t s;\n"
1530 " struct stat sb;\n"
1531 "\\&\n"
1532 " if (argc E<lt> 3 || argc E<gt> 4) {\n"
1533 " fprintf(stderr, \"%s file offset [length]\\[rs]n\", argv[0]);\n"
1534 " exit(EXIT_FAILURE);\n"
1535 " }\n"
1536 "\\&\n"
1537 " fd = open(argv[1], O_RDONLY);\n"
1538 " if (fd == -1)\n"
1539 " err(EXIT_FAILURE, \"open\");\n"
1540 "\\&\n"
1541 " if (fstat(fd, &sb) == -1) /* To obtain file size */\n"
1542 " err(EXIT_FAILURE, \"fstat\");\n"
1543 "\\&\n"
1544 " offset = atoi(argv[2]);\n"
1545 " pa_offset = offset & \\[ti](sysconf(_SC_PAGE_SIZE) - 1);\n"
1546 " /* offset for mmap() must be page aligned */\n"
1547 "\\&\n"
1548 " if (offset E<gt>= sb.st_size) {\n"
1549 " fprintf(stderr, \"offset is past end of file\\[rs]n\");\n"
1550 " exit(EXIT_FAILURE);\n"
1551 " }\n"
1552 "\\&\n"
1553 " if (argc == 4) {\n"
1554 " length = atoi(argv[3]);\n"
1555 " if (offset + length E<gt> sb.st_size)\n"
1556 " length = sb.st_size - offset;\n"
1557 " /* Can\\[aq]t display bytes past end of file */\n"
1558 "\\&\n"
1559 " } else { /* No length arg ==E<gt> display to end of file */\n"
1560 " length = sb.st_size - offset;\n"
1561 " }\n"
1562 "\\&\n"
1563 " addr = mmap(NULL, length + offset - pa_offset, PROT_READ,\n"
1564 " MAP_PRIVATE, fd, pa_offset);\n"
1565 " if (addr == MAP_FAILED)\n"
1566 " err(EXIT_FAILURE, \"mmap\");\n"
1567 "\\&\n"
1568 " s = write(STDOUT_FILENO, addr + offset - pa_offset, length);\n"
1569 " if (s != length) {\n"
1570 " if (s == -1)\n"
1571 " err(EXIT_FAILURE, \"write\");\n"
1572 "\\&\n"
1573 " fprintf(stderr, \"partial write\");\n"
1574 " exit(EXIT_FAILURE);\n"
1575 " }\n"
1576 "\\&\n"
1577 " munmap(addr, length + offset - pa_offset);\n"
1578 " close(fd);\n"
1579 "\\&\n"
1580 " exit(EXIT_SUCCESS);\n"
1581 "}\n"
1582 msgstr ""
1583
1584 #. SRC END
1585 #. type: SH
1586 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1587 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1588 #, no-wrap
1589 msgid "SEE ALSO"
1590 msgstr ""
1591
1592 #. type: Plain text
1593 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1594 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1595 msgid ""
1596 "B<ftruncate>(2), B<getpagesize>(2), B<memfd_create>(2), B<mincore>(2), "
1597 "B<mlock>(2), B<mmap2>(2), B<mprotect>(2), B<mremap>(2), B<msync>(2), "
1598 "B<remap_file_pages>(2), B<setrlimit>(2), B<shmat>(2), B<userfaultfd>(2), "
1599 "B<shm_open>(3), B<shm_overview>(7)"
1600 msgstr ""
1601
1602 #. type: Plain text
1603 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1604 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1605 msgid ""
1606 "The descriptions of the following files in B<proc>(5): I</proc/>pidI</maps>, "
1607 "I</proc/>pidI</map_files>, and I</proc/>pidI</smaps>."
1608 msgstr ""
1609
1610 #. type: Plain text
1611 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1612 #: opensuse-tumbleweed
1613 msgid ""
1614 "B.O.\\& Gallmeister, POSIX.4, O'Reilly, pp.\\& 128\\[en]129 and 389\\[en]391."
1615 msgstr ""
1616
1617 #. type: TH
1618 #: debian-trixie
1619 #, no-wrap
1620 msgid "2024-06-15"
1621 msgstr ""
1622
1623 #. type: TH
1624 #: debian-trixie
1625 #, no-wrap
1626 msgid "Linux man-pages 6.9.1"
1627 msgstr ""
1628
1629 #. type: Plain text
1630 #: debian-trixie
1631 msgid "Standard C library (I<libc>, I<-lc>)"
1632 msgstr ""
1633
1634 #. type: Plain text
1635 #: debian-trixie fedora-44 fedora-rawhide
1636 #, no-wrap
1637 msgid ""
1638 "B<void *mmap(void >I<addr>B<[.>I<length>B<], size_t >I<length>B<, int >I<prot>B<, int >I<flags>B<,>\n"
1639 "B< int >I<fd>B<, off_t >I<offset>B<);>\n"
1640 "B<int munmap(void >I<addr>B<[.>I<length>B<], size_t >I<length>B<);>\n"
1641 msgstr ""
1642
1643 #. type: Plain text
1644 #: debian-trixie
1645 msgid "See NOTES for information on feature test macro requirements."
1646 msgstr ""
1647
1648 #. commit a4ff8e8620d3f4f50ac4b41e8067b7d395056843
1649 #. type: Plain text
1650 #: debian-trixie fedora-44 fedora-rawhide
1651 msgid ""
1652 "This flag provides behavior that is similar to B<MAP_FIXED> with respect to "
1653 "the I<addr> enforcement, but differs in that B<MAP_FIXED_NOREPLACE> never "
1654 "clobbers a preexisting mapped range. If the requested range would collide "
1655 "with an existing mapping, then this call fails with the error B<EEXIST.> "
1656 "This flag can therefore be used as a way to atomically (with respect to "
1657 "other threads) attempt to map an address range: one thread will succeed; all "
1658 "others will report failure."
1659 msgstr ""
1660
1661 #. type: Plain text
1662 #: debian-trixie fedora-44 fedora-rawhide mageia-cauldron
1663 msgid ""
1664 "This flag is used for stacks. It indicates to the kernel virtual memory "
1665 "system that the mapping should extend downward in memory. The return "
1666 "address is one page lower than the memory area that is actually created in "
1667 "the process's virtual address space. Touching an address in the \"guard\" "
1668 "page below the mapping will cause the mapping to grow by a page. This "
1669 "growth can be repeated until the mapping grows to within a page of the high "
1670 "end of the next lower mapping, at which point touching the \"guard\" page "
1671 "will result in a B<SIGSEGV> signal."
1672 msgstr ""
1673
1674 #. type: Plain text
1675 #: debian-trixie fedora-44 fedora-rawhide
1676 msgid ""
1677 "Do not reserve swap space for this mapping. When swap space is reserved, "
1678 "one has the guarantee that it is possible to modify the mapping. When swap "
1679 "space is not reserved one might get B<SIGSEGV> upon a write if no physical "
1680 "memory is available. See also the discussion of the file I</proc/sys/vm/"
1681 "overcommit_memory> in B<proc>(5). Before Linux 2.6, this flag had effect "
1682 "only for private writable mappings."
1683 msgstr ""
1684
1685 #. type: Plain text
1686 #: debian-trixie fedora-44 fedora-rawhide
1687 msgid ""
1688 "The B<MAP_HUGETLB> flag was specified, but the caller was not privileged "
1689 "(did not have the B<CAP_IPC_LOCK> capability) and is not a member of the "
1690 "I<sysctl_hugetlb_shm_group> group; see the description of I</proc/sys/vm/"
1691 "sysctl_hugetlb_shm_group> in B<proc_sys>(5)."
1692 msgstr ""
1693
1694 #. type: Plain text
1695 #: debian-trixie fedora-44 fedora-rawhide
1696 msgid "POSIX.1-2008."
1697 msgstr ""
1698
1699 #. SVr4 documents additional error codes ENXIO and ENODEV.
1700 #. SUSv2 documents additional error codes EMFILE and EOVERFLOW.
1701 #. type: Plain text
1702 #: debian-trixie fedora-44 fedora-rawhide
1703 msgid "POSIX.1-2001, SVr4, 4.4BSD."
1704 msgstr ""
1705
1706 #. type: Plain text
1707 #: debian-trixie fedora-44 fedora-rawhide
1708 msgid ""
1709 "For example, suppose that thread A looks through I</proc/>pidI</maps> in "
1710 "order to locate an unused address range that it can map using B<MAP_FIXED>, "
1711 "while thread B simultaneously acquires part or all of that same address "
1712 "range. When thread A subsequently employs B<mmap(MAP_FIXED)>, it will "
1713 "effectively clobber the mapping that thread B created. In this scenario, "
1714 "thread B need not create a mapping directly; simply making a library call "
1715 "that, internally, uses B<dlopen>(3) to load some other shared library, will "
1716 "suffice. The B<dlopen>(3) call will map the library into the process's "
1717 "address space. Furthermore, almost any library call may be implemented in a "
1718 "way that adds memory mappings to the address space, either with this "
1719 "technique, or by simply allocating memory. Examples include B<brk>(2), "
1720 "B<malloc>(3), B<pthread_create>(3), and the PAM libraries E<.UR http://"
1721 "www.linux-pam.org> E<.UE .>"
1722 msgstr ""
1723
1724 #. type: Plain text
1725 #: debian-trixie fedora-44 fedora-rawhide
1726 #, no-wrap
1727 msgid ""
1728 "#include E<lt>fcntl.hE<gt>\n"
1729 "#include E<lt>stdio.hE<gt>\n"
1730 "#include E<lt>stdlib.hE<gt>\n"
1731 "#include E<lt>sys/mman.hE<gt>\n"
1732 "#include E<lt>sys/stat.hE<gt>\n"
1733 "#include E<lt>sys/types.hE<gt>\n"
1734 "#include E<lt>unistd.hE<gt>\n"
1735 "\\&\n"
1736 "#define handle_error(msg) \\[rs]\n"
1737 " do { perror(msg); exit(EXIT_FAILURE); } while (0)\n"
1738 "\\&\n"
1739 "int\n"
1740 "main(int argc, char *argv[])\n"
1741 "{\n"
1742 " int fd;\n"
1743 " char *addr;\n"
1744 " off_t offset, pa_offset;\n"
1745 " size_t length;\n"
1746 " ssize_t s;\n"
1747 " struct stat sb;\n"
1748 "\\&\n"
1749 " if (argc E<lt> 3 || argc E<gt> 4) {\n"
1750 " fprintf(stderr, \"%s file offset [length]\\[rs]n\", argv[0]);\n"
1751 " exit(EXIT_FAILURE);\n"
1752 " }\n"
1753 "\\&\n"
1754 " fd = open(argv[1], O_RDONLY);\n"
1755 " if (fd == -1)\n"
1756 " handle_error(\"open\");\n"
1757 "\\&\n"
1758 " if (fstat(fd, &sb) == -1) /* To obtain file size */\n"
1759 " handle_error(\"fstat\");\n"
1760 "\\&\n"
1761 " offset = atoi(argv[2]);\n"
1762 " pa_offset = offset & \\[ti](sysconf(_SC_PAGE_SIZE) - 1);\n"
1763 " /* offset for mmap() must be page aligned */\n"
1764 "\\&\n"
1765 " if (offset E<gt>= sb.st_size) {\n"
1766 " fprintf(stderr, \"offset is past end of file\\[rs]n\");\n"
1767 " exit(EXIT_FAILURE);\n"
1768 " }\n"
1769 "\\&\n"
1770 " if (argc == 4) {\n"
1771 " length = atoi(argv[3]);\n"
1772 " if (offset + length E<gt> sb.st_size)\n"
1773 " length = sb.st_size - offset;\n"
1774 " /* Can\\[aq]t display bytes past end of file */\n"
1775 "\\&\n"
1776 " } else { /* No length arg ==E<gt> display to end of file */\n"
1777 " length = sb.st_size - offset;\n"
1778 " }\n"
1779 "\\&\n"
1780 " addr = mmap(NULL, length + offset - pa_offset, PROT_READ,\n"
1781 " MAP_PRIVATE, fd, pa_offset);\n"
1782 " if (addr == MAP_FAILED)\n"
1783 " handle_error(\"mmap\");\n"
1784 "\\&\n"
1785 " s = write(STDOUT_FILENO, addr + offset - pa_offset, length);\n"
1786 " if (s != length) {\n"
1787 " if (s == -1)\n"
1788 " handle_error(\"write\");\n"
1789 "\\&\n"
1790 " fprintf(stderr, \"partial write\");\n"
1791 " exit(EXIT_FAILURE);\n"
1792 " }\n"
1793 "\\&\n"
1794 " munmap(addr, length + offset - pa_offset);\n"
1795 " close(fd);\n"
1796 "\\&\n"
1797 " exit(EXIT_SUCCESS);\n"
1798 "}\n"
1799 msgstr ""
1800
1801 #. type: Plain text
1802 #: debian-trixie fedora-44 fedora-rawhide
1803 msgid "B.O. Gallmeister, POSIX.4, O'Reilly, pp. 128\\[en]129 and 389\\[en]391."
1804 msgstr ""
1805
1806 #. type: TH
1807 #: fedora-44 fedora-rawhide
1808 #, no-wrap
1809 msgid "2024-07-23"
1810 msgstr ""
1811
1812 #. type: TH
1813 #: fedora-44 fedora-rawhide
1814 #, no-wrap
1815 msgid "Linux man-pages 6.13"
1816 msgstr ""
1817
1818 #. type: TH
1819 #: mageia-cauldron
1820 #, no-wrap
1821 msgid "2026-02-11"
1822 msgstr ""
1823
1824 #. type: TH
1825 #: mageia-cauldron
1826 #, no-wrap
1827 msgid "Linux man-pages 6.17"
1828 msgstr ""
1829
1830 #. type: TH
1831 #: opensuse-leap-16-1 opensuse-tumbleweed
1832 #, no-wrap
1833 msgid "Linux man-pages (unreleased)"
1834 msgstr ""