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

This commit is contained in:
Alexandre Julliard 2006-06-27 17:35:46 +02:00
parent f5f37a8566
commit 96d6724eaf
1 changed files with 24 additions and 0 deletions

View File

@ -31,6 +31,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
@ -598,6 +601,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
*
@ -610,6 +630,10 @@ void wine_init( int argc, char *argv[], char *error, int error_size )
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;