pidref: Add pidref_wait_for_terminate_full()

We can use this to replace wait_for_terminate_with_timeout(). Because
we poll a pidfd, we don't need to block SIGCHLD anymore in umount.c.
This commit is contained in:
Daan De Meyer
2025-12-20 15:49:26 +01:00
parent 9bd833ee6e
commit e74b571004
9 changed files with 122 additions and 123 deletions
+12 -2
View File
@@ -96,8 +96,10 @@ int pidref_kill(const PidRef *pidref, int sig);
int pidref_kill_and_sigcont(const PidRef *pidref, int sig);
int pidref_sigqueue(const PidRef *pidref, int sig, int value);
int pidref_wait(PidRef *pidref, siginfo_t *ret, int options);
int pidref_wait_for_terminate(PidRef *pidref, siginfo_t *ret);
int pidref_wait_for_terminate_full(PidRef *pidref, usec_t timeout, siginfo_t *ret);
static inline int pidref_wait_for_terminate(PidRef *pidref, siginfo_t *ret) {
return pidref_wait_for_terminate_full(pidref, USEC_INFINITY, ret);
}
static inline void pidref_done_sigkill_wait(PidRef *pidref) {
if (!pidref_is_set(pidref))
@@ -108,6 +110,14 @@ static inline void pidref_done_sigkill_wait(PidRef *pidref) {
pidref_done(pidref);
}
static inline void pidref_done_sigkill_nowait(PidRef *pidref) {
if (!pidref_is_set(pidref))
return;
(void) pidref_kill(pidref, SIGKILL);
pidref_done(pidref);
}
int pidref_verify(const PidRef *pidref);
#define TAKE_PIDREF(p) TAKE_GENERIC((p), PidRef, PIDREF_NULL)