From: Chris Hanson Date: Sat, 22 Jun 1991 19:29:11 +0000 (+0000) Subject: Change `abort_to_interpreter' and `exit_interruptable_extent' to X-Git-Tag: 20090517-FFI~10501 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=7c17556f5db6a2d740d16d8d9893d781509121d4;p=mit-scheme.git Change `abort_to_interpreter' and `exit_interruptable_extent' to restore the signal mask. This should have been done using `sigsetjmp' and `siglongjmp', but a bug in Sony NEWS OS generates a segmentation violation when those functions are used this way. The chosen solution works, and is slightly more portable. --- diff --git a/v7/src/microcode/interp.c b/v7/src/microcode/interp.c index 25e1c8676..8a98ac9d9 100644 --- a/v7/src/microcode/interp.c +++ b/v7/src/microcode/interp.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/interp.c,v 9.61 1991/03/01 00:54:42 cph Exp $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/interp.c,v 9.62 1991/06/22 19:28:54 cph Exp $ Copyright (c) 1988-91 Massachusetts Institute of Technology @@ -49,6 +49,7 @@ extern PTR EXFUN (obstack_chunk_alloc, (unsigned int size)); extern void EXFUN (free, (PTR ptr)); #define obstack_chunk_free free extern void EXFUN (back_out_of_primitive_internal, (void)); +extern void EXFUN (preserve_signal_mask, (void)); /* In order to make the interpreter tail recursive (i.e. * to avoid calling procedures and thus saving unnecessary @@ -440,6 +441,7 @@ Interpret(dumped_p) */ interpreter_catch_dstack_position = dstack_position; + preserve_signal_mask (); Which_Way = (setjmp (interpreter_catch_env)); Set_Time_Zone (Zone_Working); Import_Registers (); diff --git a/v7/src/microcode/intext.c b/v7/src/microcode/intext.c index 38b7c578b..e4fc9c11f 100644 --- a/v7/src/microcode/intext.c +++ b/v7/src/microcode/intext.c @@ -1,8 +1,8 @@ /* -*-C-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/intext.c,v 1.1 1990/06/20 19:35:50 cph Rel $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/intext.c,v 1.2 1991/06/22 19:29:02 cph Exp $ -Copyright (c) 1990 Massachusetts Institute of Technology +Copyright (c) 1990-91 Massachusetts Institute of Technology This material was developed by the Scheme project at the Massachusetts Institute of Technology, Department of Electrical Engineering and @@ -36,6 +36,8 @@ MIT in each case. */ #include "dstack.h" #include "intext.h" +extern void EXFUN (preserve_signal_mask, (void)); + struct interruptable_extent * current_interruptable_extent; void @@ -61,6 +63,7 @@ DEFUN_VOID (enter_interruptable_extent) /* Create a dynamic binding frame but don't assign the new frame to it until the CATCH has been done. */ dstack_bind ((¤t_interruptable_extent), current_interruptable_extent); + preserve_signal_mask (); return (frame); } diff --git a/v7/src/microcode/uxsig.c b/v7/src/microcode/uxsig.c index 55d848bb2..70ca3f648 100644 --- a/v7/src/microcode/uxsig.c +++ b/v7/src/microcode/uxsig.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/uxsig.c,v 1.9 1991/06/15 00:40:41 cph Exp $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/uxsig.c,v 1.10 1991/06/22 19:29:05 cph Exp $ Copyright (c) 1990-91 Massachusetts Institute of Technology @@ -109,6 +109,31 @@ DEFUN (current_handler, (signo), int signo) #endif /* HAVE_SYSV3_SIGNALS */ #endif /* HAVE_POSIX_SIGNALS */ +#ifdef HAVE_POSIX_SIGNALS + +static void +DEFUN (restore_signal_mask, (environment), PTR environment) +{ + UX_sigprocmask (SIG_SETMASK, ((sigset_t *) environment), 0); +} + +void +DEFUN_VOID (preserve_signal_mask) +{ + sigset_t * outside = (dstack_alloc (sizeof (sigset_t))); + UX_sigprocmask (SIG_SETMASK, 0, outside); + dstack_protect (restore_signal_mask, outside); +} + +#else /* not HAVE_POSIX_SIGNALS */ + +void +DEFUN_VOID (preserve_signal_mask) +{ +} + +#endif /* not HAVE_POSIX_SIGNALS */ + /* Signal Descriptors */ enum dfl_action { dfl_terminate, dfl_ignore, dfl_stop }; diff --git a/v7/src/microcode/version.h b/v7/src/microcode/version.h index 6bf3bd89d..ca6714d6d 100644 --- a/v7/src/microcode/version.h +++ b/v7/src/microcode/version.h @@ -1,6 +1,6 @@ /* -*-C-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/version.h,v 11.83 1991/06/14 23:36:05 cph Exp $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/version.h,v 11.84 1991/06/22 19:29:11 cph Exp $ Copyright (c) 1988-91 Massachusetts Institute of Technology @@ -46,5 +46,5 @@ MIT in each case. */ #define VERSION 11 #endif #ifndef SUBVERSION -#define SUBVERSION 83 +#define SUBVERSION 84 #endif diff --git a/v8/src/microcode/interp.c b/v8/src/microcode/interp.c index 4eadb2c91..ce2f202e6 100644 --- a/v8/src/microcode/interp.c +++ b/v8/src/microcode/interp.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/interp.c,v 9.61 1991/03/01 00:54:42 cph Exp $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/interp.c,v 9.62 1991/06/22 19:28:54 cph Exp $ Copyright (c) 1988-91 Massachusetts Institute of Technology @@ -49,6 +49,7 @@ extern PTR EXFUN (obstack_chunk_alloc, (unsigned int size)); extern void EXFUN (free, (PTR ptr)); #define obstack_chunk_free free extern void EXFUN (back_out_of_primitive_internal, (void)); +extern void EXFUN (preserve_signal_mask, (void)); /* In order to make the interpreter tail recursive (i.e. * to avoid calling procedures and thus saving unnecessary @@ -440,6 +441,7 @@ Interpret(dumped_p) */ interpreter_catch_dstack_position = dstack_position; + preserve_signal_mask (); Which_Way = (setjmp (interpreter_catch_env)); Set_Time_Zone (Zone_Working); Import_Registers (); diff --git a/v8/src/microcode/version.h b/v8/src/microcode/version.h index 520e0cd4f..57d348aaa 100644 --- a/v8/src/microcode/version.h +++ b/v8/src/microcode/version.h @@ -1,6 +1,6 @@ /* -*-C-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/version.h,v 11.83 1991/06/14 23:36:05 cph Exp $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/version.h,v 11.84 1991/06/22 19:29:11 cph Exp $ Copyright (c) 1988-91 Massachusetts Institute of Technology @@ -46,5 +46,5 @@ MIT in each case. */ #define VERSION 11 #endif #ifndef SUBVERSION -#define SUBVERSION 83 +#define SUBVERSION 84 #endif