diff --git a/Doc/library/mmap.rst b/Doc/library/mmap.rst index 12b14d69332d72a..b3c0d6fcba56490 100644 --- a/Doc/library/mmap.rst +++ b/Doc/library/mmap.rst @@ -81,7 +81,11 @@ To map anonymous memory, -1 should be passed as the fileno along with the length private copy-on-write mapping, so changes to the contents of the mmap object will be private to this process, and :const:`MAP_SHARED` creates a mapping that's shared with all other processes mapping the same areas of - the file. The default value is :const:`MAP_SHARED`. + the file. :const:`MAP_ALIGNED_SUPER` (FreeBSD only) uses super pages + feature, it is enabled by default in most of architectures and exists + since 2008. + The default value is :const:`MAP_SHARED`. + See :ref:`MAP_* constants `. *prot*, if specified, gives the desired memory protection; the two most useful values are :const:`PROT_READ` and :const:`PROT_WRITE`, to specify @@ -307,6 +311,24 @@ To map anonymous memory, -1 should be passed as the fileno along with the length the mmap was created with :const:`ACCESS_READ`, then writing to it will raise a :exc:`TypeError` exception. +.. _mmap-constants: + +MAP_* Constants ++++++++++++++++ + +.. data:: MAP_ANONYMOUS + MAP_ANON + MAP_SHARED + MAP_PRIVATE + MAP_DENYWRITE + MAP_EXECUTABLE + MAP_ALIGNED_SUPER + MAP_CONCEAL + + .. versionadded:: 3.9 + Add :data:`MAP_ALIGNED_SUPER` constant. + Add :data:`MAP_CONCEAL` constant, + .. _madvise-constants: MADV_* Constants @@ -341,3 +363,4 @@ MADV_* Constants Availability: Systems with the madvise() system call. .. versionadded:: 3.8 + diff --git a/Misc/NEWS.d/next/Library/2019-07-01-14-27-17.bpo-37471._EFODL.rst b/Misc/NEWS.d/next/Library/2019-07-01-14-27-17.bpo-37471._EFODL.rst new file mode 100644 index 000000000000000..3db2cb573c7a76c --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-07-01-14-27-17.bpo-37471._EFODL.rst @@ -0,0 +1,2 @@ +Adding new :data:`mmap.MAP_ALIGNED_SUPER` FreeBSD constant. +Adding new :data:`mmap.MAP_CONCEAL` OpenBSD constant. diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c index 9e3414f94e3124b..3daaa0b8127fb1b 100644 --- a/Modules/mmapmodule.c +++ b/Modules/mmapmodule.c @@ -1528,6 +1528,12 @@ PyInit_mmap(void) setint(dict, "MAP_ANON", MAP_ANONYMOUS); setint(dict, "MAP_ANONYMOUS", MAP_ANONYMOUS); #endif +#ifdef MAP_ALIGNED_SUPER + setint(dict, "MAP_ALIGNED_SUPER", MAP_ALIGNED_SUPER); +#endif +#ifdef MAP_CONCEAL + setint(dict, "MAP_CONCEAL", MAP_CONCEAL); +#endif setint(dict, "PAGESIZE", (long)my_getpagesize());