Alexandre Julliard : libwine: Attempt to increase some user limits that are set too low on some platforms .

Alexandre Julliard julliard at wine.codeweavers.com
Tue Jun 27 15:49:08 CDT 2006


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Jun 27 17:35:46 2006 +0200

libwine: Attempt to increase some user limits that are set too low on some platforms.

---

 libs/wine/loader.c |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/libs/wine/loader.c b/libs/wine/loader.c
index 5f82c00..adbadd5 100644
--- a/libs/wine/loader.c
+++ b/libs/wine/loader.c
@@ -31,6 +31,9 @@ #include <sys/types.h>
 #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
@@ -599,6 +602,23 @@ int wine_dll_get_owner( const char *name
 
 
 /***********************************************************************
+ *           set_max_limit
+ *
+ * Set a user limit to the maximum allowed value.
+ */
+static void set_max_limit( int limit )
+{
+    struct rlimit rlimit;
+
+    if (!getrlimit( limit, &rlimit ))
+    {
+        rlimit.rlim_cur = rlimit.rlim_max;
+        setrlimit( limit, &rlimit );
+    }
+}
+
+
+/***********************************************************************
  *           wine_init
  *
  * Main Wine initialisation.
@@ -610,6 +630,10 @@ void wine_init( int argc, char *argv[], 
     void *ntdll = NULL;
     void (*init_func)(void);
 
+    /* force a few limits that are set too low on some platforms */
+    set_max_limit( RLIMIT_NOFILE );
+    set_max_limit( RLIMIT_AS );
+
     wine_init_argv0_path( argv[0] );
     build_dll_path();
     __wine_main_argc = argc;




More information about the wine-cvs mailing list