From 1b8d9e03a9efe9744456e64d6381a2762a22103c Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Fri, 21 Sep 2007 10:43:45 +0200 Subject: [PATCH] loader: Set the address space limit before starting the preloader. --- loader/glibc.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/loader/glibc.c b/loader/glibc.c index f4d2f9cfac4..28a8d193d4a 100644 --- a/loader/glibc.c +++ b/loader/glibc.c @@ -27,6 +27,9 @@ #ifdef HAVE_SYS_MMAN_H # include #endif +#ifdef HAVE_SYS_RESOURCE_H +# include +#endif #ifdef HAVE_UNISTD_H # include #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 */