Date: Mon, 16 Jun 2025 08:54:02 GMT From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: e76807eb2360 - stable/14 - timeout(1): Also send SIGCONT because the child may be stopped Message-ID: <202506160854.55G8s2jH043276@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=e76807eb2360f56a823569b9b751ee574e24aceb commit e76807eb2360f56a823569b9b751ee574e24aceb Author: Aaron LI <aly@aaronly.me> AuthorDate: 2025-04-02 16:01:17 +0000 Commit: Konstantin Belousov <kib@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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202506160854.55G8s2jH043276>