guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] 19/25: For MinGW, use native signal func in sigaction


From: Mike Gran
Subject: [Guile-commits] 19/25: For MinGW, use native signal func in sigaction
Date: Thu, 10 Nov 2022 18:06:18 -0500 (EST)

mike121 pushed a commit to branch wip-mingw
in repository guile.

commit ab0a917ff4478a11fd43aa370ef86db72f383501
Author: Michael Gran <spk121@yahoo.com>
AuthorDate: Wed Nov 9 13:32:45 2022 -0800

    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.
---
 libguile/scmsigs.c | 27 +++++++--------------------
 1 file 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"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]