Index: mmap.c
===================================================================
RCS file: /home/wine/wine/libs/wine/mmap.c,v
retrieving revision 1.10
diff -u -3 -p -r1.10 mmap.c
--- mmap.c	20 Jun 2005 11:43:47 -0000	1.10
+++ mmap.c	14 Oct 2005 16:40:53 -0000
@@ -58,6 +58,31 @@ static const int granularity_mask = 0xff
 static inline int munmap( void *ptr, size_t size ) { return 0; }
 #endif
 
+/* This function returns the address that mmap should use for any
+ * allocation where start is passed as NULL. */
+void *__memory_layout_override = NULL;
+static void *get_anon_mmap_null_address(size_t size)
+{
+    static int got_override = 0;
+    static void *low_alloc_ptr = NULL;
+    void * current_low_alloc_ptr;
+
+    if (!got_override)
+    {
+        //if (__memory_layout_override)
+	{
+            low_alloc_ptr = (void *)0x10000000;
+            got_override = 1;
+        }
+    }
+
+    current_low_alloc_ptr = low_alloc_ptr;
+
+    if (low_alloc_ptr)
+        low_alloc_ptr += size;
+    
+    return current_low_alloc_ptr;
+}
 
 #if (defined(__svr4__) || defined(__NetBSD__)) && !defined(MAP_TRYFIXED)
 /***********************************************************************
@@ -209,13 +234,27 @@ void *wine_anon_mmap( void *start, size_
             return start;
 #endif
     }
-    return mmap( start, size, prot, flags, fdzero, 0 );
+#include <wine/debug.h>
+WINE_DEFAULT_DEBUG_CHANNEL(module);
+    if ((start == NULL) && !(flags & MAP_FIXED)) {
+       MESSAGE("set ");
+       flags |= MAP_FIXED;
+       start = get_anon_mmap_null_address(size);
+    } else {
+       MESSAGE("nil ");
+    }
+    void *result = mmap( start, size, prot, flags, fdzero, 0 );
+
+MESSAGE("mmap %p, %i, %i, %i, %i = %p \n", \
+        start, size, prot , \
+        flags, fdzero, result);
+
+    return result;
 #else
     return (void *)-1;
 #endif
 }
 
-
 #ifdef HAVE_MMAP
 
 /***********************************************************************

