mirror of https://github.com/mkerrisk/man-pages
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>
This commit is contained in:
parent
1d5974814d
commit
9807d9afdd
14
man2/mmap.2
14
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.
|
||||
|
|
Loading…
Reference in New Issue