git: 8e1d9fe06621 - main - timeout(1): Improve to show more verbose log messages
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 16 Apr 2025 19:46:34 UTC
The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=8e1d9fe06621e22b9de6b3bf1b6164a00f0f26b5 commit 8e1d9fe06621e22b9de6b3bf1b6164a00f0f26b5 Author: Aaron LI <aly@aaronly.me> AuthorDate: 2025-04-02 16:17:17 +0000 Commit: Baptiste Daroussin <bapt@FreeBSD.org> CommitDate: 2025-04-16 19:45:38 +0000 timeout(1): Improve to show more verbose log messages --- 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);