aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Kerrisk <mtk.manpages@gmail.com>2020-11-02 10:57:14 +0100
committerMichael Kerrisk <mtk.manpages@gmail.com>2020-11-02 10:57:14 +0100
commit9807d9afdda9e96df4b6410395c4a4106c1e23d2 (patch)
tree7fe20a8649b5b45579ba32cec87110e7d3839873
parent1d5974814d11ef5f4255be90155e9e9c03cb7594 (diff)
downloadman-pages-9807d9afdda9e96df4b6410395c4a4106c1e23d2.tar.gz
mmap.2: Clarify SIGBUS text and treatment of partial page at end of a mapping
See https://unix.stackexchange.com/questions/616848/what-is-the-behaviour-of-a-file-backed-memory-map-when-reading-from-or-writing-t Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
-rw-r--r--man2/mmap.214
1 files changed, 9 insertions, 5 deletions
diff --git a/man2/mmap.2 b/man2/mmap.2
index 9393294c62..6133910583 100644
--- a/man2/mmap.2
+++ b/man2/mmap.2
@@ -635,9 +635,11 @@ Use of a mapped region can result in these signals:
Attempted write into a region mapped as read-only.
.TP
.B SIGBUS
-Attempted access to a portion of the buffer that does not correspond
-to the file (for example, beyond the end of the file, including the
-case where another process has truncated the file).
+Attempted access to a page of the buffer that lies beyond the
+end of the mapped file.
+For an explanation of the treatment of the bytes in the page that
+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).
@@ -678,8 +680,10 @@ with the same attributes.
.PP
A file is mapped in multiples of the page size.
For a file that is not
-a multiple of the page size, the remaining memory is zeroed when mapped,
-and writes to that region are not written out to the file.
+a multiple of the page size,
+the remaining bytes in the partial page at the end of the mapping
+are zeroed when mapped,
+and modifications to that region are not written out to the file.
The effect of
changing the size of the underlying file of a mapping on the pages that
correspond to added or removed regions of the file is unspecified.