Class MmapFlags
java.lang.Object
com.github.marschall.nativebytebuffers.MmapFlags
Values that may be passed as the flags argument to
Mman.mmap(int, int)
on a Linux system.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Put the mapping into the first 2 Gigabytes of the process address space.static final int
The mapping is not backed by any file; its contents are initialized to zero.static final int
This flag is used for stacks.static final int
Used in conjunction with MAP_HUGETLB to select alternative hugetlb page sizes (1 GB) on systems that support multiple hugetlb page sizes.static final int
Used in conjunction with MAP_HUGETLB to select alternative hugetlb page sizes (2 MB) on systems that support multiple hugetlb page sizes.static final int
More generally, the desired huge page size can be configured by encoding the base-2 logarithm of the desired page size in the six bits at the offset MAP_HUGE_SHIFT.static final int
Allocate the mapping using "huge pages." See the Linux kernel source file Documentation/vm/hugetlbpage.txt for further information, as well as NOTES, below.static final int
Mark the mmaped region to be locked in the same way as mlock(2).static final int
This flag is meaningful only in conjunction with MAP_POPULATE.static final int
Do not reserve swap space for this mapping.static final int
Populate (prefault) page tables for a mapping.static final int
Share this mapping.static final int
Allocate the mapping at an address suitable for a process or thread stack. -
Method Summary
-
Field Details
-
MAP_SHARED
public static final int MAP_SHAREDShare this mapping.Updates to the mapping are visible to other processes mapping the same region, and (in the case of file-backed mappings) are carried through to the underlying file. (To precisely control when updates are carried through to the underlying file requires the use of msync(2).)
- See Also:
-
MAP_32BIT
public static final int MAP_32BITPut the mapping into the first 2 Gigabytes of the process address space. This flag is supported only on x86-64, for 64-bit programs. It was added to allow thread stacks to be allocated somewhere in the first 2 GB of memory, so as to improve context-switch performance on some early 64-bit processors. Modern x86-64 processors no longer have this performance problem, so use of this flag is not required on those systems. The MAP_32BIT flag is ignored when MAP_FIXED is set.- Since:
- Linux 2.4.20, 2.6
- See Also:
-
MAP_ANONYMOUS
public static final int MAP_ANONYMOUSThe mapping is not backed by any file; its contents are initialized to zero. The fd argument is ignored; however, some implementations require fd to be -1 if MAP_ANONYMOUS (or MAP_ANON) is specified, and portable applications should ensure this. The offset argument should be zero. The use of MAP_ANONYMOUS in conjunction with MAP_SHARED is supported on Linux only since kernel 2.4.- See Also:
-
MAP_GROWSDOWN
public static final int MAP_GROWSDOWNThis flag is used for stacks. It indicates to the kernel virtual memory system that the mapping should extend downward in memory. The return address is one page lower than the memory area that is actually created in the process's virtual address space. Touching an address in the "guard" page below the mapping will cause the mapping to grow by a page. This growth can be repeated until the mapping grows to within a page of the high end of the next lower mapping, at which point touching the "guard" page will result in a SIGSEGV signal.- See Also:
-
MAP_HUGETLB
public static final int MAP_HUGETLBAllocate the mapping using "huge pages." See the Linux kernel source file Documentation/vm/hugetlbpage.txt for further information, as well as NOTES, below.- See Also:
-
MAP_HUGE_SHIFT
public static final int MAP_HUGE_SHIFTMore generally, the desired huge page size can be configured by encoding the base-2 logarithm of the desired page size in the six bits at the offset MAP_HUGE_SHIFT. (A value of zero in this bit field provides the default huge page size; the default huge page size can be discovered via the Hugepagesize field exposed by /proc/meminfo.)- See Also:
-
MAP_HUGE_2MB
public static final int MAP_HUGE_2MBUsed in conjunction with MAP_HUGETLB to select alternative hugetlb page sizes (2 MB) on systems that support multiple hugetlb page sizes.- See Also:
-
MAP_HUGE_1GB
public static final int MAP_HUGE_1GBUsed in conjunction with MAP_HUGETLB to select alternative hugetlb page sizes (1 GB) on systems that support multiple hugetlb page sizes.- See Also:
-
MAP_LOCKED
public static final int MAP_LOCKEDMark the mmaped region to be locked in the same way as mlock(2). This implementation will try to populate (prefault) the whole range but the mmap call doesn't fail with ENOMEM if this fails. Therefore major faults might happen later on. So the semantic is not as strong as mlock(2). One should use mmap() plus mlock(2) when major faults are not acceptable after the initialization of the mapping. The MAP_LOCKED flag is ignored in older kernels.- Since:
- Linux 2.5.37
- See Also:
-
MAP_NONBLOCK
public static final int MAP_NONBLOCKThis flag is meaningful only in conjunction with MAP_POPULATE. Don't perform read-ahead: create page tables entries only for pages that are already present in RAM. Since Linux 2.6.23, this flag causes MAP_POPULATE to do noth‐ ing. One day, the combination of MAP_POPULATE and MAP_NONBLOCK may be reimplemented.- Since:
- Linux 2.5.46
- See Also:
-
MAP_NORESERVE
public static final int MAP_NORESERVEDo not reserve swap space for this mapping. When swap space is reserved, one has the guarantee that it is possible to modify the mapping. When swap space is not reserved one might get SIGSEGV upon a write if no physical memory is available. See also the discussion of the file /proc/sys/vm/overcommit_memory in proc(5). In kernels before 2.6, this flag had effect only for private writable mappings.- See Also:
-
MAP_POPULATE
public static final int MAP_POPULATEPopulate (prefault) page tables for a mapping. For a file mapping, this causes read-ahead on the file. This will help to reduce blocking on page faults later. MAP_POPULATE is supported for private mappings only since Linux 2.6.23.- Since:
- Linux 2.5.46
- See Also:
-
MAP_STACK
public static final int MAP_STACKAllocate the mapping at an address suitable for a process or thread stack. This flag is currently a no-op, but is used in the glibc threading implementation so that if some architectures require special treatment for stack allocations, support can later be transparently implemented for glibc.- Since:
- Linux 2.6.33
- See Also:
-