| #
08208cd6
|
| 13-Feb-2026 |
Dag-Erling Smørgrav <des@FreeBSD.org> |
timeout: Clean up
* Annotate logv() and fix format string bug.
* Don't reinvent str2sig(3).
* Reorganize kill_self() so we unblock signals as late as possible, and use raise(2) instead of kill(2
timeout: Clean up
* Annotate logv() and fix format string bug.
* Don't reinvent str2sig(3).
* Reorganize kill_self() so we unblock signals as late as possible, and use raise(2) instead of kill(2).
* Explicitly close unused pipe descriptors.
* Use correct type to collect result of read(2) and write(2).
* Compare return values to 0, not -1.
* Sort local variables according to style(9).
* Reduce unnecessary nesting.
* Reindent.
* Fix typo in manual page.
MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D55277
show more ...
|
| #
81ef0012
|
| 09-Jun-2025 |
Konstantin Belousov <kib@FreeBSD.org> |
timeout(1): pass full 32bit error return code from the exited child
Switch to use waitid(2) to receive siginfo_t with the complete error code from the exited process.
Tested by: pho Reviewed by: ma
timeout(1): pass full 32bit error return code from the exited child
Switch to use waitid(2) to receive siginfo_t with the complete error code from the exited process.
Tested by: pho Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D50752
show more ...
|
| #
aa8cdb7c
|
| 08-Jun-2025 |
Konstantin Belousov <kib@FreeBSD.org> |
timeout(1): only start the child command after the parent is fully set up
Since the default disposition for SIGCHLD is ignore, the prematurely exited child would cause SIGCHLD dropped. This makes t
timeout(1): only start the child command after the parent is fully set up
Since the default disposition for SIGCHLD is ignore, the prematurely exited child would cause SIGCHLD dropped. This makes timeout(1) hang, because REAP_STATUS reports a zombie not waited for, but SIGCHLD for it was already lost, so the main loop cannot exit, instead calling into sigsuspend().
Reported and tested by: pho Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D50752
show more ...
|
| #
bff05e8a
|
| 07-Jun-2025 |
Konstantin Belousov <kib@FreeBSD.org> |
timeout(1): print errno when signalling syscalls failed
Tested by: pho Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D5
timeout(1): print errno when signalling syscalls failed
Tested by: pho Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D50752
show more ...
|
| #
15e4b8d5
|
| 07-Jun-2025 |
Konstantin Belousov <kib@FreeBSD.org> |
timeout(1): silence warnings for ESRCH
It is possible for the child to become zombie and then there is nothing to signal.
Reported and tested by: pho Reviewed by: markj Sponsored by: The FreeBSD Fo
timeout(1): silence warnings for ESRCH
It is possible for the child to become zombie and then there is nothing to signal.
Reported and tested by: pho Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D50752
show more ...
|
| #
61331026
|
| 03-Apr-2025 |
Aaron LI <aly@aaronly.me> |
timeout(1): Kill self with the same signal that terminated the child
A shell may not set '$?' to '128 + signal_number' when the process was terminated by a signal. For example, KornShell 93 sets '$
timeout(1): Kill self with the same signal that terminated the child
A shell may not set '$?' to '128 + signal_number' when the process was terminated by a signal. For example, KornShell 93 sets '$?' to '256 + signal_number' in such cases. In order to avoid any possible ambiguity, the POSIX.1-2024 standard requires that timeout mimic the wait status of the child process by terminating itself with the same signal, while disabling core generation.
Update the man page accordingly.
Obtained-from: DragonFly BSD Reference: https://pubs.opengroup.org/onlinepubs/9799919799/utilities/timeout.html
show more ...
|
| #
844cef26
|
| 03-Apr-2025 |
Aaron LI <aly@aaronly.me> |
timeout(1): Catch all signals and propagate them
The POSIX.1-2024 standard requires that timeout(1) utility propagate all signals except SIGALRM, so timeout(1) needs to catch all signals for this pu
timeout(1): Catch all signals and propagate them
The POSIX.1-2024 standard requires that timeout(1) utility propagate all signals except SIGALRM, so timeout(1) needs to catch all signals for this purpose. In addition, we need to separate those signals whose default action is to terminate the program, because timeout(1) should start the second timer for the kill signal if those signals are received.
Obtained-from: DragonFly BSD Reference: https://pubs.opengroup.org/onlinepubs/9799919799/utilities/timeout.html
show more ...
|
| #
2390cbfe
|
| 03-Apr-2025 |
Aaron LI <aly@aaronly.me> |
timeout(1): Fix the inheritance of signal dispositions
POSIX.1-2024 requires that the child process inherit the same signal dispositions as the timeout(1) utility inherited, except for the signal to
timeout(1): Fix the inheritance of signal dispositions
POSIX.1-2024 requires that the child process inherit the same signal dispositions as the timeout(1) utility inherited, except for the signal to be sent upon timeout.
For example, when timeout(1) is run by nohup(1), the command should be protected from SIGHUP.
Obtained-from: DragonFly BSD
show more ...
|
| #
8e1d9fe0
|
| 02-Apr-2025 |
Aaron LI <aly@aaronly.me> |
timeout(1): Improve to show more verbose log messages
|
| #
aae3eb24
|
| 02-Apr-2025 |
Aaron LI <aly@aaronly.me> |
timeout(1): Fix the handling of repeated terminating signals
This actually fixes the following two issues:
* If a terminating signal (e.g., HUP/INT/TERM) was received, timeout would propagate it
timeout(1): Fix the handling of repeated terminating signals
This actually fixes the following two issues:
* If a terminating signal (e.g., HUP/INT/TERM) was received, timeout would propagate it to the command and then ignore it. So it was unable to resend the same terminating signal to the command. This was different from the GNU's timeout(1), and also contradicted the POSIX.1-2024 standard.
* Sending two different terminating signals would break timeout(1)'s --kill-after mechanism. That was because the second signal would break the for() loop, so the second SIGALRM set by '--kill-after' would never be caught.
For example, in one shell run: $ time timeout -f -v -s INT -k 1 2 sh -T -c \ 'trap date INT HUP; sleep 5; echo ok; date' and in another shell run: $ pkill -INT timeout; pkill -HUP timeout in the end, the time(1) would report it cost 5 seconds instead of the expected 3 seconds.
Obtained-from: DragonFly BSD
show more ...
|
| #
06c74693
|
| 02-Apr-2025 |
Aaron LI <aly@aaronly.me> |
timeout(1): Also send SIGCONT because the child may be stopped
The POSIX.1-2024 says:
"If the subsequent wait status of the child process shows that it was stopped by a signal, a SIGCONT signal sha
timeout(1): Also send SIGCONT because the child may be stopped
The POSIX.1-2024 says:
"If the subsequent wait status of the child process shows that it was stopped by a signal, a SIGCONT signal shall also be sent in the same manner as the first signal; otherwise, a SIGCONT signal may be sent in the same manner."
As it's allowed by the standard, we just always send the SIGCONT signal to the child process regardless of its stop state, so that timeout could terminate a stopped child.
Obtained-from: DragonFly BSD Reference: https://pubs.opengroup.org/onlinepubs/9799919799/utilities/timeout.html
show more ...
|
| #
086f1785
|
| 02-Apr-2025 |
Aaron LI <aly@aaronly.me> |
timeout(1): Enhance send_sig() and prepare for later updates
Enhance send_sig() to better encapsulate the signal sending for both foreground and non-foreground modes. This also fixes the issue that
timeout(1): Enhance send_sig() and prepare for later updates
Enhance send_sig() to better encapsulate the signal sending for both foreground and non-foreground modes. This also fixes the issue that the latter mode was missing verbose messages.
In addition, improve the verbose logging for signals.
Obtained-from: DragonFly BSD
show more ...
|
| #
8a9927ec
|
| 02-Apr-2025 |
Aaron LI <aly@aaronly.me> |
timeout(1): Add -f and -p options as per POSIX.1-2024
POSIX.1-2024 first defined the timeout(1) utility and specified the '-f' and '-p' options, which are the short versions of '--foreground' and '-
timeout(1): Add -f and -p options as per POSIX.1-2024
POSIX.1-2024 first defined the timeout(1) utility and specified the '-f' and '-p' options, which are the short versions of '--foreground' and '--preserve-status' options, respectively. Add the short versions to comply with the Standard.
Obtained-from: DragonFly BSD Reference: https://pubs.opengroup.org/onlinepubs/9799919799/utilities/timeout.html
show more ...
|
| #
c5cdc130
|
| 02-Apr-2025 |
Aaron LI <aly@aaronly.me> |
timeout(1): Handle sig_alrm and sig_term together to dedup code
Merge the 'sig_alrm' and 'sig_term' conditionals, and thus reduce some duplicate code.
Obtained-from: DragonFly BSD
|
| #
790e3617
|
| 02-Apr-2025 |
Aaron LI <aly@aaronly.me> |
timeout(1): Multiple minor tweaks and cleanups
|
| #
92f8006e
|
| 02-Apr-2025 |
Aaron LI <aly@aaronly.me> |
timeout(1): sig_atomic_t variables must also be 'volatile'
Obtained-from: OpenBSD (via DragonFly BSD)
|
| #
35503fe2
|
| 02-Apr-2025 |
Aaron LI <aly@aaronly.me> |
timeout(1): Use _exit(2) instead of err() in child if exec failed
* The child should _exit(2) instead of calling exit(3) via err(3) if the execvp() failed. * execvp(2) does not return except on er
timeout(1): Use _exit(2) instead of err() in child if exec failed
* The child should _exit(2) instead of calling exit(3) via err(3) if the execvp() failed. * execvp(2) does not return except on error, so there is no need to check if the return value is -1.
Obtained-from: OpenBSD (via DragonFly BSD)
show more ...
|
| #
e7bf1e5f
|
| 02-Apr-2025 |
Aaron LI <aly@aaronly.me> |
timeout(1): Improve duration parsing and error messages
Obtained-from: OpenBSD (via DragonFly BSD)
|
| #
d633a7d1
|
| 04-Jan-2025 |
Gordon Bergling <gbe@FreeBSD.org> |
timeout(1): Add -v/--verbose option to show diagnosis info
The -v/--verbose option enables this utility to show diagnosis info to stderr about any signal sent on timeout.
This implementation refers
timeout(1): Add -v/--verbose option to show diagnosis info
The -v/--verbose option enables this utility to show diagnosis info to stderr about any signal sent on timeout.
This implementation refers to GNU coreutils's timeout(1).
Reviewed by: bapt, Alexander Ziaee (manpages) Approved by: bapt (src) Obtained from: DragonFlyBSD MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D48225
show more ...
|
| #
06690044
|
| 28-Dec-2024 |
Gordon Bergling <gbe@FreeBSD.org> |
timeout(1): Some minor tweaks and improvements
- Define exit status and macros and use them - Improve the second kill logic by setting 'do_second_kill = false' after configuring the second kill -
timeout(1): Some minor tweaks and improvements
- Define exit status and macros and use them - Improve the second kill logic by setting 'do_second_kill = false' after configuring the second kill - Minor style tweaks - Reorder options in the man page, as well as the usage help - Reorder the exit status in the man page - Enhance the HISTORY section in the man page (obtained from NetBSD)
Reviewed by: bapt, Alexander Ziaee (manpages) Approved by: bapt (src) Obtained from: DragonFlyBSD MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D47866
show more ...
|
| #
4d8d9111
|
| 03-Jan-2024 |
rilysh <nightquick@proton.me> |
bin/timeout: remove unreachable break after usage()
Signed-off-by: rilysh <nightquick@proton.me> Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/872
|
| #
1d386b48
|
| 16-Aug-2023 |
Warner Losh <imp@FreeBSD.org> |
Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
|
| #
e7ab1336
|
| 01-Feb-2023 |
Mateusz Piotrowski <0mp@FreeBSD.org> |
timeout: Move from /usr/bin to /bin
timeout(1) is used by /etc/rc.d/zfskeys. Unfortunately, having timeout(1) installed in /usr/bin causes problems when /usr is an encrypted ZFS partition.
Implemen
timeout: Move from /usr/bin to /bin
timeout(1) is used by /etc/rc.d/zfskeys. Unfortunately, having timeout(1) installed in /usr/bin causes problems when /usr is an encrypted ZFS partition.
Implementing timeout(1) in sh(1) is not trivial. A more elegant solution is to move timeout(1) to /bin so that it is available to early services in the boot process.
PR: 265221 Reviewed by: allanjude, des, imp Approved by: allanjude, des, imp Reported by: Ivan <r4@sovserv.ru> Fixes: 33ff39796ffe Add zfskeys rc.d script for auto-loading encryption keys MFC after: 1 week Relnotes: yes Sponsored by: Modirum MDPay Sponsored by: Klara Inc. Differential Revision: https://reviews.freebsd.org/D38344
show more ...
|
| #
3f550f01
|
| 20-Oct-2021 |
Baptiste Daroussin <bapt@FreeBSD.org> |
timeout: style fixes
|
| #
68914dab
|
| 20-Oct-2021 |
Baptiste Daroussin <bapt@FreeBSD.org> |
timeout: eliminate usage of sysexits
It brings no value at all the sysexits and maybe misleading as the return value of timeout(1) matters.
|