summaryrefslogtreecommitdiffstats
path: root/man2/mmap.2
diff options
context:
space:
mode:
Diffstat (limited to 'man2/mmap.2')
-rw-r--r--man2/mmap.284
1 files changed, 42 insertions, 42 deletions
diff --git a/man2/mmap.2 b/man2/mmap.2
index 63df5a98a..73c89b805 100644
--- a/man2/mmap.2
+++ b/man2/mmap.2
@@ -120,7 +120,7 @@ and (in the case of file-backed mappings)
are carried through to the underlying file.
(To precisely control when updates are carried through
to the underlying file requires the use of
-.BR msync (2).)
+.MR msync 2 .)
.TP
.BR MAP_SHARED_VALIDATE " (since Linux 4.15)"
This flag provides the same behavior as
@@ -331,7 +331,7 @@ can be discovered by listing the subdirectories in
.TP
.BR MAP_LOCKED " (since Linux 2.5.37)"
Mark the mapped region to be locked in the same way as
-.BR mlock (2).
+.MR mlock 2 .
This implementation will try to populate (prefault) the whole range but the
.BR mmap ()
call doesn't fail with
@@ -339,11 +339,11 @@ call doesn't fail with
if this fails.
Therefore major faults might happen later on.
So the semantic is not as strong as
-.BR mlock (2).
+.MR mlock 2 .
One should use
.BR mmap ()
plus
-.BR mlock (2)
+.MR mlock 2
when major faults are not acceptable after the initialization of the mapping.
The
.B MAP_LOCKED
@@ -378,7 +378,7 @@ if no physical memory is available.
See also the discussion of the file
.I /proc/sys/vm/overcommit_memory
in
-.BR proc (5).
+.MR proc 5 .
Before Linux 2.6, this flag had effect only for
private writable mappings.
.TP
@@ -520,7 +520,7 @@ is set, but the file is append-only.
.TP
.B EAGAIN
The file has been locked, or too much memory has been locked (see
-.BR setrlimit (2)).
+.MR setrlimit 2 ).
.TP
.B EBADF
.I fd
@@ -587,7 +587,7 @@ the region being unmapped.
The process's
.B RLIMIT_DATA
limit, described in
-.BR getrlimit (2),
+.MR getrlimit 2 ,
would have been exceeded.
.TP
.B ENOMEM
@@ -618,7 +618,7 @@ was mounted no-exec.
.TP
.B EPERM
The operation was prevented by a file seal; see
-.BR fcntl (2).
+.MR fcntl 2 .
.TP
.B EPERM
The
@@ -631,7 +631,7 @@ and is not a member of the
group; see the description of
.I /proc/sys/vm/sysctl_hugetlb_shm_group
in
-.BR proc_sys (5).
+.MR proc_sys 5 .
.TP
.B ETXTBSY
.B MAP_DENYWRITE
@@ -652,7 +652,7 @@ corresponds to the end of a mapped file that is not a multiple
of the page size, see NOTES.
.SH ATTRIBUTES
For an explanation of the terms used in this section, see
-.BR attributes (7).
+.MR attributes 7 .
.TS
allbox;
lbx lb lb
@@ -732,13 +732,13 @@ This page describes the interface provided by the glibc
wrapper function.
Originally, this function invoked a system call of the same name.
Since Linux 2.4, that system call has been superseded by
-.BR mmap2 (2),
+.MR mmap2 2 ,
and nowadays
.\" Since around glibc 2.1/2.2, depending on the platform.
the glibc
.BR mmap ()
wrapper function invokes
-.BR mmap2 (2)
+.MR mmap2 2
with a suitably adjusted value for
.IR offset .
.SH STANDARDS
@@ -750,14 +750,14 @@ POSIX.1-2001, SVr4, 4.4BSD.
.P
On POSIX systems on which
.BR mmap (),
-.BR msync (2),
+.MR msync 2 ,
and
.BR munmap ()
are available,
.B _POSIX_MAPPED_FILES
is defined in \fI<unistd.h>\fP to a value greater than 0.
(See also
-.BR sysconf (3).)
+.MR sysconf 3 .)
.\" POSIX.1-2001: It shall be defined to -1 or 0 or 200112L.
.\" -1: unavailable, 0: ask using sysconf().
.\" glibc defines it to 1.
@@ -765,7 +765,7 @@ is defined in \fI<unistd.h>\fP to a value greater than 0.
Memory mapped by
.BR mmap ()
is preserved across
-.BR fork (2),
+.MR fork 2 ,
with the same attributes.
.P
A file is mapped in multiples of the page size.
@@ -780,7 +780,7 @@ correspond to added or removed regions of the file is unspecified.
.P
An application can determine which pages of a mapping are
currently resident in the buffer/page cache using
-.BR mincore (2).
+.MR mincore 2 .
.\"
.SS Using MAP_FIXED safely
The only safe use for
@@ -807,18 +807,18 @@ it will effectively clobber the mapping that thread B created.
In this scenario,
thread B need not create a mapping directly; simply making a library call
that, internally, uses
-.BR dlopen (3)
+.MR dlopen 3
to load some other shared library, will suffice.
The
-.BR dlopen (3)
+.MR dlopen 3
call will map the library into the process's address space.
Furthermore, almost any library call may be implemented in a way that
adds memory mappings to the address space, either with this technique,
or by simply allocating memory.
Examples include
-.BR brk (2),
-.BR malloc (3),
-.BR pthread_create (3),
+.MR brk 2 ,
+.MR malloc 3 ,
+.MR pthread_create 3 ,
and the PAM libraries
.UR http://www.linux-pam.org
.UE .
@@ -847,7 +847,7 @@ and
.B MAP_SHARED
will be updated after
a write to the mapped region, and before a subsequent
-.BR msync (2)
+.MR msync 2
with the
.B MS_SYNC
or
@@ -915,12 +915,12 @@ is closed and unmapped
and even though the data is never written to the file itself,
subsequent mappings may see the modified content.
In some cases, this could be fixed by calling
-.BR msync (2)
+.MR msync 2
before the unmap takes place;
however, this doesn't work on
-.BR tmpfs (5)
+.MR tmpfs 5
(for example, when using the POSIX shared memory interface documented in
-.BR shm_overview (7)).
+.MR shm_overview 7 ).
.SH EXAMPLES
.\" FIXME . Add an example here that uses an anonymous shared region for
.\" IPC between parent and child.
@@ -930,7 +930,7 @@ The range of bytes to be printed is specified via offset and length
values in the second and third command-line arguments.
The program creates a memory mapping of the required
pages of the file and then uses
-.BR write (2)
+.MR write 2
to output the desired bytes.
.SS Program source
.\" SRC BEGIN (mmap.c)
@@ -1008,24 +1008,24 @@ main(int argc, char *argv[])
.EE
.\" SRC END
.SH SEE ALSO
-.BR ftruncate (2),
-.BR getpagesize (2),
-.BR memfd_create (2),
-.BR mincore (2),
-.BR mlock (2),
-.BR mmap2 (2),
-.BR mprotect (2),
-.BR mremap (2),
-.BR msync (2),
-.BR remap_file_pages (2),
-.BR setrlimit (2),
-.BR shmat (2),
-.BR userfaultfd (2),
-.BR shm_open (3),
-.BR shm_overview (7)
+.MR ftruncate 2 ,
+.MR getpagesize 2 ,
+.MR memfd_create 2 ,
+.MR mincore 2 ,
+.MR mlock 2 ,
+.MR mmap2 2 ,
+.MR mprotect 2 ,
+.MR mremap 2 ,
+.MR msync 2 ,
+.MR remap_file_pages 2 ,
+.MR setrlimit 2 ,
+.MR shmat 2 ,
+.MR userfaultfd 2 ,
+.MR shm_open 3 ,
+.MR shm_overview 7
.P
The descriptions of the following files in
-.BR proc (5):
+.MR proc 5 :
.IR /proc/ pid /maps ,
.IR /proc/ pid /map_files ,
and