отображать или отменять отображение файлов или устройств в память (map or unmap files or devices into memory)
Ошибки (баги) (Bugs)
On Linux, there are no guarantees like those suggested above
under MAP_NORESERVE
. By default, any process can be killed at
any moment when the system runs out of memory.
In kernels before 2.6.7, the MAP_POPULATE
flag has effect only if
prot is specified as PROT_NONE
.
SUSv3 specifies that mmap
() should fail if length is 0. However,
in kernels before 2.6.12, mmap
() succeeded in this case: no
mapping was created and the call returned addr. Since kernel
2.6.12, mmap
() fails with the error EINVAL
for this case.
POSIX specifies that the system shall always zero fill any
partial page at the end of the object and that system will never
write any modification of the object beyond its end. On Linux,
when you write data to such partial page after the end of the
object, the data stays in the page cache even after the file 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 msync(2)
before the unmap takes place; however, this doesn't work on
tmpfs(5) (for example, when using the POSIX shared memory
interface documented in shm_overview(7)).