1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 03:40:34 +02:00

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.
This commit is contained in:
Michael Gran 2022-11-09 13:32:45 -08:00
parent 70f434111b
commit afda13e4ac

View file

@ -419,23 +419,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),
@ -480,6 +463,12 @@ SCM_DEFINE (scm_sigaction_for_thread, "sigaction", 1, 3, 0,
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))
@ -635,8 +624,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"