|
From: | Patrick Reader |
Subject: | Meaning of some code in `timeout` |
Date: | Fri, 2 Apr 2021 13:22:57 +0000 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 |
> if (!timed_out && disable_core_dumps()) > { > /* exit with the signal flag set. */ > signal(sig, SIG_DFL); > unblock_signal(sig); > raise(sig); > }(starting on line 589, as of commit 6c1723ec317efb787d70d40c55397d43846bcd38)
This is what I understand of this section: if the process was signalled, but not because it timed out, then raise the signal so that timeout's parent can observe that it exited due to a signal. We disable core dumps and check that that was successful to ensure that timeout won't dump its own core because of raising the signal.
Is this correct? I want to understand more about how timeout works, because I'm looking to implement a similar mechanism in one of my own projects and I want to be sure I know what the original code does before I go modifying it.
Thanks, Patrick
[Prev in Thread] | Current Thread | [Next in Thread] |