Diff for /gforth/engine/signals.c between versions 1.16 and 1.23

version 1.16, 2002/10/26 12:48:25 version 1.23, 2003/02/01 14:28:07
Line 21 Line 21
 */  */
   
   
 #define _GNU_SOURCE  #include "config.h"
   #include "forth.h"
 #include <stdio.h>  #include <stdio.h>
 #include <setjmp.h>  #include <setjmp.h>
 #include <string.h>  #include <string.h>
Line 31 Line 31
 #include <sys/ioctl.h>  #include <sys/ioctl.h>
 #endif  #endif
 /* #include <asm/signal.h> */  /* #include <asm/signal.h> */
   #include <sys/types.h>
 #include <signal.h>  #include <signal.h>
 #include "config.h"  
 #include "forth.h"  
 #include "io.h"  #include "io.h"
   
   #ifndef HAVE_STACK_T
   /* Darwin uses "struct sigaltstack" instead of "stack_t" */
   typedef struct sigaltstack stack_t;
   #endif
   
 #define DEFAULTCOLS 80  #define DEFAULTCOLS 80
 #if defined(MSDOS) || defined (_WIN32)  #if defined(MSDOS) || defined (_WIN32)
Line 52  UCell rows=DEFAULTROWS; Line 55  UCell rows=DEFAULTROWS;
 /* systems that don't have SA_NODEFER hopefully don't block anyway */  /* systems that don't have SA_NODEFER hopefully don't block anyway */
 #endif  #endif
   
   #ifndef SA_ONSTACK
   #define SA_ONSTACK 0
   #endif
   
 #ifdef SA_SIGINFO  #ifdef SA_SIGINFO
 void install_signal_handler(int sig, void (*handler)(int, siginfo_t *, void *))  void install_signal_handler(int sig, void (*handler)(int, siginfo_t *, void *))
      /* installs three-argument signal handler for sig */       /* installs three-argument signal handler for sig */
Line 73  Sigfunc *bsd_signal(int signo, Sigfunc * Line 80  Sigfunc *bsd_signal(int signo, Sigfunc *
   
   act.sa_handler=func;    act.sa_handler=func;
   sigemptyset(&act.sa_mask);    sigemptyset(&act.sa_mask);
   act.sa_flags=SA_NODEFER|SA_ONSTACK;    act.sa_flags=SA_NODEFER; /* SA_ONSTACK does not work for graceful_exit */
   if (sigaction(signo,&act,&oact) < 0)    if (sigaction(signo,&act,&oact) < 0)
     return SIG_ERR;      return SIG_ERR;
   else    else
Line 362  void install_signal_handlers(void) Line 369  void install_signal_handlers(void)
   };    };
   int i;    int i;
   void (*throw_handler)() = die_on_signal ? graceful_exit : signal_throw;    void (*throw_handler)() = die_on_signal ? graceful_exit : signal_throw;
   #ifdef SIGSTKSZ 
   stack_t sigstack;    stack_t sigstack;
   int sas_retval=-1;    int sas_retval=-1;
   
   sigstack.ss_size=SIGSTKSZ;    sigstack.ss_size=SIGSTKSZ;
   if ((sigstack.ss_sp = my_alloc(sigstack.ss_size)) != NULL) {    /* Actually the stack should only be ss_size large, and according to
        SUSv2 ss_sp should point to the start of the stack, but
        unfortunately Irix 6.5 (at least) expects ss_sp to point to the
        end, so we work around this issue by accomodating everyone. */
     if ((sigstack.ss_sp = my_alloc(sigstack.ss_size*2)) != NULL) {
       sigstack.ss_sp += sigstack.ss_size;
     sigstack.ss_flags=0;      sigstack.ss_flags=0;
     sas_retval=sigaltstack(&sigstack,(stack_t *)0);      sas_retval=sigaltstack(&sigstack,(stack_t *)0);
   }    }
   if (debug)    if (debug)
     fprintf(stderr,"sigaltstack: %s\n",strerror(sas_retval));      fprintf(stderr,"sigaltstack: %s\n",strerror(sas_retval));
   #endif
   
 #define DIM(X)          (sizeof (X) / sizeof *(X))  #define DIM(X)          (sizeof (X) / sizeof *(X))
 /*  /*

Removed from v.1.16  
changed lines
  Added in v.1.23


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>