diff options
author | Lihua Zhao <44661095+LihuaZhao@users.noreply.github.com> | 2019-05-21 10:50:14 (GMT) |
---|---|---|
committer | Victor Stinner <vstinner@redhat.com> | 2019-05-21 10:50:14 (GMT) |
commit | 4fb15021890d327023aefd95f5a84ac33b037d19 (patch) | |
tree | dd9a33b6025d64f176cff3823c9555ffa9e58af0 /Modules | |
parent | f2d7ac7e5bd821e29e0fcb78a760a282059ae000 (diff) | |
download | cpython-4fb15021890d327023aefd95f5a84ac33b037d19.zip cpython-4fb15021890d327023aefd95f5a84ac33b037d19.tar.gz cpython-4fb15021890d327023aefd95f5a84ac33b037d19.tar.bz2 |
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.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/mmapmodule.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c index 33366b2..917c636 100644 --- a/Modules/mmapmodule.c +++ b/Modules/mmapmodule.c @@ -1164,6 +1164,13 @@ new_mmap_object(PyTypeObject *type, PyObject *args, PyObject *kwdict) #ifdef MAP_ANONYMOUS /* BSD way to map anonymous memory */ flags |= MAP_ANONYMOUS; + + /* VxWorks only supports MAP_ANONYMOUS with MAP_PRIVATE flag */ +#ifdef __VXWORKS__ + flags &= ~MAP_SHARED; + flags |= MAP_PRIVATE; +#endif + #else /* SVR4 method to map anonymous memory is to open /dev/zero */ fd = devzero = _Py_open("/dev/zero", O_RDWR); |