Branch: Tag:

1998-08-10

1998-08-10 23:33:31 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>

stack checks and -ss<thread stack size> implemented

Rev: src/configure.in:1.230
Rev: src/interpret.c:1.94
Rev: src/interpret.h:1.22
Rev: src/main.c:1.57
Rev: src/testsuite.in:1.120
Rev: src/threads.c:1.80
Rev: src/threads.h:1.48

4:   ||| See the files COPYING and DISCLAIMER for more information.   \*/   #include "global.h" - RCSID("$Id: main.c,v 1.56 1998/07/27 21:57:11 hubbe Exp $"); + RCSID("$Id: main.c,v 1.57 1998/08/10 23:33:30 hubbe Exp $");   #include "fdlib.h"   #include "backend.h"   #include "module.h"
194:    exit(1);    }    p=argv[e]; +  }else{ +  p++; +  if(*p=='s') +  { +  if(!p[1]) +  { +  e++; +  if(e >= argc) +  { +  fprintf(stderr,"Missing argument to -ss\n"); +  exit(1);    } -  stack_size=STRTOL(p+1,&p,0); +  p=argv[e]; +  }else{ +  p++; +  } + #ifdef _REENTRANT +  thread_stack_size=STRTOL(p,&p,0); + #endif    p+=strlen(p); -  +  break; +  } +  } +  stack_size=STRTOL(p,&p,0); +  p+=strlen(p);       if(stack_size < 256)    {
215:    exit(1);    }    p=argv[e]; +  }else{ +  p++;    } -  instructions_left=STRTOL(p+1,&p,0); +  instructions_left=STRTOL(p,&p,0);    p+=strlen(p);    add_to_callback(&evaluator_callbacks,    time_to_exit,
299:   #define RLIMIT_NOFILE RLIMIT_OFILE   #endif    + #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; + #endif +  stack_top= ((char *) &argv) + +  STACK_DIRECTION * (lim.rlim_cur - 8192 * sizeof(char *)); +  } +  } + #else +  stack_top= ((char *) &argv) + +  STACK_DIRECTION * (1024*1024 * 128 - 8192 * sizeof(char *)); + #endif +    #if defined(HAVE_SETRLIMIT) && defined(RLIMIT_NOFILE)    {    struct rlimit lim;