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
# 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 */