]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man2/mmap.2
ftw.3, resolver.3, issue.5, proc.5, pty.7, suffixes.7: Global fix: s/pre-/pre/
[thirdparty/man-pages.git] / man2 / mmap.2
CommitLineData
fea681da
MK
1.\" Hey Emacs! This file is -*- nroff -*- source.
2.\"
a62f5121 3.\" Copyright (C) 1996 Andries Brouwer <aeb@cwi.nl>
c11b1abf 4.\" and Copyright (C) 2006, 2007 Michael Kerrisk <mtk.manpages@gmail.com>
fea681da
MK
5.\"
6.\" Permission is granted to make and distribute verbatim copies of this
7.\" manual provided the copyright notice and this permission notice are
8.\" preserved on all copies.
9.\"
10.\" Permission is granted to copy and distribute modified versions of this
11.\" manual under the conditions for verbatim copying, provided that the
12.\" entire resulting derived work is distributed under the terms of a
13.\" permission notice identical to this one.
c13182ef 14.\"
fea681da
MK
15.\" Since the Linux kernel and libraries are constantly changing, this
16.\" manual page may be incorrect or out-of-date. The author(s) assume no
17.\" responsibility for errors or omissions, or for damages resulting from
18.\" the use of the information contained herein. The author(s) may not
19.\" have taken the same level of care in the production of this manual,
20.\" which is licensed free of charge, as they might when working
21.\" professionally.
c13182ef 22.\"
fea681da
MK
23.\" Formatted or processed versions of this manual, if unaccompanied by
24.\" the source, must acknowledge the copyright and authors of this work.
25.\"
26.\" Modified 1997-01-31 by Eric S. Raymond <esr@thyrsus.com>
27.\" Modified 2000-03-25 by Jim Van Zandt <jrv@vanzandt.mv.com>
28.\" Modified 2001-10-04 by John Levon <moz@compsoc.man.ac.uk>
29.\" Modified 2003-02-02 by Andi Kleen <ak@muc.de>
c11b1abf 30.\" Modified 2003-05-21 by Michael Kerrisk <mtk.manpages@gmail.com>
fea681da 31.\" MAP_LOCKED works from 2.5.37
c11b1abf 32.\" Modified 2004-06-17 by Michael Kerrisk <mtk.manpages@gmail.com>
fea681da 33.\" Modified 2004-09-11 by aeb
1a956089
MK
34.\" Modified 2004-12-08, from Eric Estievenart <eric.estievenart@free.fr>
35.\" Modified 2004-12-08, mtk, formatting tidy-ups
a62f5121 36.\" Modified 2006-12-04, mtk, various parts rewritten
74fa61b7 37.\" 2007-07-10, mtk, Added an example program.
e6205b0c 38.\" 2008-11-18, mtk, document MAP_STACK
fea681da 39.\"
76a34baa 40.TH MMAP 2 2009-09-26 "Linux" "Linux Programmer's Manual"
fea681da
MK
41.SH NAME
42mmap, munmap \- map or unmap files or devices into memory
43.SH SYNOPSIS
e0037472 44.nf
fea681da
MK
45.B #include <sys/mman.h>
46.sp
14f5ae6d 47.BI "void *mmap(void *" addr ", size_t " length \
a62f5121 48", int " prot ", int " flags ,
e0037472 49.BI " int " fd ", off_t " offset );
14f5ae6d 50.BI "int munmap(void *" addr ", size_t " length );
e0037472 51.fi
fea681da 52.SH DESCRIPTION
1a956089 53.BR mmap ()
c13182ef 54creates a new mapping in the virtual address space of
5e8cde2f
MK
55the calling process.
56The starting address for the new mapping is specified in
14f5ae6d 57.IR addr .
5e8cde2f
MK
58The
59.I length
60argument specifies the length of the mapping.
61
62If
14f5ae6d 63.I addr
5e8cde2f
MK
64is NULL,
65then the kernel chooses the address at which to create the mapping;
66this is the most portable method of creating a new mapping.
c13182ef 67If
14f5ae6d 68.I addr
5e8cde2f
MK
69is not NULL,
70then the kernel takes it as a hint about where to place the mapping;
6aa7db0a
MK
71on Linux, the mapping will be created at a nearby page boundary.
72.\" Before Linux 2.6.24, the address was rounded up to the next page
29328361 73.\" boundary; since 2.6.24, it is rounded down!
5e8cde2f
MK
74The address of the new mapping is returned as the result of the call.
75
76The contents of a file mapping (as opposed to an anonymous mapping; see
77.B MAP_ANONYMOUS
d9bfdb9c 78below), are initialized using
fea681da
MK
79.I length
80bytes starting at offset
81.I offset
5e8cde2f
MK
82in the file (or other object) referred to by the file descriptor
83.IR fd .
a62f5121
MK
84.I offset
85must be a multiple of the page size as returned by
86.IR sysconf(_SC_PAGE_SIZE) .
fea681da
MK
87.LP
88The
89.I prot
c13182ef 90argument describes the desired memory protection of the mapping
5e8cde2f
MK
91(and must not conflict with the open mode of the file).
92It is either
fea681da 93.B PROT_NONE
a62f5121 94or the bitwise OR of one or more of the following flags:
fea681da
MK
95.TP 1.1i
96.B PROT_EXEC
97Pages may be executed.
98.TP
99.B PROT_READ
100Pages may be read.
101.TP
102.B PROT_WRITE
103Pages may be written.
104.TP
105.B PROT_NONE
106Pages may not be accessed.
107.LP
108The
109.I flags
a62f5121
MK
110argument determines whether updates to the mapping
111are visible to other processes mapping the same region,
ba7cb080 112and whether updates are carried through to the underlying file.
d9bfdb9c 113This behavior is determined by including exactly one
a62f5121 114of the following values in
5e8cde2f 115.IR flags :
fea681da 116.TP 1.1i
fea681da 117.B MAP_SHARED
c13182ef 118Share this mapping.
a62f5121
MK
119Updates to the mapping are visible to other processes that map this file,
120and are carried through to the underlying file.
fea681da
MK
121The file may not actually be updated until
122.BR msync (2)
123or
2777b1ca 124.BR munmap ()
a62f5121 125is called.
fea681da
MK
126.TP
127.B MAP_PRIVATE
128Create a private copy-on-write mapping.
a62f5121
MK
129Updates to the mapping are not visible to other processes
130mapping the same file, and are not carried through to
131the underlying file.
fea681da 132It is unspecified whether changes made to the file after the
1a956089 133.BR mmap ()
fea681da
MK
134call are visible in the mapped region.
135.LP
a62f5121
MK
136Both of these flags are described in POSIX.1-2001.
137
138In addition, zero or more of the following values can be ORed in
139.IR flags :
fea681da 140.TP
c368e7ca
MK
141.BR MAP_32BIT " (since Linux 2.4.20, 2.6)"
142Put the mapping into the first 2 Gigabytes of the process address space.
143This flag is only supported on x86-64, for 64-bit programs.
144It was added to allow thread stacks to be allocated somewhere
145in the first 2GB of memory,
146so as to improve context-switch performance on some early
14764-bit processors.
148.\" See http://lwn.net/Articles/294642 "Tangled up in threads", 19 Aug 08
149Modern x86-64 processors no longer have this performance problem,
150so use of this flag is not required on those systems.
151The
83314009 152.B MAP_32BIT
c368e7ca 153flag is ignored when
a62f5121 154.B MAP_FIXED
83314009 155is set.
fea681da 156.TP
a62f5121 157.B MAP_ANON
c13182ef
MK
158Synonym for
159.BR MAP_ANONYMOUS .
a62f5121
MK
160Deprecated.
161.TP
fea681da 162.B MAP_ANONYMOUS
5e8cde2f 163The mapping is not backed by any file;
d9bfdb9c 164its contents are initialized to zero.
5e8cde2f 165The
fea681da
MK
166.I fd
167and
168.I offset
a62f5121 169arguments are ignored;
c13182ef 170however, some implementations require
a62f5121 171.I fd
c13182ef
MK
172to be \-1 if
173.B MAP_ANONYMOUS
174(or
175.BR MAP_ANON )
a62f5121
MK
176is specified,
177and portable applications should ensure this.
c13182ef 178The use of
a62f5121 179.B MAP_ANONYMOUS
c13182ef 180in conjunction with
51ffcca0 181.B MAP_SHARED
74f3f90b 182is only supported on Linux since kernel 2.4.
fea681da 183.TP
83314009
MK
184.B MAP_DENYWRITE
185This flag is ignored.
186.\" Introduced in 1.1.36, removed in 1.3.24.
d9bfdb9c 187(Long ago, it signaled that attempts to write to the underlying file
83314009
MK
188should fail with
189.BR ETXTBUSY .
190But this was a source of denial-of-service attacks.)
191.TP
192.B MAP_EXECUTABLE
193This flag is ignored.
194.\" Introduced in 1.1.38, removed in 1.3.24. Flag tested in proc_follow_link.
d9bfdb9c 195.\" (Long ago, it signaled that the underlying file is an executable.
83314009
MK
196.\" However, that information was not really used anywhere.)
197.\" Linus talked about DOS related to MAP_EXECUTABLE, but he was thinking of
198.\" MAP_DENYWRITE?
199.TP
fea681da 200.B MAP_FILE
c13182ef
MK
201Compatibility flag.
202Ignored.
988db661 203.\" On some systems, this was required as the opposite of
83314009 204.\" MAP_ANONYMOUS -- mtk, 1 May 2007
fea681da 205.TP
51ffcca0 206.B MAP_FIXED
83314009 207Don't interpret
14f5ae6d 208.I addr
83314009 209as a hint: place the mapping at exactly that address.
14f5ae6d 210.I addr
83314009
MK
211must be a multiple of the page size.
212If the memory region specified by
14f5ae6d 213.I addr
83314009
MK
214and
215.I len
216overlaps pages of any existing mapping(s), then the overlapped
217part of the existing mapping(s) will be discarded.
218If the specified address cannot be used,
219.BR mmap ()
220will fail.
221Because requiring a fixed address for a mapping is less portable,
222the use of this option is discouraged.
fea681da 223.TP
83314009
MK
224.B MAP_GROWSDOWN
225Used for stacks.
226Indicates to the kernel virtual memory system that the mapping
227should extend downwards in memory.
228.TP
76a34baa
MK
229.BR MAP_HUGETLB " (since Linux 2.6.32)"
230Allocate the mapping using "huge pages."
231See the kernel source file
232.I Documentation/vm/hugetlbpage.txt
233for further information.
234.TP
83314009
MK
235.BR MAP_LOCKED " (since Linux 2.5.37)"
236Lock the pages of the mapped region into memory in the manner of
74d32233 237.BR mlock (2).
83314009
MK
238This flag is ignored in older kernels.
239.\" If set, the mapped pages will not be swapped out.
fea681da
MK
240.TP
241.BR MAP_NONBLOCK " (since Linux 2.5.46)"
51ffcca0
MK
242Only meaningful in conjunction with
243.BR MAP_POPULATE .
c13182ef
MK
244Don't perform read-ahead:
245only create page tables entries for pages
51ffcca0 246that are already present in RAM.
7c40de08 247Since Linux 2.6.23, this flag causes
f38fa944
MK
248.BR MAP_POPULATE
249to do nothing.
250One day the combination of
251.BR MAP_POPULATE
252and
253.BR MAP_NONBLOCK
254may be re-implemented.
83314009
MK
255.TP
256.B MAP_NORESERVE
257Do not reserve swap space for this mapping.
258When swap space is reserved, one has the guarantee
259that it is possible to modify the mapping.
8bd58774
MK
260When swap space is not reserved one might get
261.B SIGSEGV
262upon a write
83314009
MK
263if no physical memory is available.
264See also the discussion of the file
265.I /proc/sys/vm/overcommit_memory
266in
267.BR proc (5).
268In kernels before 2.6, this flag only had effect for
269private writable mappings.
270.TP
271.BR MAP_POPULATE " (since Linux 2.5.46)"
f38fa944
MK
272Populate (prefault) page tables for a mapping.
273For a file mapping, this causes read-ahead on the file.
83314009 274Later accesses to the mapping will not be blocked by page faults.
f38fa944
MK
275.BR MAP_POPULATE
276is only supported for private mappings since Linux 2.6.23.
fea681da 277.LP
a62f5121
MK
278Of the above flags, only
279.B MAP_FIXED
280is specified in POSIX.1-2001.
281However, most systems also support
282.B MAP_ANONYMOUS
c13182ef 283(or its synonym
a62f5121 284.BR MAP_ANON ).
e6205b0c
MK
285.TP
286.BR MAP_STACK " (since Linux 2.6.27)"
287Allocate the mapping at an address suitable for a process
288or thread stack.
289This flag is currently a no-op,
290but is used in the glibc threading implementation so that
291if some architectures require special treatment for stack allocations,
292support can later be transparently implemented for glibc.
67b59ff5 293.\" See http://lwn.net/Articles/294642 "Tangled up in threads", 19 Aug 08
e6205b0c
MK
294.\" commit cd98a04a59e2f94fa64d5bf1e26498d27427d5e7
295.\" http://thread.gmane.org/gmane.linux.kernel/720412
296.\" "pthread_create() slow for many threads; also time to revisit 64b
297.\" context switch optimization?"
a62f5121 298.LP
2d6cfc1a
MK
299Some systems document the additional flags
300.BR MAP_AUTOGROW ,
301.BR MAP_AUTORESRV ,
302.BR MAP_COPY ,
303and
304.BR MAP_LOCAL .
fea681da 305.LP
fea681da 306Memory mapped by
1a956089 307.BR mmap ()
fea681da
MK
308is preserved across
309.BR fork (2),
310with the same attributes.
311.LP
c13182ef
MK
312A file is mapped in multiples of the page size.
313For a file that is not
fea681da 314a multiple of the page size, the remaining memory is zeroed when mapped,
c13182ef
MK
315and writes to that region are not written out to the file.
316The effect of
fea681da
MK
317changing the size of the underlying file of a mapping on the pages that
318correspond to added or removed regions of the file is unspecified.
de5f7e28 319.SS munmap()
fea681da 320The
1a956089 321.BR munmap ()
fea681da
MK
322system call deletes the mappings for the specified address range, and
323causes further references to addresses within the range to generate
c13182ef
MK
324invalid memory references.
325The region is also automatically unmapped
326when the process is terminated.
327On the other hand, closing the file
fea681da
MK
328descriptor does not unmap the region.
329.LP
330The address
14f5ae6d 331.I addr
c13182ef
MK
332must be a multiple of the page size.
333All pages containing a part
fea681da 334of the indicated range are unmapped, and subsequent references
8bd58774
MK
335to these pages will generate
336.BR SIGSEGV .
c13182ef 337It is not an error if the
fea681da 338indicated range does not contain any mapped pages.
de5f7e28 339.SS Timestamps changes for file-backed mappings
fea681da 340For file-backed mappings, the
8478ee02 341.I st_atime
fea681da 342field for the mapped file may be updated at any time between the
1a956089 343.BR mmap ()
fea681da
MK
344and the corresponding unmapping; the first reference to a mapped
345page will update the field if it has not been already.
346.LP
347The
8478ee02 348.I st_ctime
fea681da 349and
8478ee02 350.I st_mtime
c13182ef
MK
351field for a file mapped with
352.B PROT_WRITE
353and
354.B MAP_SHARED
51ffcca0 355will be updated after
fea681da 356a write to the mapped region, and before a subsequent
0bfa087b 357.BR msync (2)
c13182ef
MK
358with the
359.B MS_SYNC
360or
0daa9e92 361.B MS_ASYNC
51ffcca0 362flag, if one occurs.
fea681da
MK
363.SH "RETURN VALUE"
364On success,
1a956089 365.BR mmap ()
fea681da
MK
366returns a pointer to the mapped area.
367On error, the value
368.B MAP_FAILED
c13182ef 369(that is,
009df872 370.IR "(void\ *)\ \-1" )
5e8cde2f 371is returned, and
fea681da
MK
372.I errno
373is set appropriately.
374On success,
1a956089 375.BR munmap ()
fea681da
MK
376returns 0, on failure \-1, and
377.I errno
c13182ef 378is set (probably to
51ffcca0 379.BR EINVAL ).
fea681da
MK
380.SH ERRORS
381.TP
382.B EACCES
383A file descriptor refers to a non-regular file.
c13182ef
MK
384Or
385.B MAP_PRIVATE
51ffcca0 386was requested, but
fea681da
MK
387.I fd
388is not open for reading.
c13182ef
MK
389Or
390.B MAP_SHARED
391was requested and
392.B PROT_WRITE
51ffcca0 393is set, but
fea681da 394.I fd
682edefb
MK
395is not open in read/write
396.RB ( O_RDWR )
397mode.
c13182ef
MK
398Or
399.B PROT_WRITE
51ffcca0 400is set, but the file is append-only.
fea681da
MK
401.TP
402.B EAGAIN
83cd3686
MK
403The file has been locked, or too much memory has been locked (see
404.BR setrlimit (2)).
fea681da
MK
405.TP
406.B EBADF
407.I fd
c13182ef 408is not a valid file descriptor (and
51ffcca0
MK
409.B MAP_ANONYMOUS
410was not set).
fea681da
MK
411.TP
412.B EINVAL
413We don't like
14f5ae6d 414.IR addr ,
62a04c81 415.IR length ,
fea681da 416or
0daa9e92 417.I offset
62a04c81
MK
418(e.g., they are too large, or not aligned on a page boundary).
419.TP
420.B EINVAL
f99fc197 421(since Linux 2.6.12)
fea681da 422.I length
62a04c81
MK
423was 0.
424.TP
425.B EINVAL
426.I flags
427contained neither
428.B MAP_PRIVATE
fea681da 429or
62a04c81
MK
430.BR MAP_SHARED ,
431or contained both of these values.
fea681da
MK
432.TP
433.B ENFILE
434.\" This is for shared anonymous segments
435.\" [2.6.7] shmem_zero_setup()-->shmem_file_setup()-->get_empty_filp()
436The system limit on the total number of open files has been reached.
437.\" .TP
438.\" .B ENOEXEC
439.\" A file could not be mapped for reading.
440.TP
441.B ENODEV
24d01c53 442The underlying file system of the specified file does not support
fea681da
MK
443memory mapping.
444.TP
445.B ENOMEM
446No memory is available, or the process's maximum number of mappings would
447have been exceeded.
448.TP
449.B EPERM
450The
451.I prot
452argument asks for
453.B PROT_EXEC
24d01c53 454but the mapped area belongs to a file on a file system that
fea681da
MK
455was mounted no-exec.
456.\" (Since 2.4.25 / 2.6.0.)
457.TP
458.B ETXTBSY
c13182ef 459.B MAP_DENYWRITE
51ffcca0 460was set but the object specified by
fea681da
MK
461.I fd
462is open for writing.
463.LP
464Use of a mapped region can result in these signals:
465.TP
466.B SIGSEGV
1e321034 467Attempted write into a region mapped as read-only.
fea681da
MK
468.TP
469.B SIGBUS
470Attempted access to a portion of the buffer that does not correspond
471to the file (for example, beyond the end of the file, including the
472case where another process has truncated the file).
2b2581ee
MK
473.SH "CONFORMING TO"
474SVr4, 4.4BSD, POSIX.1-2001.
475.\" SVr4 documents additional error codes ENXIO and ENODEV.
476.\" SUSv2 documents additional error codes EMFILE and EOVERFLOW.
fea681da
MK
477.SH AVAILABILITY
478On POSIX systems on which
1a956089 479.BR mmap (),
0bfa087b 480.BR msync (2)
fea681da 481and
1a956089 482.BR munmap ()
fea681da
MK
483are available,
484.B _POSIX_MAPPED_FILES
6387216b
MK
485is defined in \fI<unistd.h>\fP to a value greater than 0.
486(See also
fea681da 487.BR sysconf (3).)
97c1eac8 488.\" POSIX.1-2001: It shall be defined to -1 or 0 or 200112L.
fea681da
MK
489.\" -1: unavailable, 0: ask using sysconf().
490.\" glibc defines it to 1.
a1d5f77c 491.SH NOTES
5636a29a
MK
492Since kernel 2.4, this system call has been superseded by
493.BR mmap2 (2).
494Nowadays,
495.\" Since around glibc 2.1/2.2, depending on the platform.
496the glibc
497.BR mmap ()
498wrapper function invokes
499.BR mmap2 (2)
500with a suitably adjusted value for
501.IR offset .
502
34ccb744 503On some hardware architectures (e.g., i386),
0daa9e92 504.B PROT_WRITE
f3edaabb
MK
505implies
506.BR PROT_READ .
a1d5f77c
MK
507It is architecture dependent whether
508.B PROT_READ
509implies
510.B PROT_EXEC
511or not.
512Portable programs should always set
513.B PROT_EXEC
514if they intend to execute code in the new mapping.
80d17cfa
MK
515
516The portable way to create a mapping is to specify
517.I addr
518as 0 (NULL), and omit
519.B MAP_FIXED
520from
521.IR flags .
522In this case, the system chooses the address for the mapping;
46cdb997 523the address is chosen so as not to conflict with any existing mapping,
80d17cfa
MK
524and will not be 0.
525If the
526.B MAP_FIXED
527flag is specified, and
528.I addr
491cd2f0 529is 0 (NULL), then the mapped address will be 0 (NULL).
fea681da 530.SH BUGS
c13182ef
MK
531On Linux there are no guarantees like those suggested above under
532.BR MAP_NORESERVE .
dbc53ca8 533By default, any process can be killed
fea681da 534at any moment when the system runs out of memory.
dbc53ca8
MK
535
536In kernels before 2.6.7, the
537.B MAP_POPULATE
538flag only has effect if
539.I prot
540is specified as
541.BR PROT_NONE .
c8f3e580 542
c13182ef 543SUSv3 specifies that
c8f3e580
MK
544.BR mmap ()
545should fail if
546.I length
547is 0.
548However, in kernels before 2.6.12,
549.BR mmap ()
550succeeded in this case: no mapping was created and the call returned
14f5ae6d 551.IR addr .
c8f3e580
MK
552Since kernel 2.6.12,
553.BR mmap ()
554fails with the error
555.B EINVAL
556for this case.
74fa61b7 557.SH EXAMPLE
2e001ad4
MK
558.\" FIXME . Add an example here that uses an anonymous shared region for
559.\" IPC between parent and child.
74fa61b7
MK
560.PP
561The following program prints part of the file specified in
562its first command-line argument to standard output.
563The range of bytes to be printed is specified via offset and length
564values in the second and third command-line arguments.
565The program creates a memory mapping of the required
566pages of the file and then uses
567.BR write (2)
568to output the desired bytes.
569.nf
570
571#include <sys/mman.h>
572#include <sys/stat.h>
573#include <fcntl.h>
574#include <stdio.h>
575#include <stdlib.h>
576#include <unistd.h>
577
4407d3d8
MK
578#define handle_error(msg) \\
579 do { perror(msg); exit(EXIT_FAILURE); } while (0)
580
74fa61b7
MK
581int
582main(int argc, char *argv[])
583{
584 char *addr;
585 int fd;
586 struct stat sb;
587 off_t offset, pa_offset;
588 size_t length;
589 ssize_t s;
590
fbbfa7ce 591 if (argc < 3 || argc > 4) {
74fa61b7
MK
592 fprintf(stderr, "%s file offset [length]\\n", argv[0]);
593 exit(EXIT_FAILURE);
594 }
595
596 fd = open(argv[1], O_RDONLY);
4407d3d8 597 if (fd == \-1)
8568021d 598 handle_error("open");
74fa61b7 599
4407d3d8
MK
600 if (fstat(fd, &sb) == \-1) /* To obtain file size */
601 handle_error("fstat");
74fa61b7
MK
602
603 offset = atoi(argv[2]);
604 pa_offset = offset & ~(sysconf(_SC_PAGE_SIZE) \- 1);
605 /* offset for mmap() must be page aligned */
606
607 if (offset >= sb.st_size) {
608 fprintf(stderr, "offset is past end of file\\n");
609 exit(EXIT_FAILURE);
610 }
611
612 if (argc == 4) {
613 length = atoi(argv[3]);
614 if (offset + length > sb.st_size)
615 length = sb.st_size \- offset;
f81fb444 616 /* Can\(aqt display bytes past end of file */
5b6adad1 617
74fa61b7
MK
618 } else { /* No length arg ==> display to end of file */
619 length = sb.st_size \- offset;
620 }
621
622 addr = mmap(NULL, length + offset \- pa_offset, PROT_READ,
623 MAP_PRIVATE, fd, pa_offset);
4407d3d8
MK
624 if (addr == MAP_FAILED)
625 handle_error("mmap");
74fa61b7
MK
626
627 s = write(STDOUT_FILENO, addr + offset \- pa_offset, length);
628 if (s != length) {
629 if (s == \-1)
4407d3d8
MK
630 handle_error("write");
631
632 fprintf(stderr, "partial write");
74fa61b7
MK
633 exit(EXIT_FAILURE);
634 }
635
636 exit(EXIT_SUCCESS);
637} /* main */
638.fi
fea681da
MK
639.SH "SEE ALSO"
640.BR getpagesize (2),
f75c3a3b 641.BR mincore (2),
fea681da
MK
642.BR mlock (2),
643.BR mmap2 (2),
54504ac3 644.BR mprotect (2),
fea681da
MK
645.BR mremap (2),
646.BR msync (2),
931e4e25 647.BR remap_file_pages (2),
83cd3686 648.BR setrlimit (2),
7921f13b 649.BR shmat (2),
f93af9c6
MK
650.BR shm_open (3),
651.BR shm_overview (7)
fea681da
MK
652.br
653B.O. Gallmeister, POSIX.4, O'Reilly, pp. 128-129 and 389-391.
654.\"
655.\" Repeat after me: private read-only mappings are 100% equivalent to
656.\" shared read-only mappings. No ifs, buts, or maybes. -- Linus