Alexandre Julliard : loader: Attempt to detect broken vmsplit setups.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Apr 19 13:15:18 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: 6f38489f917f9f1385f3c4244d28d7ee23148eba
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=6f38489f917f9f1385f3c4244d28d7ee23148eba

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Apr 19 19:28:33 2006 +0200

loader: Attempt to detect broken vmsplit setups.

---

 loader/glibc.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/loader/glibc.c b/loader/glibc.c
index 4d15d5c..9aae1c1 100644
--- a/loader/glibc.c
+++ b/loader/glibc.c
@@ -21,8 +21,12 @@
 #include "config.h"
 #include "wine/port.h"
 
+#include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
+#ifdef HAVE_SYS_MMAN_H
+# include <sys/mman.h>
+#endif
 #ifdef HAVE_UNISTD_H
 # include <unistd.h>
 #endif
@@ -81,6 +85,18 @@ static const char *build_new_path( const
     return ret;
 }
 
+static void check_vmsplit( void *stack )
+{
+    if (stack < (void *)0x80000000)
+    {
+        /* if the stack is below 0x80000000, assume we can safely try a munmap there */
+        if (munmap( (void *)0x80000000, 1 ) == -1 && errno == EINVAL)
+            fprintf( stderr,
+                     "Warning: memory above 0x80000000 doesn't seem to be accessible.\n"
+                     "Wine requires a 3G/1G user/kernel memory split to work properly.\n" );
+    }
+}
+
 /**********************************************************************
  *           main
  */
@@ -103,6 +119,7 @@ int main( int argc, char *argv[] )
         loader = new_name;
     }
 
+    check_vmsplit( &argc );
     wine_exec_wine_binary( NULL, argv, loader );
     fprintf( stderr, "wine: could not exec %s\n", threads );
     exit(1);




More information about the wine-cvs mailing list