mmap.2: Minor fixes to Cyril Hrubis's patch

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2013-02-25 09:06:12 +01:00
parent 2e43522f07
commit a780f17be1
1 changed files with 15 additions and 8 deletions

View File

@ -612,14 +612,21 @@ fails with the error
.B EINVAL .B EINVAL
for this case. for this case.
POSIX specifies that system shall always zero fill any partial page at the end POSIX specifies that the system shall always
of the object and that system will newer write any modification of object zero fill any partial page at the end
beyond its end. On Linux when you write data to such partial page after the end of the object and that system will never write any modification of the
of the object the data stays in page cache even after you closed and unmaped object beyond its end.
the file and although the data are newer written to the file itself subsequent On Linux, when you write data to such partial page after the end
mappings may see the modified content. In some cases this could be fixed by of the object, the data stays in the page cache even after the file
calling msync before the unmap takes place, this however doesn't work on tmpfs is closed and unmapped
(for example when using shm ipc interface). 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)
before the unmap takes place;
however, this doesn't work on tmpfs
(for example, when using POSIX shared memory interface documented in
.BR shm_overview (7)).
.SH EXAMPLE .SH EXAMPLE
.\" FIXME . Add an example here that uses an anonymous shared region for .\" FIXME . Add an example here that uses an anonymous shared region for
.\" IPC between parent and child. .\" IPC between parent and child.