The Wayback Machine - https://web.archive.org/web/20221223141816/https://github.com/python/cpython/pull/12394
Skip to content
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

bpo-36648: fix mmap issue for VxWorks #12394

Merged
merged 3 commits into from May 21, 2019

Conversation

LihuaZhao
Copy link
Contributor

@LihuaZhao LihuaZhao commented Mar 18, 2019

The mmap module set MAP_SHARED flag when map anonymous memory, however VxWorks only support MAP_PRIVATE when map anonymous memory, this commit clear MAP_SHARED and set MAP_PRIVATE, after doing this, all of anonymous memory related test run pass on VxWorks.

https://bugs.python.org/issue36648

LihuaZhao added 2 commits Mar 18, 2019
The mmap module set MAP_SHARED flag when map anonymous memory, however VxWorks
only support MAP_PRIVATE when map anonymous memory, this commit clear MAP_SHARED
and set MAP_PRIVATE.
@vstinner
Copy link
Member

vstinner commented Mar 26, 2019

Please open a separated bpo issue to explain what is the current behavior, what is the expected behavior, etc. Maybe mmap.mmap should raise a NotImplementedError if requested flags are no supported?

@JimJJewett
Copy link

JimJJewett commented Mar 26, 2019

Is there a platform notes or something that discusses these limits? Or should a change be made to the main documents, saying that shared doesn't work on VxWorks? (Or more generally, not all flags are meaningful on all platforms, with this as an explicit example.)

Other than that, I would say it is good.

@LihuaZhao
Copy link
Contributor Author

LihuaZhao commented Mar 27, 2019

Thanks for your comment, However, anonymous mappings is not part of the POSIX standard, python user just need to specified -1 as fd value when do anonymous map, for example:

m = mmap.mmap(-1, 100)

then python adapter module (the file that I changed) try to specify MAP_SHARED or MAP_PRIVATE based on operate system requirement, Linux require MAP_SHARED, VxWorks require MAP_PRIVATE, this different is hidden by this module, and python user won't be affected.

This change doesn't change the behavior of other platforms, also belong to adapt python to VxWorks, so I think we don't need a new bpo.

VxWorks will run pass all of test_mmap.py case related with anonymous map, so we don't need to document for python user, and I also check the mmap.rst, there isn't document to introduce how operation support them, so I think we don't need to document it.

https://en.wikipedia.org/wiki/Mmap

@vstinner
Copy link
Member

vstinner commented Apr 17, 2019

@LihuaZhao can you please open a new issue on bugs.python.org as I requested in a previous comment?

@LihuaZhao LihuaZhao changed the title bpo-31904: fix mmap issue for VxWorks bpo-36648: fix mmap issue for VxWorks Apr 17, 2019
@LihuaZhao
Copy link
Contributor Author

LihuaZhao commented Apr 17, 2019

I have created new bpo: https://bugs.python.org/issue36648, I am not sure whether I could go on use this PR, I just update this PR title and link this PR to the new created bpo.

The changes is transparent for PYthon user, only change the flag from MAP_SHARED to MAP_PRIVATE when do anonymous mappings on VxWorks.

And this behavior is not part of the POSIX standard, depended OS specified implementation, For PYthon user, it won't feel different, so I think we don't need to document.

Thanks.
Lihua

@LihuaZhao LihuaZhao closed this Apr 18, 2019
@LihuaZhao LihuaZhao reopened this Apr 18, 2019
@vstinner vstinner merged commit 4fb1502 into python:master May 21, 2019
@pxinwr pxinwr deleted the fix-vxworks-mmap-issue branch Jul 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.