The branch stable/14 has been updated by kib:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=e76807eb2360f56a823569b9b751ee574e24aceb

commit e76807eb2360f56a823569b9b751ee574e24aceb
Author:     Aaron LI <a...@aaronly.me>
AuthorDate: 2025-04-02 16:01:17 +0000
Commit:     Konstantin Belousov <k...@freebsd.org>
CommitDate: 2025-06-16 08:51:52 +0000

    timeout(1): Also send SIGCONT because the child may be stopped
    
    (cherry picked from commit 06c74693c286185f299410afcd312fc54a96a052)
---
 bin/timeout/timeout.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/bin/timeout/timeout.c b/bin/timeout/timeout.c
index 8f933f509407..e702803a25c2 100644
--- a/bin/timeout/timeout.c
+++ b/bin/timeout/timeout.c
@@ -179,6 +179,24 @@ send_sig(pid_t pid, int signo, bool foreground)
                              (int)rk.rk_fpid);
                logv("signaled %u processes", rk.rk_killed);
        }
+
+       /*
+        * If the child process was stopped by a signal, POSIX.1-2024
+        * requires to send a SIGCONT signal.  However, the standard also
+        * allows to send a SIGCONT regardless of the stop state, as we
+        * are doing here.
+        */
+       if (signo != SIGKILL && signo != SIGSTOP && signo != SIGCONT) {
+               logv("sending signal %s(%d) to command '%s'",
+                    sys_signame[SIGCONT], SIGCONT, command);
+               if (foreground) {
+                       kill(pid, SIGCONT);
+               } else {
+                       memset(&rk, 0, sizeof(rk));
+                       rk.rk_sig = SIGCONT;
+                       procctl(P_PID, getpid(), PROC_REAP_KILL, &rk);
+               }
+       }
 }
 
 static void

Reply via email to