diff options
author | Lennart Poettering <lennart@poettering.net> | 2023-11-02 11:04:36 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2023-11-02 14:09:23 +0100 |
commit | e9ccae31355b8d4fd7496b0548470c8c977897d8 (patch) | |
tree | 13c5f4246df81fa08c396303b14acf15ccdcc2a5 /src/test/test-process-util.c | |
parent | fd-util: add new FORMAT_PROC_PID_FD_PATH() helper (diff) | |
download | systemd-e9ccae31355b8d4fd7496b0548470c8c977897d8.tar.xz systemd-e9ccae31355b8d4fd7496b0548470c8c977897d8.zip |
process-util: add new FORK_DEATHSIG_SIGKILL flag, rename FORK_DEATHSIG → FORK_DEATHSIG_SIGTERM
Sometimes it makes sense to hard kill a client if we die. Let's hence
add a third FORK_DEATHSIG flag for this purpose: FORK_DEATHSIG_SIGKILL.
To make things less confusing this also renames FORK_DEATHSIG to
FORK_DEATHSIG_SIGTERM to make clear it sends SIGTERM. We already had
FORK_DEATHSIG_SIGINT, hence this makes things nicely symmetric.
A bunch of users are switched over for FORK_DEATHSIG_SIGKILL where we
know it's safe to abort things abruptly. This should make some kernel
cases more robust, since we cannot get confused by signal masks or such.
While we are at it, also fix a bunch of bugs where we didn't take
FORK_DEATHSIG_SIGINT into account in safe_fork()
Diffstat (limited to 'src/test/test-process-util.c')
-rw-r--r-- | src/test/test-process-util.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/test/test-process-util.c b/src/test/test-process-util.c index 22fb1fd278..09ad82d239 100644 --- a/src/test/test-process-util.c +++ b/src/test/test-process-util.c @@ -634,7 +634,7 @@ TEST(safe_fork) { BLOCK_SIGNALS(SIGCHLD); - r = safe_fork("(test-child)", FORK_RESET_SIGNALS|FORK_CLOSE_ALL_FDS|FORK_DEATHSIG|FORK_REARRANGE_STDIO|FORK_REOPEN_LOG, &pid); + r = safe_fork("(test-child)", FORK_RESET_SIGNALS|FORK_CLOSE_ALL_FDS|FORK_DEATHSIG_SIGTERM|FORK_REARRANGE_STDIO|FORK_REOPEN_LOG, &pid); assert_se(r >= 0); if (r == 0) { @@ -701,7 +701,7 @@ TEST(setpriority_closest) { int r; r = safe_fork("(test-setprio)", - FORK_RESET_SIGNALS|FORK_CLOSE_ALL_FDS|FORK_DEATHSIG|FORK_WAIT|FORK_LOG, NULL); + FORK_RESET_SIGNALS|FORK_CLOSE_ALL_FDS|FORK_DEATHSIG_SIGTERM|FORK_WAIT|FORK_LOG, NULL); assert_se(r >= 0); if (r == 0) { @@ -855,7 +855,7 @@ TEST(get_process_threads) { int r; /* Run this test in a child, so that we can guarantee there's exactly one thread around in the child */ - r = safe_fork("(nthreads)", FORK_RESET_SIGNALS|FORK_DEATHSIG|FORK_REOPEN_LOG|FORK_WAIT|FORK_LOG, NULL); + r = safe_fork("(nthreads)", FORK_RESET_SIGNALS|FORK_DEATHSIG_SIGTERM|FORK_REOPEN_LOG|FORK_WAIT|FORK_LOG, NULL); assert_se(r >= 0); if (r == 0) { |