git: timeout.1: Document the reaper implementation and behaivor

Aaron LI aly at crater.dragonflybsd.org
Tue Mar 18 19:35:55 PDT 2025


commit 694b470d432b40a430fa1f075b0c4a40ac1df553
Author: Aaron LI <aly at aaronly.me>
Date:   Thu Mar 13 13:31:44 2025 +0800

    timeout.1: Document the reaper implementation and behaivor
    
    If timeout(1) runs with the --foreground option, it becomes the reaper
    of the command and its descendants and will wait for all of them to
    terminate.  This behavior is different from the old FreeBSD version and
    GNU version.
    
    For example, if there is a descendant running in the background, like:
    $ timeout -s INT 2 sh -c 'sleep 4 & sleep 5'
    when timeout(1) sends the SIGINT to all descendants, the child 'sh'
    process and the foreground 'sleep 5' process will immediately terminate,
    but the background 'sleep 4' will be reparented to the timeout(1)
    itself.  Because a background process ignores SIGINT and SIGQUIT,
    the whole command completes until the background 'sleep 4' finishes.
    
    In comparison, the old FreeBSD version and GNU version will just
    terminate itself, letting the background 'sleep 4' process be reparented
    to an upper reaper like init.
    
    The POSIX.1-2024 standard doesn't specify the required behavior in such
    cases, so I decided to keep the current implementation.  Nonetheless,
    the updated timeout(1) has changed a lot in order to conform to the
    standard.

Summary of changes:
 usr.bin/timeout/timeout.1 | 43 +++++++++++++++++++++++++++++++++++--------
 1 file changed, 35 insertions(+), 8 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/694b470d432b40a430fa1f075b0c4a40ac1df553


-- 
DragonFly BSD source repository


More information about the Commits mailing list