[pypy-svn] r76542 - pypy/trunk/pypy/rlib

arigo at codespeak.net arigo at codespeak.net
Mon Aug 9 13:20:15 CEST 2010


Author: arigo
Date: Mon Aug  9 13:20:12 2010
New Revision: 76542

Modified:
   pypy/trunk/pypy/rlib/rmmap.py
Log:
Reported by mvt: some systems (some versions of OS/X?)
complain if they are passed a non-zero address as the
first argument to mmap().


Modified: pypy/trunk/pypy/rlib/rmmap.py
==============================================================================
--- pypy/trunk/pypy/rlib/rmmap.py	(original)
+++ pypy/trunk/pypy/rlib/rmmap.py	Mon Aug  9 13:20:12 2010
@@ -646,8 +646,14 @@
         hintp = rffi.cast(PTR, hint.pos)
         res = c_mmap_safe(hintp, map_size, prot, flags, -1, 0)
         if res == rffi.cast(PTR, -1):
-            raise MemoryError
-        hint.pos += map_size
+            # some systems (some versions of OS/X?) complain if they
+            # are passed a non-zero address.  Try again.
+            hintp = rffi.cast(PTR, 0)
+            res = c_mmap_safe(hintp, map_size, prot, flags, -1, 0)
+            if res == rffi.cast(PTR, -1):
+                raise MemoryError
+        else:
+            hint.pos += map_size
         return res
     alloc._annenforceargs_ = (int,)
 



More information about the Pypy-commit mailing list