From 3b4ac223479b8da0ddd7408a29fa31bba36d908e Mon Sep 17 00:00:00 2001 From: Ethan Steinberg Date: Tue, 12 May 2020 17:19:20 -0700 Subject: [PATCH 1/7] Add MAP_POPULATE. Issue 40611. --- Modules/mmapmodule.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c index a3e22d0a5110da..8a60db1e1c4692 100644 --- a/Modules/mmapmodule.c +++ b/Modules/mmapmodule.c @@ -1574,6 +1574,9 @@ PyInit_mmap(void) setint(dict, "MAP_ANON", MAP_ANONYMOUS); setint(dict, "MAP_ANONYMOUS", MAP_ANONYMOUS); #endif +#ifdef MAP_POPULATE + setint(dict, "MAP_POPULATE", MAP_POPULATE); +#endif setint(dict, "PAGESIZE", (long)my_getpagesize()); From 5c268cdf23cfc12b7e6443585011ae859b5847f3 Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Wed, 13 May 2020 16:28:34 +0000 Subject: [PATCH 2/7] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../NEWS.d/next/Library/2020-05-13-16-28-33.bpo-40611.ZCk0_c.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Library/2020-05-13-16-28-33.bpo-40611.ZCk0_c.rst diff --git a/Misc/NEWS.d/next/Library/2020-05-13-16-28-33.bpo-40611.ZCk0_c.rst b/Misc/NEWS.d/next/Library/2020-05-13-16-28-33.bpo-40611.ZCk0_c.rst new file mode 100644 index 00000000000000..930d26d0af6c40 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2020-05-13-16-28-33.bpo-40611.ZCk0_c.rst @@ -0,0 +1 @@ +MAP_POPULATE has now been added to the list of exported mmap flags. \ No newline at end of file From 6df04648634377f46161f8dae4bd6b19fd241162 Mon Sep 17 00:00:00 2001 From: Ethan Steinberg Date: Fri, 15 May 2020 13:13:01 -0700 Subject: [PATCH 3/7] Update docs --- Doc/library/mmap.rst | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/Doc/library/mmap.rst b/Doc/library/mmap.rst index 1f3fbc340fc267..897b3034e32ce2 100644 --- a/Doc/library/mmap.rst +++ b/Doc/library/mmap.rst @@ -81,7 +81,7 @@ 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. The default value is :const:`MAP_SHARED`. Some systems have additional possible flags with the full list specified in :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 @@ -342,3 +342,21 @@ MADV_* Constants Availability: Systems with the madvise() system call. .. versionadded:: 3.8 + +.. _map-constants: + +MAP_* Constants ++++++++++++++++ + +.. data:: MAP_SHARED + MAP_PRIVATE + MAP_DENYWRITE + MAP_EXECUTABLE + MAP_ANON + MAP_ANONYMOUS + MAP_POPULATE + + These are the various flags that can be passed to :meth:`mmap.mmap`. Note that some options might not be present on some systems. + + .. versionchanged:: 3.8 + Add MAP_POPULATE From e31571c2a8c1dd393abfb672fdbf51caed9df3a0 Mon Sep 17 00:00:00 2001 From: Ethan Steinberg Date: Tue, 19 May 2020 09:42:02 -0700 Subject: [PATCH 4/7] Update Doc/library/mmap.rst Co-authored-by: Dong-hee Na --- Doc/library/mmap.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/mmap.rst b/Doc/library/mmap.rst index 897b3034e32ce2..e7eaa165c75280 100644 --- a/Doc/library/mmap.rst +++ b/Doc/library/mmap.rst @@ -358,5 +358,5 @@ MAP_* Constants These are the various flags that can be passed to :meth:`mmap.mmap`. Note that some options might not be present on some systems. - .. versionchanged:: 3.8 + .. versionchanged:: 3.10 Add MAP_POPULATE From fb3dafe66f41bdcaa6814eab0e8ac6a1bb0c5ff7 Mon Sep 17 00:00:00 2001 From: Ethan Steinberg Date: Thu, 21 May 2020 13:52:28 -0700 Subject: [PATCH 5/7] Fix formatting --- Doc/library/mmap.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Doc/library/mmap.rst b/Doc/library/mmap.rst index e7eaa165c75280..14c56e4ef9924a 100644 --- a/Doc/library/mmap.rst +++ b/Doc/library/mmap.rst @@ -81,7 +81,9 @@ 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`. Some systems have additional possible flags with the full list specified in :ref:`MAP_* constants `. + the file. The default value is :const:`MAP_SHARED`. Some systems have + additional possible flags with the full list specified in + :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 @@ -359,4 +361,4 @@ MAP_* Constants These are the various flags that can be passed to :meth:`mmap.mmap`. Note that some options might not be present on some systems. .. versionchanged:: 3.10 - Add MAP_POPULATE + Added MAP_POPULATE constant. From 88817bf16f36506011a2dccb5a13e906bc65f4d0 Mon Sep 17 00:00:00 2001 From: Ethan Steinberg Date: Thu, 21 May 2020 16:47:50 -0700 Subject: [PATCH 6/7] Minor fix --- Doc/library/mmap.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/mmap.rst b/Doc/library/mmap.rst index 14c56e4ef9924a..698c17653786b3 100644 --- a/Doc/library/mmap.rst +++ b/Doc/library/mmap.rst @@ -81,8 +81,8 @@ 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`. Some systems have - additional possible flags with the full list specified in + the file. The default value is :const:`MAP_SHARED`. Some systems have + additional possible flags with the full list specified in :ref:`MAP_* constants `. *prot*, if specified, gives the desired memory protection; the two most From ce19ec4b653c03f63d2630acfb876e3160d09975 Mon Sep 17 00:00:00 2001 From: Ethan Steinberg Date: Fri, 22 May 2020 09:57:22 -0700 Subject: [PATCH 7/7] Update Misc/NEWS.d/next/Library/2020-05-13-16-28-33.bpo-40611.ZCk0_c.rst Co-authored-by: Victor Stinner --- .../next/Library/2020-05-13-16-28-33.bpo-40611.ZCk0_c.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Library/2020-05-13-16-28-33.bpo-40611.ZCk0_c.rst b/Misc/NEWS.d/next/Library/2020-05-13-16-28-33.bpo-40611.ZCk0_c.rst index 930d26d0af6c40..50ef3ad200a5e0 100644 --- a/Misc/NEWS.d/next/Library/2020-05-13-16-28-33.bpo-40611.ZCk0_c.rst +++ b/Misc/NEWS.d/next/Library/2020-05-13-16-28-33.bpo-40611.ZCk0_c.rst @@ -1 +1 @@ -MAP_POPULATE has now been added to the list of exported mmap flags. \ No newline at end of file +:data:`~mmap.MAP_POPULATE` constant has now been added to the list of exported :mod:`mmap` module flags.