Alexandre Julliard : loader: Set the address space limit before starting the preloader.

Alexandre Julliard julliard at winehq.org
Fri Sep 21 07:23:00 CDT 2007


Module: wine
Branch: master
Commit: 1b8d9e03a9efe9744456e64d6381a2762a22103c
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=1b8d9e03a9efe9744456e64d6381a2762a22103c

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Fri Sep 21 10:43:45 2007 +0200

loader: Set the address space limit before starting the preloader.

---

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

diff --git a/loader/glibc.c b/loader/glibc.c
index f4d2f9c..28a8d19 100644
--- a/loader/glibc.c
+++ b/loader/glibc.c
@@ -27,6 +27,9 @@
 #ifdef HAVE_SYS_MMAN_H
 # include <sys/mman.h>
 #endif
+#ifdef HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
 #ifdef HAVE_UNISTD_H
 # include <unistd.h>
 #endif
@@ -97,6 +100,18 @@ static void check_vmsplit( void *stack )
     }
 }
 
+static void set_max_limit( int limit )
+{
+    struct rlimit rlimit;
+
+    if (!getrlimit( limit, &rlimit ))
+    {
+        rlimit.rlim_cur = rlimit.rlim_max;
+        setrlimit( limit, &rlimit );
+    }
+}
+
+
 /**********************************************************************
  *           main
  */
@@ -108,6 +123,9 @@ int main( int argc, char *argv[] )
 
     wine_init_argv0_path( new_argv0 );
 
+    /* set the address space limit before starting the preloader */
+    set_max_limit( RLIMIT_AS );
+
     if (loader)
     {
         /* update WINELOADER with the new name */




More information about the wine-cvs mailing list