diff options
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/util.c | 10 | ||||
-rw-r--r-- | src/shared/util.h | 3 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/shared/util.c b/src/shared/util.c index 5157b94a34..9392477787 100644 --- a/src/shared/util.c +++ b/src/shared/util.c @@ -8011,3 +8011,13 @@ ssize_t sparse_write(int fd, const void *p, size_t sz, size_t run_length) { return q - (const uint8_t*) p; } + +void sigkill_wait(pid_t *pid) { + if (!pid) + return; + if (*pid <= 1) + return; + + if (kill(*pid, SIGKILL) > 0) + (void) wait_for_terminate(*pid, NULL); +} diff --git a/src/shared/util.h b/src/shared/util.h index d40c0b0378..f59a2bbb99 100644 --- a/src/shared/util.h +++ b/src/shared/util.h @@ -1065,3 +1065,6 @@ void release_lock_file(LockFile *f); #define RLIMIT_MAKE_CONST(lim) ((struct rlimit) { lim, lim }) ssize_t sparse_write(int fd, const void *p, size_t sz, size_t run_length); + +void sigkill_wait(pid_t *pid); +#define _cleanup_sigkill_wait_ _cleanup_(sigkill_wait) |