Skip to content

bpo-37471: mmap module adding FreeBSD specific flag into the constants #14513

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

Closed
wants to merge 6 commits into from
Closed

bpo-37471: mmap module adding FreeBSD specific flag into the constants #14513

wants to merge 6 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Jul 1, 2019

@ghost ghost changed the title mmap module adding FreeBSD specific flag into the constants 37471: mmap module adding FreeBSD specific flag into the constants Jul 1, 2019
@ghost ghost changed the title 37471: mmap module adding FreeBSD specific flag into the constants bpo-37471: mmap module adding FreeBSD specific flag into the constants Jul 1, 2019
Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

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

Would it be possible to document the constant in https://docs.python.org/dev/library/mmap.html ?

It seems like other MAP_xxx constants are not documented yet and so should be documented as well.

@ghost
Copy link
Author

ghost commented Jul 1, 2019

They are (shortly) in the flags section. Ok for adding the new constant too.

@vstinner
Copy link
Member

vstinner commented Jul 1, 2019

The minimum doc should be a list of constants, like: https://docs.python.org/dev/library/os.html#os.O_RDONLY

@ghost
Copy link
Author

ghost commented Jul 1, 2019

Fair enough ! ought to be before madvise's I think.

@@ -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) allows to map to
pages of 2MB (x86) or so, it is enabled by default, at boot time,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
pages of 2MB (x86) or so, it is enabled by default, at boot time,
pages of 2 MiB (x86) or so, it is enabled by default, at boot time,

Is it x86 (32-bit) or x86-64 (64-bit)?

Copy link
Author

Choose a reason for hiding this comment

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

both.

Copy link
Member

Choose a reason for hiding this comment

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

Write maybe (x86, x86-64) in this case... But I'm not sure if Python documentation should go too far in the description, since FreeBSD may decide to add support for MAP_ALIGNED_SUPER for other platforms.

Copy link
Author

Choose a reason for hiding this comment

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

It supports more than x86 already in fact but you re right I ll try to find more concise wording

@@ -0,0 +1 @@
Adding new 'MAP_ALIGNED_SUPER' FreeBSD constant.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Adding new 'MAP_ALIGNED_SUPER' FreeBSD constant.
Adding new :data:`mmap.MAP_ALIGNED_SUPER` FreeBSD constant.

MAP_PRIVATE
MAP_DENYWRITE
MAP_EXECUTABLE
MAP_ALIGNED_SUPER
Copy link
Member

Choose a reason for hiding this comment

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

You have to document that MAP_ALIGNED_SUPER is new, example:

.. versionadded:: 3.9
   Add :data:`MAP_ALIGNED_SUPER` constant.

the file. :const:`MAP_ALIGNED_SUPER` (FreeBSD only) allows to map to
pages of 2MB (x86) or so, it is enabled by default, at boot time,
in most of architectures and exists since 2008.
:ref:`MAP_* constants <mmap-constants>`.
Copy link
Member

Choose a reason for hiding this comment

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

"MAP_* constants" is not really a sentence. Maybe move it after the default, and write something like:

The default value is :const:`MAP_SHARED`. 
See :ref:`MAP_* constants <mmap-constants>`.

@@ -341,3 +359,6 @@ MADV_* Constants
Availability: Systems with the madvise() system call.

.. versionadded:: 3.8

.. versionadded:: 3.9
Add :data:`MAP_ALIGNED_SUPER` constant.
Copy link
Member

Choose a reason for hiding this comment

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

Can you move this to the your new MAP_* Constants section?

@@ -0,0 +1 @@
Adding new :data:`mmap.MAP_CONCEAL` OpenBSD constant.
Copy link
Member

Choose a reason for hiding this comment

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

Can you try to merge the 2 changelog entries? Put content of the 2nd entry in the first one, remove the second file.

MAP_DENYWRITE
MAP_EXECUTABLE
MAP_ALIGNED_SUPER
MAP_CONCEAL
Copy link
Member

Choose a reason for hiding this comment

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

You have to document that MAP_CONCEAL is new.

the file. The default value is :const:`MAP_SHARED`.
the file. :const:`MAP_ALIGNED_SUPER` (FreeBSD only) to use
super pages feature, enabled by default in most of architectures
and exists since 2008.
Copy link
Member

Choose a reason for hiding this comment

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

I don't understand this sentence :-/ I suggest:

:const:`MAP_ALIGNED_SUPER` (FreeBSD only) uses super pages feature,
it is enabled by default in most of architectures and exists since 2008.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants