Commit 96d6724e authored by Alexandre Julliard's avatar Alexandre Julliard

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

parent f5f37a85
...@@ -31,6 +31,9 @@ ...@@ -31,6 +31,9 @@
#ifdef HAVE_SYS_MMAN_H #ifdef HAVE_SYS_MMAN_H
#include <sys/mman.h> #include <sys/mman.h>
#endif #endif
#ifdef HAVE_SYS_RESOURCE_H
# include <sys/resource.h>
#endif
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
# include <unistd.h> # include <unistd.h>
#endif #endif
...@@ -599,6 +602,23 @@ int wine_dll_get_owner( const char *name, char *buffer, int size, int *exists ) ...@@ -599,6 +602,23 @@ int wine_dll_get_owner( const char *name, char *buffer, int size, int *exists )
/*********************************************************************** /***********************************************************************
* 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 * wine_init
* *
* Main Wine initialisation. * Main Wine initialisation.
...@@ -610,6 +630,10 @@ void wine_init( int argc, char *argv[], char *error, int error_size ) ...@@ -610,6 +630,10 @@ void wine_init( int argc, char *argv[], char *error, int error_size )
void *ntdll = NULL; void *ntdll = NULL;
void (*init_func)(void); 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] ); wine_init_argv0_path( argv[0] );
build_dll_path(); build_dll_path();
__wine_main_argc = argc; __wine_main_argc = argc;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment