mirror of
https://github.com/python/cpython.git
synced 2025-10-21 14:12:27 +00:00
bpo-36648: fix mmap issue for VxWorks (GH-12394)
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.
This commit is contained in:
parent
f2d7ac7e5b
commit
4fb1502189
2 changed files with 8 additions and 0 deletions
|
@ -0,0 +1 @@
|
||||||
|
Fix mmap fail for VxWorks
|
|
@ -1164,6 +1164,13 @@ new_mmap_object(PyTypeObject *type, PyObject *args, PyObject *kwdict)
|
||||||
#ifdef MAP_ANONYMOUS
|
#ifdef MAP_ANONYMOUS
|
||||||
/* BSD way to map anonymous memory */
|
/* BSD way to map anonymous memory */
|
||||||
flags |= MAP_ANONYMOUS;
|
flags |= MAP_ANONYMOUS;
|
||||||
|
|
||||||
|
/* VxWorks only supports MAP_ANONYMOUS with MAP_PRIVATE flag */
|
||||||
|
#ifdef __VXWORKS__
|
||||||
|
flags &= ~MAP_SHARED;
|
||||||
|
flags |= MAP_PRIVATE;
|
||||||
|
#endif
|
||||||
|
|
||||||
#else
|
#else
|
||||||
/* SVR4 method to map anonymous memory is to open /dev/zero */
|
/* SVR4 method to map anonymous memory is to open /dev/zero */
|
||||||
fd = devzero = _Py_open("/dev/zero", O_RDWR);
|
fd = devzero = _Py_open("/dev/zero", O_RDWR);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue