From cd25cce98f5cc930202212c3c9c13605c09698b4 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 29 Mar 2011 23:31:38 +0200 Subject: exec: drop process group kill mode since it has little use and confuses the user --- src/execute.c | 1 - src/execute.h | 1 - src/mount.c | 6 ++---- src/service.c | 15 +++++---------- src/socket.c | 6 ++---- src/swap.c | 6 ++---- src/systemctl-bash-completion.sh | 2 +- 7 files changed, 12 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/execute.c b/src/execute.c index a467411f7d..cd44640a53 100644 --- a/src/execute.c +++ b/src/execute.c @@ -1933,7 +1933,6 @@ DEFINE_STRING_TABLE_LOOKUP(exec_output, ExecOutput); static const char* const kill_mode_table[_KILL_MODE_MAX] = { [KILL_CONTROL_GROUP] = "control-group", - [KILL_PROCESS_GROUP] = "process-group", [KILL_PROCESS] = "process", [KILL_NONE] = "none" }; diff --git a/src/execute.h b/src/execute.h index 44856d11fa..208fe4ad5e 100644 --- a/src/execute.h +++ b/src/execute.h @@ -43,7 +43,6 @@ struct CGroupBonding; typedef enum KillMode { KILL_CONTROL_GROUP = 0, - KILL_PROCESS_GROUP, KILL_PROCESS, KILL_NONE, _KILL_MODE_MAX, diff --git a/src/mount.c b/src/mount.c index cc49b1993f..8528d17a80 100644 --- a/src/mount.c +++ b/src/mount.c @@ -747,9 +747,7 @@ static void mount_enter_signal(Mount *m, MountState state, bool success) { state == MOUNT_REMOUNTING_SIGTERM) ? m->exec_context.kill_signal : SIGKILL; if (m->control_pid > 0) { - if (kill_and_sigcont(m->exec_context.kill_mode == KILL_PROCESS_GROUP ? - -m->control_pid : - m->control_pid, sig) < 0 && errno != ESRCH) + if (kill_and_sigcont(m->control_pid, sig) < 0 && errno != ESRCH) log_warning("Failed to kill control process %li: %m", (long) m->control_pid); else @@ -1684,7 +1682,7 @@ static int mount_kill(Unit *u, KillWho who, KillMode mode, int signo, DBusError } if (m->control_pid > 0) - if (kill(mode == KILL_PROCESS_GROUP ? -m->control_pid : m->control_pid, signo) < 0) + if (kill(m->control_pid, signo) < 0) r = -errno; if (mode == KILL_CONTROL_GROUP) { diff --git a/src/service.c b/src/service.c index 1735a96c80..fd3a9c94e7 100644 --- a/src/service.c +++ b/src/service.c @@ -828,7 +828,7 @@ static int service_load_sysv_path(Service *s, const char *path) { s->exec_context.std_output = (s->meta.manager->sysv_console || s->exec_context.std_input == EXEC_INPUT_TTY) ? EXEC_OUTPUT_TTY : s->meta.manager->default_std_output; - s->exec_context.kill_mode = KILL_PROCESS_GROUP; + s->exec_context.kill_mode = KILL_PROCESS; /* We use the long description only if * no short description is set. */ @@ -1838,19 +1838,14 @@ static void service_enter_signal(Service *s, ServiceState state, bool success) { int sig = (state == SERVICE_STOP_SIGTERM || state == SERVICE_FINAL_SIGTERM) ? s->exec_context.kill_signal : SIGKILL; if (s->main_pid > 0) { - if (kill_and_sigcont(s->exec_context.kill_mode == KILL_PROCESS_GROUP ? - -s->main_pid : - s->main_pid, sig) < 0 && errno != ESRCH) - + if (kill_and_sigcont(s->main_pid, sig) < 0 && errno != ESRCH) log_warning("Failed to kill main process %li: %m", (long) s->main_pid); else wait_for_exit = true; } if (s->control_pid > 0) { - if (kill_and_sigcont(s->exec_context.kill_mode == KILL_PROCESS_GROUP ? - -s->control_pid : - s->control_pid, sig) < 0 && errno != ESRCH) + if (kill_and_sigcont(s->control_pid, sig) < 0 && errno != ESRCH) log_warning("Failed to kill control process %li: %m", (long) s->control_pid); else @@ -3212,11 +3207,11 @@ static int service_kill(Unit *u, KillWho who, KillMode mode, int signo, DBusErro } if (s->control_pid > 0) - if (kill(mode == KILL_PROCESS_GROUP ? -s->control_pid : s->control_pid, signo) < 0) + if (kill(s->control_pid, signo) < 0) r = -errno; if (s->main_pid > 0) - if (kill(mode == KILL_PROCESS_GROUP ? -s->main_pid : s->main_pid, signo) < 0) + if (kill(s->main_pid, signo) < 0) r = -errno; if (mode == KILL_CONTROL_GROUP) { diff --git a/src/socket.c b/src/socket.c index 9045a2fc85..72be0e2235 100644 --- a/src/socket.c +++ b/src/socket.c @@ -1040,9 +1040,7 @@ static void socket_enter_signal(Socket *s, SocketState state, bool success) { int sig = (state == SOCKET_STOP_PRE_SIGTERM || state == SOCKET_FINAL_SIGTERM) ? s->exec_context.kill_signal : SIGKILL; if (s->control_pid > 0) { - if (kill_and_sigcont(s->exec_context.kill_mode == KILL_PROCESS_GROUP ? - -s->control_pid : - s->control_pid, sig) < 0 && errno != ESRCH) + if (kill_and_sigcont(s->control_pid, sig) < 0 && errno != ESRCH) log_warning("Failed to kill control process %li: %m", (long) s->control_pid); else @@ -1837,7 +1835,7 @@ static int socket_kill(Unit *u, KillWho who, KillMode mode, int signo, DBusError } if (s->control_pid > 0) - if (kill(mode == KILL_PROCESS_GROUP ? -s->control_pid : s->control_pid, signo) < 0) + if (kill(s->control_pid, signo) < 0) r = -errno; if (mode == KILL_CONTROL_GROUP) { diff --git a/src/swap.c b/src/swap.c index 035efbaf4b..66bf5c2bfb 100644 --- a/src/swap.c +++ b/src/swap.c @@ -661,9 +661,7 @@ static void swap_enter_signal(Swap *s, SwapState state, bool success) { state == SWAP_DEACTIVATING_SIGTERM) ? s->exec_context.kill_signal : SIGKILL; if (s->control_pid > 0) { - if (kill_and_sigcont(s->exec_context.kill_mode == KILL_PROCESS_GROUP ? - -s->control_pid : - s->control_pid, sig) < 0 && errno != ESRCH) + if (kill_and_sigcont(s->control_pid, sig) < 0 && errno != ESRCH) log_warning("Failed to kill control process %li: %m", (long) s->control_pid); else @@ -1286,7 +1284,7 @@ static int swap_kill(Unit *u, KillWho who, KillMode mode, int signo, DBusError * } if (s->control_pid > 0) - if (kill(mode == KILL_PROCESS_GROUP ? -s->control_pid : s->control_pid, signo) < 0) + if (kill(s->control_pid, signo) < 0) r = -errno; if (mode == KILL_CONTROL_GROUP) { diff --git a/src/systemctl-bash-completion.sh b/src/systemctl-bash-completion.sh index f3420217b5..ae0ecb7b70 100644 --- a/src/systemctl-bash-completion.sh +++ b/src/systemctl-bash-completion.sh @@ -60,7 +60,7 @@ _systemctl () { comps='all control main' ;; --kill-mode) - comps='control-group process process-group' + comps='control-group process' ;; --property|-p) comps='' -- cgit v1.2.3-54-g00ecf