pike.git / src / main.c

version» Context lines:

pike.git/src/main.c:1:   /*\   ||| This file a part of Pike, and is copyright by Fredrik Hubinette   ||| Pike is distributed as GPL (General Public License)   ||| See the files COPYING and DISCLAIMER for more information.   \*/   #include "global.h" - RCSID("$Id: main.c,v 1.60 1998/11/22 11:03:01 hubbe Exp $"); + RCSID("$Id: main.c,v 1.61 1999/05/12 05:24:44 hubbe Exp $");   #include "fdlib.h"   #include "backend.h"   #include "module.h"   #include "object.h"   #include "lex.h"   #include "pike_types.h"   #include "builtin_functions.h"   #include "array.h"   #include "stralloc.h"   #include "interpret.h"
pike.git/src/main.c:341:    stack_top -= ( ((unsigned long)stack_top)) & 0xffff;   #endif /* STACK_DIRECTION < 0 */      #if defined(HAVE_GETRLIMIT) && defined(RLIMIT_STACK)    {    struct rlimit lim;    if(!getrlimit(RLIMIT_STACK, &lim))    {   #ifdef RLIM_INFINITY    if(lim.rlim_cur == RLIM_INFINITY) -  lim.rlim_cur=1024*1024*128; +  lim.rlim_cur=1024*1024*32;   #endif -  stack_top += STACK_DIRECTION * (lim.rlim_cur - 8192 * sizeof(char *)); +  stack_top += STACK_DIRECTION * lim.rlim_cur;    -  + #ifdef HAVE_PTHREAD_INITIAL_THREAD_BOS +  { +  extern char * __pthread_initial_thread_bos; +  /* Linux glibc threads are limited to a 4 Mb stack +  * __pthread_initial_thread_bos is the actual limit +  */ +  +  if(__pthread_initial_thread_bos && +  (__pthread_initial_thread_bos - stack_top) *STACK_DIRECTION < 0) +  stack_top=__pthread_initial_thread_bos; +  } + #endif +  stack_top -= STACK_DIRECTION * 8192 * sizeof(char *); +    #ifdef STACK_DEBUG    fprintf(stderr, "1: C-stack: 0x%08p - 0x%08p, direction:%d\n",    &argv, stack_top, STACK_DIRECTION);   #endif /* STACK_DEBUG */    }    }   #else /* !HAVE_GETRLIMIT || !RLIMIT_STACK */    /* 128 MB seems a bit extreme, most OS's seem to have their limit at ~8MB */    stack_top += STACK_DIRECTION * (1024*1024 * 8 - 8192 * sizeof(char *));   #ifdef STACK_DEBUG