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.91 2000/06/23 06:17:58 hubbe Exp $"); + RCSID("$Id: main.c,v 1.92 2000/07/06 00:30:32 hubbe Exp $");   #include "fdlib.h"   #include "backend.h"   #include "module.h"   #include "object.h"   #include "language.h"   #include "lex.h"   #include "pike_types.h"   #include "builtin_functions.h"   #include "array.h"   #include "stralloc.h"
pike.git/src/main.c:26:   #include "gc.h"   #include "multiset.h"   #include "mapping.h"   #include "cpp.h"   #include "main.h"   #include "operators.h"   #include "security.h"   #include "constants.h"   #include "version.h"    + #ifdef HAVE_PTHREAD_INITIAL_THREAD_BOS + #if defined(HAVE_DLOPEN) + #ifdef HAVE_DLFCN_H + #include <dlfcn.h> + #endif + #endif + #endif +    #include "las.h"      #include <errno.h>      #ifdef HAVE_LOCALE_H   #include <locale.h>   #endif      #include "time_stuff.h"   
pike.git/src/main.c:418: Inside #if defined(HAVE_GETRLIMIT) && defined(RLIMIT_STACK)
  #endif      #ifdef Pike_INITIAL_STACK_SIZE    if(lim.rlim_cur > Pike_INITIAL_STACK_SIZE)    lim.rlim_cur=Pike_INITIAL_STACK_SIZE;   #endif       stack_top += STACK_DIRECTION * lim.rlim_cur;      #ifdef HAVE_PTHREAD_INITIAL_THREAD_BOS + #if defined(HAVE_DLOPEN) && defined(HAVE_DLFCN_H) +  /* FIXME: this code should be used on all linux glibc systems +  * even those without __pthread_initial_thread_bos +  * -Hubbe +  */    { -  +  char ** bos_location; +  void *handle; +  if((handle=dlopen(0, RTLD_LAZY))) +  { +  bos_location=dlsym(handle,"__pthread_initial_thread_bos"); +  dlclose(handle); +  +  if(bos_location && *bos_location && +  (*bos_location - stack_top) *STACK_DIRECTION < 0) +  stack_top=*bos_location; +  } +  } + #else +  +  {    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 -  + #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 */