util: rework sigkill_wait() to not require pid_t pointer

Let's make sigkill_wait() take a normal pid_t, and add sigkill_waitp() that
takes a pointer (which is useful for usage in _cleanup_), following the usual
logic we have for this.
This commit is contained in:
Lennart Poettering
2016-05-02 11:15:30 +02:00
parent 5659958529
commit 89c9030d31
5 changed files with 14 additions and 8 deletions
+9 -3
View File
@@ -528,14 +528,20 @@ int wait_for_terminate_and_warn(const char *name, pid_t pid, bool check_exit_cod
return -EPROTO;
}
void sigkill_wait(pid_t *pid) {
void sigkill_wait(pid_t pid) {
assert(pid > 1);
if (kill(pid, SIGKILL) > 0)
(void) wait_for_terminate(pid, NULL);
}
void sigkill_waitp(pid_t *pid) {
if (!pid)
return;
if (*pid <= 1)
return;
if (kill(*pid, SIGKILL) > 0)
(void) wait_for_terminate(*pid, NULL);
sigkill_wait(*pid);
}
int kill_and_sigcont(pid_t pid, int sig) {