mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-06 09:10:28 +00:00
Add the MAP_PREFAULT_READ option to mmap(2).
Reviewed by: jhb, kib
This commit is contained in:
parent
e7f8dd75b3
commit
74ffb9af15
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=211937
|
@ -28,7 +28,7 @@
|
|||
.\" @(#)mmap.2 8.4 (Berkeley) 5/11/95
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd November 6, 2009
|
||||
.Dd August 28, 2010
|
||||
.Dt MMAP 2
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
@ -211,6 +211,19 @@ implements a coherent file system buffer cache.
|
|||
However, it may be
|
||||
used to associate dirty VM pages with file system buffers and thus cause
|
||||
them to be flushed to physical media sooner rather than later.
|
||||
.It Dv MAP_PREFAULT_READ
|
||||
Immediately update the calling process's lowest-level virtual address
|
||||
translation structures, such as its page table, so that every memory
|
||||
resident page within the region is mapped for read access.
|
||||
Ordinarily these structures are updated lazily.
|
||||
The effect of this option is to eliminate any soft faults that would
|
||||
otherwise occur on the initial read accesses to the region.
|
||||
Although this option does not preclude
|
||||
.Fa prot
|
||||
from including
|
||||
.Dv PROT_WRITE ,
|
||||
it does not eliminate soft faults on the initial write accesses to the
|
||||
region.
|
||||
.It Dv MAP_PRIVATE
|
||||
Modifications are private.
|
||||
.It Dv MAP_SHARED
|
||||
|
|
|
@ -90,6 +90,7 @@
|
|||
* Extended flags
|
||||
*/
|
||||
#define MAP_NOCORE 0x00020000 /* dont include these pages in a coredump */
|
||||
#define MAP_PREFAULT_READ 0x00040000 /* prefault mapping for reading */
|
||||
#endif /* __BSD_VISIBLE */
|
||||
|
||||
#if __POSIX_VISIBLE >= 199309
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
* in the range 5 to 9.
|
||||
*/
|
||||
#undef __FreeBSD_version
|
||||
#define __FreeBSD_version 900018 /* Master, propagated to newvers */
|
||||
#define __FreeBSD_version 900019 /* Master, propagated to newvers */
|
||||
|
||||
#ifndef LOCORE
|
||||
#include <sys/types.h>
|
||||
|
|
|
@ -1467,9 +1467,10 @@ vm_mmap(vm_map_t map, vm_offset_t *addr, vm_size_t size, vm_prot_t prot,
|
|||
*/
|
||||
if (handle == 0)
|
||||
foff = 0;
|
||||
} else {
|
||||
} else if (flags & MAP_PREFAULT_READ)
|
||||
docow = MAP_PREFAULT;
|
||||
else
|
||||
docow = MAP_PREFAULT_PARTIAL;
|
||||
}
|
||||
|
||||
if ((flags & (MAP_ANON|MAP_SHARED)) == 0)
|
||||
docow |= MAP_COPY_ON_WRITE;
|
||||
|
|
Loading…
Reference in a new issue