Thanks for all that work. I installed the patch you suggested, along with the attached followup which cleans up the SIGTSTP business a little.
From f7e94f96f1988d344563eba220f5a80e0fc44cf8 Mon Sep 17 00:00:00 2001
From: Paul Eggert <egg...@cs.ucla.edu>
Date: Tue, 25 Jul 2023 10:51:02 -0700
Subject: [PATCH] diff: simplify SIGSTOP/SIGTSTP porting

* src/util.c (SIGSTOP, SIGTSTP): Default to 0.
(process_signals, is_tstp_index): Simplify by using the default.
(sig): Adjust to default.
---
 src/util.c | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/src/util.c b/src/util.c
index b9a0f59..ea4a2b8 100644
--- a/src/util.c
+++ b/src/util.c
@@ -43,6 +43,12 @@
 #ifndef SA_RESTART
 # define SA_RESTART 0
 #endif
+#ifndef SIGSTOP
+# define SIGSTOP 0
+#endif
+#ifndef SIGTSTP
+# define SIGTSTP 0
+#endif
 
 char const pr_program[] = PR_PROGRAM;
 
@@ -266,9 +272,7 @@ process_signals (void)
 
       /* Reload stop_signal_count and (if needed) interrupt_signal, in
 	 case a new signal was handled before sigprocmask took effect.  */
-      int sig;
-#ifdef SIGTSTP
-      int stops = stop_signal_count;
+      int stops = stop_signal_count, sig;
 
       /* SIGTSTP is special, since the application can receive that signal
          more than once.  In this case, don't set the signal handler to the
@@ -279,7 +283,6 @@ process_signals (void)
           sig = SIGSTOP;
         }
       else
-#endif
 	{
 	  sig = interrupt_signal;
 	  xsignal (sig, SIG_DFL);
@@ -299,7 +302,7 @@ process_signals (void)
    and which of them are actually caught.  */
 static int const sig[] =
   {
-#ifdef SIGTSTP
+#if SIGTSTP
     /* This one is handled specially; see is_tstp_index.  */
     SIGTSTP,
 #endif
@@ -341,11 +344,7 @@ enum { nsigs = sizeof (sig) / sizeof *(sig) };
 static bool
 is_tstp_index (int j)
 {
-#ifdef SIGTSTP
-  return j == 0;
-#else
-  return false;
-#endif
+  return SIGTSTP && j == 0;
 }
 
 static void
-- 
2.39.2

Reply via email to