diff options
author | Lennart Poettering <lennart@poettering.net> | 2010-07-10 04:49:37 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2010-07-10 04:49:37 +0200 |
commit | 2e22afe909cd5fa003347aa91ad15f0516e5047f (patch) | |
tree | 3d1c91121458414837a90872467112a585f57cc5 /src/socket.c | |
parent | 73c33e7f225f81e6066386fba997e8ea2ba361b3 (diff) |
execute: add ability to configure the kill signal
Diffstat (limited to 'src/socket.c')
-rw-r--r-- | src/socket.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/socket.c b/src/socket.c index 075b51966f..6cbb14137e 100644 --- a/src/socket.c +++ b/src/socket.c @@ -165,7 +165,7 @@ static int socket_verify(Socket *s) { return -EINVAL; } - if (s->exec_context.pam_name && s->kill_mode != KILL_CONTROL_GROUP) { + if (s->exec_context.pam_name && s->exec_context.kill_mode != KILL_CONTROL_GROUP) { log_error("%s has PAM enabled. Kill mode must be set to 'control-group'. Refusing.", s->meta.id); return -EINVAL; } @@ -326,7 +326,6 @@ static void socket_dump(Unit *u, FILE *f, const char *prefix) { "%sSocket State: %s\n" "%sBindIPv6Only: %s\n" "%sBacklog: %u\n" - "%sKillMode: %s\n" "%sSocketMode: %04o\n" "%sDirectoryMode: %04o\n" "%sKeepAlive: %s\n" @@ -334,7 +333,6 @@ static void socket_dump(Unit *u, FILE *f, const char *prefix) { prefix, socket_state_to_string(s->state), prefix, socket_address_bind_ipv6_only_to_string(s->bind_ipv6_only), prefix, s->backlog, - prefix, kill_mode_to_string(s->kill_mode), prefix, s->socket_mode, prefix, s->directory_mode, prefix, yes_no(s->keep_alive), @@ -891,10 +889,10 @@ static void socket_enter_signal(Socket *s, SocketState state, bool success) { if (!success) s->failure = true; - if (s->kill_mode != KILL_NONE) { - int sig = (state == SOCKET_STOP_PRE_SIGTERM || state == SOCKET_FINAL_SIGTERM) ? SIGTERM : SIGKILL; + if (s->exec_context.kill_mode != KILL_NONE) { + int sig = (state == SOCKET_STOP_PRE_SIGTERM || state == SOCKET_FINAL_SIGTERM) ? s->exec_context.kill_signal : SIGKILL; - if (s->kill_mode == KILL_CONTROL_GROUP) { + if (s->exec_context.kill_mode == KILL_CONTROL_GROUP) { if ((r = cgroup_bonding_kill_list(s->meta.cgroup_bondings, sig)) < 0) { if (r != -EAGAIN && r != -ESRCH) @@ -904,7 +902,7 @@ static void socket_enter_signal(Socket *s, SocketState state, bool success) { } if (!sent && s->control_pid > 0) - if (kill(s->kill_mode == KILL_PROCESS ? s->control_pid : -s->control_pid, sig) < 0 && errno != ESRCH) { + if (kill(s->exec_context.kill_mode == KILL_PROCESS ? s->control_pid : -s->control_pid, sig) < 0 && errno != ESRCH) { r = -errno; goto fail; } |