Skip to content

bpo-36648: fix mmap issue for VxWorks#12394

Merged
vstinner merged 3 commits intopython:masterfrom
Wind-River:fix-vxworks-mmap-issue
May 21, 2019
Merged

bpo-36648: fix mmap issue for VxWorks#12394
vstinner merged 3 commits intopython:masterfrom
Wind-River:fix-vxworks-mmap-issue

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

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

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

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

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

@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

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 July 12, 2021 09:42
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.

5 participants