10000 bpo-40611: Adds MAP_POPULATE to the mmap library by EthanSteinberg · Pull Request #20061 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-40611: Adds MAP_POPULATE to the mmap library #20061

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
May 26, 2020
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion Doc/library/mmap.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <map-constants>`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usually, the doc fits into 80 columns.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops. Fixed!


*prot*, if specified, gives the desired memory protection; the two most
useful values are :const:`PROT_READ` and :const:`PROT_WRITE`, to specify
Expand Down Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it correctly rendered? Maybe fix the indentation. I also suggest to add a final "." to your sentence :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops. I just fixed this (and changed to past tense to better match other change notices).

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MAP_POPULATE has now been added to the list of exported mmap flags.
3 changes: 3 additions & 0 deletions Modules/mmapmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down
0