The branch stable/14 has been updated by kib:

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

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

    timeout(1): Improve to show more verbose log messages
    
    (cherry picked from commit 8e1d9fe06621e22b9de6b3bf1b6164a00f0f26b5)
---
 bin/timeout/timeout.1 |  6 +++++-
 bin/timeout/timeout.c | 16 ++++++++++++++++
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/bin/timeout/timeout.1 b/bin/timeout/timeout.1
index 3eacdd768410..14fc19292684 100644
--- a/bin/timeout/timeout.1
+++ b/bin/timeout/timeout.1
@@ -89,7 +89,11 @@ By default,
 .Dv SIGTERM
 is sent.
 .It Fl v , Fl -verbose
-Show information to stderr about any signal sent on timeout.
+Show information to
+.Xr stderr 4
+about timeouts, signals to be sent, and the
+.Ar command
+exits.
 .El
 .Ss Duration Format
 The
diff --git a/bin/timeout/timeout.c b/bin/timeout/timeout.c
index c3c7532a9d08..8a2f0faecd83 100644
--- a/bin/timeout/timeout.c
+++ b/bin/timeout/timeout.c
@@ -344,6 +344,19 @@ main(int argc, char **argv)
                                } else if (cpid == pid) {
                                        pstat = status;
                                        child_done = true;
+                                       logv("child terminated: pid=%d, "
+                                            "exit=%d, signal=%d",
+                                            (int)pid, WEXITSTATUS(status),
+                                            WTERMSIG(status));
+                               } else {
+                                       /*
+                                        * Collect grandchildren zombies.
+                                        * Only effective if we're a reaper.
+                                        */
+                                       logv("collected zombie: pid=%d, "
+                                            "exit=%d, signal=%d",
+                                            (int)cpid, WEXITSTATUS(status),
+                                            WTERMSIG(status));
                                }
                        }
                        if (child_done) {
@@ -361,9 +374,12 @@ main(int argc, char **argv)
                                sig = killsig;
                                sig_alrm = 0;
                                timedout = true;
+                               logv("time limit reached or received SIGALRM");
                        } else {
                                sig = sig_term;
                                sig_term = 0;
+                               logv("received terminating signal %s(%d)",
+                                    sys_signame[sig], sig);
                        }
 
                        send_sig(pid, sig, foreground);

Reply via email to