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

This commit is contained in:
Alexandre Julliard 2007-09-21 10:43:45 +02:00
parent 5874b854ee
commit 1b8d9e03a9
1 changed files with 18 additions and 0 deletions

View File

@ -27,6 +27,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
@ -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 * main
*/ */
@ -108,6 +123,9 @@ int main( int argc, char *argv[] )
wine_init_argv0_path( new_argv0 ); wine_init_argv0_path( new_argv0 );
/* set the address space limit before starting the preloader */
set_max_limit( RLIMIT_AS );
if (loader) if (loader)
{ {
/* update WINELOADER with the new name */ /* update WINELOADER with the new name */