diff options
author | Michael Gran <spk121@yahoo.com> | 2022-11-09 13:32:45 -0800 |
---|---|---|
committer | Michael Gran <spk121@yahoo.com> | 2022-11-10 10:33:57 -0800 |
commit | ab0a917ff4478a11fd43aa370ef86db72f383501 (patch) | |
tree | a3e163637ea7c7f721a4a6014a63e7326e3beb33 | |
parent | 9a29293a88bd884a160ba84f06b8323335e0b039 (diff) | |
download | guile-ab0a917ff4478a11fd43aa370ef86db72f383501.tar.gz |
For MinGW, use native signal func in sigaction
For MinGW, there is a native signal function in UCRT. It handles
a limited set of signals.
* libguile/scmsigs.c (scm_sigaction_for_thread)[__MINGW32__]: removed
(scm_sigaction_for_thread)[!__MINGW32__]: use for MinGW as well.
For signals outside UCRT's native signal set, always return SIG_IGN.
-rw-r--r-- | libguile/scmsigs.c | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/libguile/scmsigs.c b/libguile/scmsigs.c index d42af0d61..6a5e1be37 100644 --- a/libguile/scmsigs.c +++ b/libguile/scmsigs.c @@ -306,23 +306,6 @@ scm_sigaction (SCM signum, SCM handler, SCM flags) return scm_sigaction_for_thread (signum, handler, flags, SCM_UNDEFINED); } -#if __MINGW32__ - -SCM_DEFINE (scm_sigaction_for_thread, "sigaction", 1, 3, 0, - (SCM signum, SCM handler, SCM flags, SCM thread), - "sigaction stub") -#define FUNC_NAME s_scm_sigaction_for_thread -{ - (void) signum; - (void) handler; - (void) flags; - (void) thread; - return SCM_UNSPECIFIED; -} -#undef FUNC_NAME - -#else /* !__MINGW32__ */ - /* user interface for installation of signal handlers. */ SCM_DEFINE (scm_sigaction_for_thread, "sigaction", 1, 3, 0, (SCM signum, SCM handler, SCM flags, SCM thread), @@ -362,11 +345,17 @@ SCM_DEFINE (scm_sigaction_for_thread, "sigaction", 1, 3, 0, #endif int query_only = 0; int save_handler = 0; - + SCM old_handler; csig = scm_to_signed_integer (signum, 0, NSIG-1); +#ifdef __MINGW32__ + if (csig != SIGINT && csig != SIGILL && csig != SIGFPE && csig != SIGSEGV + && csig != SIGTERM && csig != SIGBREAK && csig != SIGABRT) + return scm_cons (scm_from_intptr_t ((intptr_t) SIG_IGN), scm_from_int (0)); +#endif + #if defined(HAVE_SIGACTION) action.sa_flags = 0; if (!SCM_UNBNDP (flags)) @@ -518,8 +507,6 @@ SCM_DEFINE (scm_sigaction_for_thread, "sigaction", 1, 3, 0, } #undef FUNC_NAME -#endif /* !__MINGW32__ */ - SCM_DEFINE (scm_restore_signals, "restore-signals", 0, 0, 0, (void), "Return all signal handlers to the values they had before any call to\n" |