[systemd-commits] 4 commits - Makefile.am man/journalctl.xml man/systemd.exec.xml man/systemd.kill.xml man/systemd.mount.xml man/systemd.service.xml man/systemd.socket.xml man/systemd.swap.xml src/core src/systemctl

Lennart Poettering lennart at kemper.freedesktop.org
Thu Jul 19 15:10:52 PDT 2012


 Makefile.am                           |    5 +
 man/journalctl.xml                    |    9 +
 man/systemd.exec.xml                  |    3 
 man/systemd.kill.xml                  |  170 ++++++++++++++++++++++++++++++++++
 man/systemd.mount.xml                 |   55 +++--------
 man/systemd.service.xml               |  100 ++++----------------
 man/systemd.socket.xml                |   54 +++-------
 man/systemd.swap.xml                  |   58 ++++-------
 src/core/dbus-execute.c               |    4 
 src/core/dbus-execute.h               |    1 
 src/core/dbus-kill.c                  |   35 +++++++
 src/core/dbus-kill.h                  |   39 +++++++
 src/core/dbus-manager.c               |   19 +--
 src/core/dbus-mount.c                 |    3 
 src/core/dbus-service.c               |    4 
 src/core/dbus-socket.c                |    3 
 src/core/dbus-swap.c                  |    3 
 src/core/dbus-unit.c                  |   18 +--
 src/core/dbus-unit.h                  |    1 
 src/core/execute.c                    |   34 ------
 src/core/execute.h                    |   27 -----
 src/core/kill.c                       |   63 ++++++++++++
 src/core/kill.h                       |   60 ++++++++++++
 src/core/load-fragment-gperf.gperf.m4 |   12 +-
 src/core/mount.c                      |   37 ++++---
 src/core/mount.h                      |    2 
 src/core/service.c                    |   50 +++++-----
 src/core/service.h                    |    3 
 src/core/socket.c                     |   34 +++---
 src/core/socket.h                     |    1 
 src/core/swap.c                       |   34 +++---
 src/core/swap.h                       |    1 
 src/core/unit.c                       |   34 ++++--
 src/core/unit.h                       |    6 -
 src/systemctl/systemctl.c             |   11 --
 35 files changed, 611 insertions(+), 382 deletions(-)

New commits:
commit cba6e0627d659a33df31aaa74d0d701c4bc9f317
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Jul 20 00:09:35 2012 +0200

    units: apply default resource limits to socket/mount/swap processes too

diff --git a/src/core/mount.c b/src/core/mount.c
index 5709db2..83e51a7 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -634,7 +634,7 @@ static int mount_load(Unit *u) {
                 if (r < 0)
                         return r;
 
-                r = unit_patch_working_directory(UNIT(m), &m->exec_context);
+                r = unit_exec_context_defaults(u, &m->exec_context);
                 if (r < 0)
                         return r;
         }
diff --git a/src/core/service.c b/src/core/service.c
index 78f9a59..30598de 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -130,7 +130,6 @@ static const UnitActiveState state_translation_table_idle[_SERVICE_STATE_MAX] =
 
 static void service_init(Unit *u) {
         Service *s = SERVICE(u);
-        int i;
 
         assert(u);
         assert(u->load_state == UNIT_STUB);
@@ -150,9 +149,6 @@ static void service_init(Unit *u) {
         s->guess_main_pid = true;
 
         exec_context_init(&s->exec_context);
-        for (i = 0; i < RLIMIT_NLIMITS; i++)
-                if (UNIT(s)->manager->rlimit[i])
-                        s->exec_context.rlimit[i] = newdup(struct rlimit, UNIT(s)->manager->rlimit[i], 1);
         kill_context_init(&s->kill_context);
 
         RATELIMIT_INIT(s->start_limit, 10*USEC_PER_SEC, 5);
@@ -1284,7 +1280,7 @@ static int service_load(Unit *u) {
                         if ((r = service_add_default_dependencies(s)) < 0)
                                 return r;
 
-                r = unit_patch_working_directory(UNIT(s), &s->exec_context);
+                r = unit_exec_context_defaults(u, &s->exec_context);
                 if (r < 0)
                         return r;
         }
diff --git a/src/core/socket.c b/src/core/socket.c
index 19b463e..837b166 100644
--- a/src/core/socket.c
+++ b/src/core/socket.c
@@ -374,7 +374,7 @@ static int socket_load(Unit *u) {
                         if ((r = socket_add_default_dependencies(s)) < 0)
                                 return r;
 
-                r = unit_patch_working_directory(UNIT(s), &s->exec_context);
+                r = unit_exec_context_defaults(u, &s->exec_context);
                 if (r < 0)
                         return r;
         }
diff --git a/src/core/swap.c b/src/core/swap.c
index 91bb021..458e00e 100644
--- a/src/core/swap.c
+++ b/src/core/swap.c
@@ -296,7 +296,7 @@ static int swap_load(Unit *u) {
                         if ((r = swap_add_default_dependencies(s)) < 0)
                                 return r;
 
-                r = unit_patch_working_directory(UNIT(s), &s->exec_context);
+                r = unit_exec_context_defaults(u, &s->exec_context);
                 if (r < 0)
                         return r;
         }
diff --git a/src/core/unit.c b/src/core/unit.c
index 3b416f9..7b2f597 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -2816,17 +2816,31 @@ int unit_add_mount_links(Unit *u) {
         return 0;
 }
 
-int unit_patch_working_directory(Unit *u, ExecContext *c) {
+int unit_exec_context_defaults(Unit *u, ExecContext *c) {
+        unsigned i;
+        int r;
+
         assert(u);
         assert(c);
 
-        if (u->manager->running_as != MANAGER_USER)
-                return 0;
+        /* This only copies in the ones that need memory */
 
-        if (c->working_directory)
-                return 0;
+        for (i = 0; i < RLIMIT_NLIMITS; i++)
+                if (u->manager->rlimit[i] && !c->rlimit[i]) {
+                        c->rlimit[i] = newdup(struct rlimit, u->manager->rlimit[i], 1);
+                        if (!c->rlimit[i])
+                                return -ENOMEM;
+                }
+
+        if (u->manager->running_as == MANAGER_USER &&
+            !c->working_directory) {
 
-        return get_home_dir(&c->working_directory);
+                r = get_home_dir(&c->working_directory);
+                if (r < 0)
+                        return r;
+        }
+
+        return 0;
 }
 
 static const char* const unit_active_state_table[_UNIT_ACTIVE_STATE_MAX] = {
diff --git a/src/core/unit.h b/src/core/unit.h
index f004179..2102b7a 100644
--- a/src/core/unit.h
+++ b/src/core/unit.h
@@ -536,7 +536,7 @@ void unit_ref_unset(UnitRef *ref);
 int unit_add_one_mount_link(Unit *u, Mount *m);
 int unit_add_mount_links(Unit *u);
 
-int unit_patch_working_directory(Unit *u, ExecContext *c);
+int unit_exec_context_defaults(Unit *u, ExecContext *c);
 
 const char *unit_active_state_to_string(UnitActiveState i);
 UnitActiveState unit_active_state_from_string(const char *s);

commit c74f17d96cccd4cc998fd037cb92046930188c91
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Jul 20 00:00:04 2012 +0200

    core: drop KillMode parameter from KillUnit() bus call
    
    It made no sense, and since we are documenting the bus calls now and
    want to include them in our stability promise we really should get it
    cleaned up sooner, not later.

diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c
index 925e87c..c341d36 100644
--- a/src/core/dbus-manager.c
+++ b/src/core/dbus-manager.c
@@ -94,7 +94,6 @@
         "  <method name=\"KillUnit\">\n"                                \
         "   <arg name=\"name\" type=\"s\" direction=\"in\"/>\n"         \
         "   <arg name=\"who\" type=\"s\" direction=\"in\"/>\n"          \
-        "   <arg name=\"mode\" type=\"s\" direction=\"in\"/>\n"         \
         "   <arg name=\"signal\" type=\"i\" direction=\"in\"/>\n"       \
         "  </method>\n"                                                 \
         "  <method name=\"ResetFailedUnit\">\n"                         \
@@ -665,10 +664,9 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection,
                 reload_if_possible = true;
                 job_type = JOB_TRY_RESTART;
         } else if (dbus_message_is_method_call(message, "org.freedesktop.systemd1.Manager", "KillUnit")) {
-                const char *name, *swho, *smode;
+                const char *name, *swho;
                 int32_t signo;
                 Unit *u;
-                KillMode mode;
                 KillWho who;
 
                 if (!dbus_message_get_args(
@@ -676,7 +674,6 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection,
                                     &error,
                                     DBUS_TYPE_STRING, &name,
                                     DBUS_TYPE_STRING, &swho,
-                                    DBUS_TYPE_STRING, &smode,
                                     DBUS_TYPE_INT32, &signo,
                                     DBUS_TYPE_INVALID))
                         return bus_send_error_reply(connection, message, &error, -EINVAL);
@@ -689,23 +686,17 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection,
                                 return bus_send_error_reply(connection, message, &error, -EINVAL);
                 }
 
-                if (isempty(smode))
-                        mode = KILL_CONTROL_GROUP;
-                else {
-                        mode = kill_mode_from_string(smode);
-                        if (mode < 0)
-                                return bus_send_error_reply(connection, message, &error, -EINVAL);
-                }
-
                 if (signo <= 0 || signo >= _NSIG)
                         return bus_send_error_reply(connection, message, &error, -EINVAL);
 
-                if (!(u = manager_get_unit(m, name))) {
+                u = manager_get_unit(m, name);
+                if (!u) {
                         dbus_set_error(&error, BUS_ERROR_NO_SUCH_UNIT, "Unit %s is not loaded.", name);
                         return bus_send_error_reply(connection, message, &error, -ENOENT);
                 }
 
-                if ((r = unit_kill(u, who, mode, signo, &error)) < 0)
+                r = unit_kill(u, who, signo, &error);
+                if (r < 0)
                         return bus_send_error_reply(connection, message, &error, r);
 
                 if (!(reply = dbus_message_new_method_return(message)))
diff --git a/src/core/dbus-unit.c b/src/core/dbus-unit.c
index 2114587..2d2f378 100644
--- a/src/core/dbus-unit.c
+++ b/src/core/dbus-unit.c
@@ -431,9 +431,8 @@ static DBusHandlerResult bus_unit_message_dispatch(Unit *u, DBusConnection *conn
                 reload_if_possible = true;
                 job_type = JOB_TRY_RESTART;
         } else if (dbus_message_is_method_call(message, "org.freedesktop.systemd1.Unit", "Kill")) {
-                const char *swho, *smode;
+                const char *swho;
                 int32_t signo;
-                KillMode mode;
                 KillWho who;
                 int r;
 
@@ -441,7 +440,6 @@ static DBusHandlerResult bus_unit_message_dispatch(Unit *u, DBusConnection *conn
                                     message,
                                     &error,
                                     DBUS_TYPE_STRING, &swho,
-                                    DBUS_TYPE_STRING, &smode,
                                     DBUS_TYPE_INT32, &signo,
                                     DBUS_TYPE_INVALID))
                         return bus_send_error_reply(connection, message, &error, -EINVAL);
@@ -454,21 +452,15 @@ static DBusHandlerResult bus_unit_message_dispatch(Unit *u, DBusConnection *conn
                                 return bus_send_error_reply(connection, message, &error, -EINVAL);
                 }
 
-                if (isempty(smode))
-                        mode = KILL_CONTROL_GROUP;
-                else {
-                        mode = kill_mode_from_string(smode);
-                        if (mode < 0)
-                                return bus_send_error_reply(connection, message, &error, -EINVAL);
-                }
-
                 if (signo <= 0 || signo >= _NSIG)
                         return bus_send_error_reply(connection, message, &error, -EINVAL);
 
-                if ((r = unit_kill(u, who, mode, signo, &error)) < 0)
+                r = unit_kill(u, who, signo, &error);
+                if (r < 0)
                         return bus_send_error_reply(connection, message, &error, r);
 
-                if (!(reply = dbus_message_new_method_return(message)))
+                reply = dbus_message_new_method_return(message);
+                if (!reply)
                         goto oom;
 
         } else if (dbus_message_is_method_call(message, "org.freedesktop.systemd1.Unit", "ResetFailed")) {
diff --git a/src/core/dbus-unit.h b/src/core/dbus-unit.h
index 5a3a9be..7ab355c 100644
--- a/src/core/dbus-unit.h
+++ b/src/core/dbus-unit.h
@@ -58,7 +58,6 @@
         "  </method>\n"                                                 \
         "  <method name=\"Kill\">\n"                                    \
         "   <arg name=\"who\" type=\"s\" direction=\"in\"/>\n"          \
-        "   <arg name=\"mode\" type=\"s\" direction=\"in\"/>\n"         \
         "   <arg name=\"signal\" type=\"i\" direction=\"in\"/>\n"       \
         "  </method>\n"                                                 \
         "  <method name=\"ResetFailed\"/>\n"                            \
diff --git a/src/core/kill.h b/src/core/kill.h
index 4f88239..3c9b0ab 100644
--- a/src/core/kill.h
+++ b/src/core/kill.h
@@ -27,6 +27,7 @@ typedef struct KillContext KillContext;
 #include <stdio.h>
 
 typedef enum KillMode {
+        /* The kill mode is a property of a unit. */
         KILL_CONTROL_GROUP = 0,
         KILL_PROCESS,
         KILL_NONE,
@@ -41,6 +42,7 @@ struct KillContext {
 };
 
 typedef enum KillWho {
+        /* Kill who is a property of an operation */
         KILL_MAIN,
         KILL_CONTROL,
         KILL_ALL,
diff --git a/src/core/mount.c b/src/core/mount.c
index 82c64ff..5709db2 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -1708,7 +1708,7 @@ static void mount_reset_failed(Unit *u) {
         m->reload_result = MOUNT_SUCCESS;
 }
 
-static int mount_kill(Unit *u, KillWho who, KillMode mode, int signo, DBusError *error) {
+static int mount_kill(Unit *u, KillWho who, int signo, DBusError *error) {
         Mount *m = MOUNT(u);
         int r = 0;
         Set *pid_set = NULL;
@@ -1730,23 +1730,25 @@ static int mount_kill(Unit *u, KillWho who, KillMode mode, int signo, DBusError
                         if (kill(m->control_pid, signo) < 0)
                                 r = -errno;
 
-        if (who == KILL_ALL && mode == KILL_CONTROL_GROUP) {
+        if (who == KILL_ALL) {
                 int q;
 
-                if (!(pid_set = set_new(trivial_hash_func, trivial_compare_func)))
+                pid_set = set_new(trivial_hash_func, trivial_compare_func);
+                if (!pid_set)
                         return -ENOMEM;
 
                 /* Exclude the control pid from being killed via the cgroup */
-                if (m->control_pid > 0)
-                        if ((q = set_put(pid_set, LONG_TO_PTR(m->control_pid))) < 0) {
+                if (m->control_pid > 0) {
+                        q = set_put(pid_set, LONG_TO_PTR(m->control_pid));
+                        if (q < 0) {
                                 r = q;
                                 goto finish;
                         }
+                }
 
                 q = cgroup_bonding_kill_list(UNIT(m)->cgroup_bondings, signo, false, false, pid_set, NULL);
-                if (q < 0)
-                        if (q != -EAGAIN && q != -ESRCH && q != -ENOENT)
-                                r = q;
+                if (q < 0 && q != -EAGAIN && q != -ESRCH && q != -ENOENT)
+                        r = q;
         }
 
 finish:
diff --git a/src/core/service.c b/src/core/service.c
index 567e9a4..78f9a59 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -3673,7 +3673,7 @@ static void service_reset_failed(Unit *u) {
         RATELIMIT_RESET(s->start_limit);
 }
 
-static int service_kill(Unit *u, KillWho who, KillMode mode, int signo, DBusError *error) {
+static int service_kill(Unit *u, KillWho who, int signo, DBusError *error) {
         Service *s = SERVICE(u);
         int r = 0;
         Set *pid_set = NULL;
@@ -3700,28 +3700,33 @@ static int service_kill(Unit *u, KillWho who, KillMode mode, int signo, DBusErro
                         if (kill(s->main_pid, signo) < 0)
                                 r = -errno;
 
-        if (who == KILL_ALL && mode == KILL_CONTROL_GROUP) {
+        if (who == KILL_ALL) {
                 int q;
 
-                if (!(pid_set = set_new(trivial_hash_func, trivial_compare_func)))
+                pid_set = set_new(trivial_hash_func, trivial_compare_func);
+                if (!pid_set)
                         return -ENOMEM;
 
                 /* Exclude the control/main pid from being killed via the cgroup */
-                if (s->control_pid > 0)
-                        if ((q = set_put(pid_set, LONG_TO_PTR(s->control_pid))) < 0) {
+                if (s->control_pid > 0) {
+                        q = set_put(pid_set, LONG_TO_PTR(s->control_pid));
+                        if (q < 0) {
                                 r = q;
                                 goto finish;
                         }
+                }
 
-                if (s->main_pid > 0)
-                        if ((q = set_put(pid_set, LONG_TO_PTR(s->main_pid))) < 0) {
+                if (s->main_pid > 0) {
+                        q = set_put(pid_set, LONG_TO_PTR(s->main_pid));
+                        if (q < 0) {
                                 r = q;
                                 goto finish;
                         }
+                }
+
                 q = cgroup_bonding_kill_list(UNIT(s)->cgroup_bondings, signo, false, false, pid_set, NULL);
-                if (q < 0)
-                        if (q != -EAGAIN && q != -ESRCH && q != -ENOENT)
-                                r = q;
+                if (q < 0 && q != -EAGAIN && q != -ESRCH && q != -ENOENT)
+                        r = q;
         }
 
 finish:
diff --git a/src/core/socket.c b/src/core/socket.c
index 6d41787..19b463e 100644
--- a/src/core/socket.c
+++ b/src/core/socket.c
@@ -2104,7 +2104,7 @@ static void socket_reset_failed(Unit *u) {
         s->result = SOCKET_SUCCESS;
 }
 
-static int socket_kill(Unit *u, KillWho who, KillMode mode, int signo, DBusError *error) {
+static int socket_kill(Unit *u, KillWho who, int signo, DBusError *error) {
         Socket *s = SOCKET(u);
         int r = 0;
         Set *pid_set = NULL;
@@ -2126,23 +2126,25 @@ static int socket_kill(Unit *u, KillWho who, KillMode mode, int signo, DBusError
                         if (kill(s->control_pid, signo) < 0)
                                 r = -errno;
 
-        if (who == KILL_ALL && mode == KILL_CONTROL_GROUP) {
+        if (who == KILL_ALL) {
                 int q;
 
-                if (!(pid_set = set_new(trivial_hash_func, trivial_compare_func)))
+                pid_set = set_new(trivial_hash_func, trivial_compare_func);
+                if (!pid_set)
                         return -ENOMEM;
 
                 /* Exclude the control pid from being killed via the cgroup */
-                if (s->control_pid > 0)
-                        if ((q = set_put(pid_set, LONG_TO_PTR(s->control_pid))) < 0) {
+                if (s->control_pid > 0) {
+                        q = set_put(pid_set, LONG_TO_PTR(s->control_pid));
+                        if (q < 0) {
                                 r = q;
                                 goto finish;
                         }
+                }
 
                 q = cgroup_bonding_kill_list(UNIT(s)->cgroup_bondings, signo, false, false, pid_set, NULL);
-                if (q < 0)
-                        if (q != -EAGAIN && q != -ESRCH && q != -ENOENT)
-                                r = q;
+                if (q < 0 && q != -EAGAIN && q != -ESRCH && q != -ENOENT)
+                        r = q;
         }
 
 finish:
diff --git a/src/core/swap.c b/src/core/swap.c
index 03993b1..91bb021 100644
--- a/src/core/swap.c
+++ b/src/core/swap.c
@@ -1260,7 +1260,7 @@ static void swap_reset_failed(Unit *u) {
         s->result = SWAP_SUCCESS;
 }
 
-static int swap_kill(Unit *u, KillWho who, KillMode mode, int signo, DBusError *error) {
+static int swap_kill(Unit *u, KillWho who, int signo, DBusError *error) {
         Swap *s = SWAP(u);
         int r = 0;
         Set *pid_set = NULL;
@@ -1282,23 +1282,25 @@ static int swap_kill(Unit *u, KillWho who, KillMode mode, int signo, DBusError *
                         if (kill(s->control_pid, signo) < 0)
                                 r = -errno;
 
-        if (who == KILL_ALL && mode == KILL_CONTROL_GROUP) {
+        if (who == KILL_ALL) {
                 int q;
 
-                if (!(pid_set = set_new(trivial_hash_func, trivial_compare_func)))
+                pid_set = set_new(trivial_hash_func, trivial_compare_func);
+                if (!pid_set)
                         return -ENOMEM;
 
                 /* Exclude the control pid from being killed via the cgroup */
-                if (s->control_pid > 0)
-                        if ((q = set_put(pid_set, LONG_TO_PTR(s->control_pid))) < 0) {
+                if (s->control_pid > 0) {
+                        q = set_put(pid_set, LONG_TO_PTR(s->control_pid));
+                        if (q < 0) {
                                 r = q;
                                 goto finish;
                         }
+                }
 
                 q = cgroup_bonding_kill_list(UNIT(s)->cgroup_bondings, signo, false, false, pid_set, NULL);
-                if (q < 0)
-                        if (q != -EAGAIN && q != -ESRCH && q != -ENOENT)
-                                r = q;
+                if (q < 0 && q != -EAGAIN && q != -ESRCH && q != -ENOENT)
+                        r = q;
         }
 
 finish:
diff --git a/src/core/unit.c b/src/core/unit.c
index ae6f691..3b416f9 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -2721,20 +2721,16 @@ bool unit_pending_active(Unit *u) {
         return false;
 }
 
-int unit_kill(Unit *u, KillWho w, KillMode m, int signo, DBusError *error) {
+int unit_kill(Unit *u, KillWho w, int signo, DBusError *error) {
         assert(u);
         assert(w >= 0 && w < _KILL_WHO_MAX);
-        assert(m >= 0 && m < _KILL_MODE_MAX);
         assert(signo > 0);
         assert(signo < _NSIG);
 
-        if (m == KILL_NONE)
-                return 0;
-
         if (!UNIT_VTABLE(u)->kill)
                 return -ENOTSUP;
 
-        return UNIT_VTABLE(u)->kill(u, w, m, signo, error);
+        return UNIT_VTABLE(u)->kill(u, w, signo, error);
 }
 
 int unit_following_set(Unit *u, Set **s) {
diff --git a/src/core/unit.h b/src/core/unit.h
index 635293f..f004179 100644
--- a/src/core/unit.h
+++ b/src/core/unit.h
@@ -293,7 +293,7 @@ struct UnitVTable {
         int (*stop)(Unit *u);
         int (*reload)(Unit *u);
 
-        int (*kill)(Unit *u, KillWho w, KillMode m, int signo, DBusError *error);
+        int (*kill)(Unit *u, KillWho w, int signo, DBusError *error);
 
         bool (*can_reload)(Unit *u);
 
@@ -468,7 +468,7 @@ int unit_start(Unit *u);
 int unit_stop(Unit *u);
 int unit_reload(Unit *u);
 
-int unit_kill(Unit *u, KillWho w, KillMode m, int signo, DBusError *error);
+int unit_kill(Unit *u, KillWho w, int signo, DBusError *error);
 
 void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns, bool reload_success);
 
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 344dcd3..e587cfb 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -86,7 +86,6 @@ static bool arg_failed = false;
 static bool arg_runtime = false;
 static char **arg_wall = NULL;
 static const char *arg_kill_who = NULL;
-static const char *arg_kill_mode = NULL;
 static int arg_signal = SIGTERM;
 static const char *arg_root = NULL;
 static usec_t arg_when = 0;
@@ -2140,9 +2139,6 @@ static int kill_unit(DBusConnection *bus, char **args) {
         if (!arg_kill_who)
                 arg_kill_who = "all";
 
-        if (!arg_kill_mode)
-                arg_kill_mode = streq(arg_kill_who, "all") ? "control-group" : "process";
-
         STRV_FOREACH(name, args+1) {
                 DBusMessage *reply;
                 char *n;
@@ -2163,7 +2159,6 @@ static int kill_unit(DBusConnection *bus, char **args) {
                 b = dbus_message_append_args(m,
                                              DBUS_TYPE_STRING, n ? &n : name,
                                              DBUS_TYPE_STRING, &arg_kill_who,
-                                             DBUS_TYPE_STRING, &arg_kill_mode,
                                              DBUS_TYPE_INT32, &arg_signal,
                                              DBUS_TYPE_INVALID);
                 free(n);
@@ -4593,7 +4588,6 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
                 ARG_ROOT,
                 ARG_FULL,
                 ARG_NO_RELOAD,
-                ARG_KILL_MODE,
                 ARG_KILL_WHO,
                 ARG_NO_ASK_PASSWORD,
                 ARG_FAILED,
@@ -4625,7 +4619,6 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
                 { "root",      required_argument, NULL, ARG_ROOT      },
                 { "force",     no_argument,       NULL, ARG_FORCE     },
                 { "no-reload", no_argument,       NULL, ARG_NO_RELOAD },
-                { "kill-mode", required_argument, NULL, ARG_KILL_MODE }, /* undocumented on purpose */
                 { "kill-who",  required_argument, NULL, ARG_KILL_WHO  },
                 { "signal",    required_argument, NULL, 's'           },
                 { "no-ask-password", no_argument, NULL, ARG_NO_ASK_PASSWORD },
@@ -4771,10 +4764,6 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
                         arg_kill_who = optarg;
                         break;
 
-                case ARG_KILL_MODE:
-                        arg_kill_mode = optarg;
-                        break;
-
                 case 's':
                         if ((arg_signal = signal_from_string_try_harder(optarg)) < 0) {
                                 log_error("Failed to parse signal string %s.", optarg);

commit 4819ff0358b6317c195fd4b1768e03d09c871070
Author: Lennart Poettering <lennart at poettering.net>
Date:   Thu Jul 19 23:47:10 2012 +0200

    unit: split off KillContext from ExecContext containing only kill definitions

diff --git a/Makefile.am b/Makefile.am
index b15b9f5..655d9bf 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -455,6 +455,7 @@ MANPAGES = \
 	man/systemd.device.5 \
 	man/systemd.snapshot.5 \
 	man/systemd.exec.5 \
+	man/systemd.kill.5 \
 	man/systemd.special.7 \
 	man/systemd.journal-fields.7 \
 	man/kernel-command-line.7 \
@@ -904,6 +905,8 @@ libsystemd_core_la_SOURCES = \
 	src/core/load-dropin.h \
 	src/core/execute.c \
 	src/core/execute.h \
+	src/core/kill.c \
+	src/core/kill.h \
 	src/core/dbus.c \
 	src/core/dbus.h \
 	src/core/dbus-manager.c \
@@ -932,6 +935,8 @@ libsystemd_core_la_SOURCES = \
 	src/core/dbus-device.h \
 	src/core/dbus-execute.c \
 	src/core/dbus-execute.h \
+	src/core/dbus-kill.c \
+	src/core/dbus-kill.h \
 	src/core/dbus-path.c \
 	src/core/dbus-path.h \
 	src/core/cgroup.c \
diff --git a/man/systemd.exec.xml b/man/systemd.exec.xml
index 6e55d8d..e1193d2 100644
--- a/man/systemd.exec.xml
+++ b/man/systemd.exec.xml
@@ -1152,7 +1152,8 @@
                           <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
                           <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
                           <citerefentry><refentrytitle>systemd.swap</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
-                          <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+                          <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
+                          <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>
                   </para>
         </refsect1>
 
diff --git a/man/systemd.kill.xml b/man/systemd.kill.xml
new file mode 100644
index 0000000..3300534
--- /dev/null
+++ b/man/systemd.kill.xml
@@ -0,0 +1,170 @@
+<?xml version='1.0'?> <!--*-nxml-*-->
+<?xml-stylesheet type="text/xsl" href="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+        "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<!--
+  This file is part of systemd.
+
+  Copyright 2012 Lennart Poettering
+
+  systemd is free software; you can redistribute it and/or modify it
+  under the terms of the GNU Lesser General Public License as published by
+  the Free Software Foundation; either version 2.1 of the License, or
+  (at your option) any later version.
+
+  systemd is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  Lesser General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public License
+  along with systemd; If not, see <http://www.gnu.org/licenses/>.
+-->
+
+<refentry id="systemd.kill">
+        <refentryinfo>
+                <title>systemd.kill</title>
+                <productname>systemd</productname>
+
+                <authorgroup>
+                        <author>
+                                <contrib>Developer</contrib>
+                                <firstname>Lennart</firstname>
+                                <surname>Poettering</surname>
+                                <email>lennart at poettering.net</email>
+                        </author>
+                </authorgroup>
+        </refentryinfo>
+
+        <refmeta>
+                <refentrytitle>systemd.kill</refentrytitle>
+                <manvolnum>5</manvolnum>
+        </refmeta>
+
+        <refnamediv>
+                <refname>systemd.kill</refname>
+                <refpurpose>Kill environment configuration</refpurpose>
+        </refnamediv>
+
+        <refsynopsisdiv>
+                <para><filename>systemd.service</filename>,
+                <filename>systemd.socket</filename>,
+                <filename>systemd.mount</filename>,
+                <filename>systemd.swap</filename></para>
+        </refsynopsisdiv>
+
+        <refsect1>
+                <title>Description</title>
+
+                <para>Unit configuration files for services, sockets,
+                mount points and swap devices share a subset of
+                configuration options which define the process killing
+                parameters of spawned processes.</para>
+
+                <para>This man page lists the configuration options
+                shared by these four unit types. See
+                <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+                for the common options of all unit configuration
+                files, and
+                <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
+                <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
+                <citerefentry><refentrytitle>systemd.swap</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+                and
+                <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+                for more information on the specific unit
+                configuration files. The execution specific
+                configuration options are configured in the [Service],
+                [Socket], [Mount] resp. [Swap] section, depending on the unit
+                type.</para>
+        </refsect1>
+
+        <refsect1>
+                <title>Options</title>
+
+                <variablelist>
+
+                        <varlistentry>
+                                <term><varname>KillMode=</varname></term>
+                                <listitem><para>Specifies how
+                                processes of this service shall be
+                                killed. One of
+                                <option>control-group</option>,
+                                <option>process</option>,
+                                <option>none</option>.</para>
+
+                                <para>If set to
+                                <option>control-group</option> all
+                                remaining processes in the control
+                                group of this unit will be terminated
+                                on unit stop (for services: after the
+                                stop command is executed, as
+                                configured with
+                                <varname>ExecStop=</varname>). If set
+                                to <option>process</option> only the
+                                main process itself is killed. If set
+                                to <option>none</option> no process is
+                                killed. In this case only the stop
+                                command will be executed on unit
+                                stop, but no process be killed
+                                otherwise. Processes remaining alive
+                                after stop are left in their control
+                                group and the control group continues
+                                to exist after stop unless it is
+                                empty. Defaults to
+                                <option>control-group</option>.</para>
+
+                                <para>Processes will first be
+                                terminated via SIGTERM (unless the
+                                signal to send is changed via
+                                <varname>KillSignal=</varname>). If
+                                then after a delay (configured via the
+                                <varname>TimeoutSec=</varname> option)
+                                processes still remain, the
+                                termination request is repeated with
+                                the SIGKILL signal (unless this is
+                                disabled via the
+                                <varname>SendSIGKILL=</varname>
+                                option). See
+                                <citerefentry><refentrytitle>kill</refentrytitle><manvolnum>2</manvolnum></citerefentry>
+                                for more
+                                information.</para></listitem>
+                        </varlistentry>
+
+                        <varlistentry>
+                                <term><varname>KillSignal=</varname></term>
+                                <listitem><para>Specifies which signal
+                                to use when killing a
+                                service. Defaults to SIGTERM.
+                                </para></listitem>
+                        </varlistentry>
+
+                        <varlistentry>
+                                <term><varname>SendSIGKILL=</varname></term>
+                                <listitem><para>Specifies whether to
+                                send SIGKILL to remaining processes
+                                after a timeout, if the normal
+                                shutdown procedure left processes of
+                                the service around. Takes a boolean
+                                value. Defaults to "yes".
+                                </para></listitem>
+                        </varlistentry>
+                </variablelist>
+        </refsect1>
+
+        <refsect1>
+                  <title>See Also</title>
+                  <para>
+                          <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+                          <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+                          <citerefentry><refentrytitle>journalctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+                          <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
+                          <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
+                          <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
+                          <citerefentry><refentrytitle>systemd.swap</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
+                          <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
+                          <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+                  </para>
+        </refsect1>
+
+</refentry>
diff --git a/man/systemd.mount.xml b/man/systemd.mount.xml
index 105afb4..bcaae33 100644
--- a/man/systemd.mount.xml
+++ b/man/systemd.mount.xml
@@ -72,7 +72,10 @@
                 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
                 which define the execution environment the
                 <citerefentry><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry>
-                binary is executed in.</para>
+                binary is executed in, and in
+                <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+                which define the way the processes are
+                terminated.</para>
 
                 <para>Mount units must be named after the mount point
                 directories they control. Example: the mount point
@@ -147,7 +150,9 @@
                 supervises. A number of options that may be used in
                 this section are shared with other unit types. These
                 options are documented in
-                <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>. The
+                <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+                and
+                <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>. The
                 options specific to the [Mount] section of mount
                 units are the following:</para>
 
@@ -220,50 +225,21 @@
                                 will be terminated forcibly via
                                 SIGTERM, and after another delay of
                                 this time with SIGKILL. (See
-                                <option>KillMode=</option> below.)
+                                <option>KillMode=</option> in
+                                <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>.)
                                 Takes a unit-less value in seconds, or
                                 a time span value such as "5min
                                 20s". Pass 0 to disable the timeout
                                 logic. Defaults to
                                 90s.</para></listitem>
                         </varlistentry>
-
-                        <varlistentry>
-                                <term><varname>KillMode=</varname></term>
-                                <listitem><para>Specifies how
-                                processes of this mount shall be
-                                killed. One of
-                                <option>control-group</option>,
-                                <option>process</option>,
-                                <option>none</option>.</para>
-
-                                <para>This option is mostly equivalent
-                                to the <option>KillMode=</option>
-                                option of service files. See
-                                <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>
-                                for details.</para></listitem>
-                        </varlistentry>
-
-                        <varlistentry>
-                                <term><varname>KillSignal=</varname></term>
-                                <listitem><para>Specifies which signal
-                                to use when killing a process of this
-                                mount. Defaults to SIGTERM.
-                                </para></listitem>
-                        </varlistentry>
-
-                        <varlistentry>
-                                <term><varname>SendSIGKILL=</varname></term>
-                                <listitem><para>Specifies whether to
-                                send SIGKILL to remaining processes
-                                after a timeout, if the normal
-                                shutdown procedure left processes of
-                                the mount around. Takes a boolean
-                                value. Defaults to "yes".
-                                </para></listitem>
-                        </varlistentry>
-
                 </variablelist>
+
+                <para>Check
+                <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+                and
+                <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+                for more settings.</para>
         </refsect1>
 
         <refsect1>
@@ -295,6 +271,7 @@
                           <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
                           <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
                           <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
+                          <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
                           <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
                           <citerefentry><refentrytitle>systemd.device</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
                           <citerefentry><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
diff --git a/man/systemd.service.xml b/man/systemd.service.xml
index 38a4035..f43201d 100644
--- a/man/systemd.service.xml
+++ b/man/systemd.service.xml
@@ -72,7 +72,10 @@
                 <para>Additional options are listed in
                 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
                 which define the execution environment the commands
-                are executed in.</para>
+                are executed in, and in
+                <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+                which define the way the processes of the service are
+                terminated.</para>
 
                 <para>Unless <varname>DefaultDependencies=</varname>
                 is set to <option>false</option>, service units will
@@ -112,7 +115,9 @@
                 supervises. A number of options that may be used in
                 this section are shared with other unit types. These
                 options are documented in
-                <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>. The
+                <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+                and
+                <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>. The
                 options specific to the <literal>[Service]</literal>
                 section of service units are the following:</para>
 
@@ -417,12 +422,13 @@
                                 configured in this option are run are
                                 terminated according to the
                                 <varname>KillMode=</varname> setting
-                                (see below). If this option is not
-                                specified the process is terminated
-                                right-away when service stop is
-                                requested. Specifier and environment
-                                variable substitution is supported
-                                (including
+                                (see
+                                <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>). If
+                                this option is not specified the
+                                process is terminated right-away when
+                                service stop is requested. Specifier
+                                and environment variable substitution
+                                is supported (including
                                 <literal>$MAINPID</literal>, see
                                 above).</para></listitem>
                         </varlistentry>
@@ -471,7 +477,7 @@
                                 another delay of this time with
                                 SIGKILL. (See
                                 <varname>KillMode=</varname>
-                                below.) Takes a unit-less value in seconds, or a
+                                in <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>) Takes a unit-less value in seconds, or a
                                 time span value such as "5min
                                 20s". Pass 0 to disable the timeout
                                 logic. Defaults to
@@ -599,72 +605,6 @@
                         </varlistentry>
 
                         <varlistentry>
-                                <term><varname>KillMode=</varname></term>
-                                <listitem><para>Specifies how
-                                processes of this service shall be
-                                killed. One of
-                                <option>control-group</option>,
-                                <option>process</option>,
-                                <option>none</option>.</para>
-
-                                <para>If set to
-                                <option>control-group</option> all
-                                remaining processes in the control
-                                group of this service will be
-                                terminated on service stop, after the
-                                stop command (as configured with
-                                <varname>ExecStop=</varname>) is
-                                executed. If set to
-                                <option>process</option> only the main
-                                process itself is killed. If set to
-                                <option>none</option> no process is
-                                killed. In this case only the stop
-                                command will be executed on service
-                                stop, but no process be killed
-                                otherwise. Processes remaining alive
-                                after stop are left in their control
-                                group and the control group continues
-                                to exist after stop unless it is
-                                empty. Defaults to
-                                <option>control-group</option>.</para>
-
-                                <para>Processes will first be
-                                terminated via SIGTERM (unless the
-                                signal to send is changed via
-                                <varname>KillSignal=</varname>). If
-                                then after a delay (configured via the
-                                <varname>TimeoutSec=</varname> option)
-                                processes still remain, the
-                                termination request is repeated with
-                                the SIGKILL signal (unless this is
-                                disabled via the
-                                <varname>SendSIGKILL=</varname>
-                                option). See
-                                <citerefentry><refentrytitle>kill</refentrytitle><manvolnum>2</manvolnum></citerefentry>
-                                for more
-                                information.</para></listitem>
-                        </varlistentry>
-
-                        <varlistentry>
-                                <term><varname>KillSignal=</varname></term>
-                                <listitem><para>Specifies which signal
-                                to use when killing a
-                                service. Defaults to SIGTERM.
-                                </para></listitem>
-                        </varlistentry>
-
-                        <varlistentry>
-                                <term><varname>SendSIGKILL=</varname></term>
-                                <listitem><para>Specifies whether to
-                                send SIGKILL to remaining processes
-                                after a timeout, if the normal
-                                shutdown procedure left processes of
-                                the service around. Takes a boolean
-                                value. Defaults to "yes".
-                                </para></listitem>
-                        </varlistentry>
-
-                        <varlistentry>
                                 <term><varname>NonBlocking=</varname></term>
                                 <listitem><para>Set O_NONBLOCK flag
                                 for all file descriptors passed via
@@ -818,6 +758,13 @@
                         </varlistentry>
 
                 </variablelist>
+
+                <para>Check
+                <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+                and
+                <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+                for more settings.</para>
+
         </refsect1>
 
         <refsect1>
@@ -888,7 +835,8 @@
                           <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
                           <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
                           <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
-                          <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+                          <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
+                          <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>
                   </para>
         </refsect1>
 
diff --git a/man/systemd.socket.xml b/man/systemd.socket.xml
index 5ca1c7a..8a12e25 100644
--- a/man/systemd.socket.xml
+++ b/man/systemd.socket.xml
@@ -76,7 +76,10 @@
                 <option>ExecStartPost=</option>,
                 <option>ExecStopPre=</option> and
                 <option>ExecStoptPost=</option> commands are executed
-                in.</para>
+                in, and in
+                <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+                which define the way the processes are
+                terminated.</para>
 
                 <para>For each socket file a matching service file
                 (see
@@ -134,7 +137,9 @@
                 supervises. A number of options that may be used in
                 this section are shared with other unit types. These
                 options are documented in
-                <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>. The
+                <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+                and
+                <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>. The
                 options specific to the [Socket] section of socket
                 units are the following:</para>
 
@@ -603,7 +608,7 @@
                                 will be terminated forcibly via
                                 SIGTERM, and after another delay of
                                 this time with SIGKILL. (See
-                                <option>KillMode=</option> below.)
+                                <option>KillMode=</option> in <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>.)
                                 Takes a unit-less value in seconds, or
                                 a time span value such as "5min
                                 20s". Pass 0 to disable the timeout
@@ -612,41 +617,6 @@
                         </varlistentry>
 
                         <varlistentry>
-                                <term><varname>KillMode=</varname></term>
-                                <listitem><para>Specifies how
-                                processes of this socket unit shall be
-                                killed. One of
-                                <option>control-group</option>,
-                                <option>process</option>,
-                                <option>none</option>.</para>
-
-                                <para>This option is mostly equivalent
-                                to the <option>KillMode=</option>
-                                option of service files. See
-                                <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>
-                                for details.</para></listitem>
-                        </varlistentry>
-
-                        <varlistentry>
-                                <term><varname>KillSignal=</varname></term>
-                                <listitem><para>Specifies which signal
-                                to use when killing a process of this
-                                socket. Defaults to SIGTERM.
-                                </para></listitem>
-                        </varlistentry>
-
-                        <varlistentry>
-                                <term><varname>SendSIGKILL=</varname></term>
-                                <listitem><para>Specifies whether to
-                                send SIGKILL to remaining processes
-                                after a timeout, if the normal
-                                shutdown procedure left processes of
-                                the socket around. Takes a boolean
-                                value. Defaults to "yes".
-                                </para></listitem>
-                        </varlistentry>
-
-                        <varlistentry>
                                 <term><varname>Service=</varname></term>
                                 <listitem><para>Specifies the service
                                 unit name to activate on incoming
@@ -658,6 +628,13 @@
                         </varlistentry>
 
                 </variablelist>
+
+                <para>Check
+                <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+                and
+                <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+                for more settings.</para>
+
         </refsect1>
 
         <refsect1>
@@ -667,6 +644,7 @@
                           <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
                           <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
                           <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
+                          <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
                           <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>
                   </para>
         </refsect1>
diff --git a/man/systemd.swap.xml b/man/systemd.swap.xml
index aaf77f8..5eb008d 100644
--- a/man/systemd.swap.xml
+++ b/man/systemd.swap.xml
@@ -68,6 +68,15 @@
                 specific configuration options are configured in the
                 [Swap] section.</para>
 
+                <para>Additional options are listed in
+                <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
+                which define the execution environment the
+                <citerefentry><refentrytitle>swapon</refentrytitle><manvolnum>8</manvolnum></citerefentry>
+                binary is executed in, and in
+                <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+                which define the way the processes are
+                terminated.</para>
+
                 <para>Swap units must be named after the devices
                 (resp. files) they control. Example: the swap device
                 <filename>/dev/sda5</filename> must be configured in a
@@ -121,7 +130,9 @@
                 supervises. A number of options that may be used in
                 this section are shared with other unit types. These
                 options are documented in
-                <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>. The
+                <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+                and
+                <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>. The
                 options specific to the [Swap] section of swap units
                 are the following:</para>
 
@@ -167,49 +178,21 @@
                                 will be terminated forcibly via
                                 SIGTERM, and after another delay of
                                 this time with SIGKILL. (See
-                                <option>KillMode=</option> below.)
+                                <option>KillMode=</option> in
+                                <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>.)
                                 Takes a unit-less value in seconds, or
                                 a time span value such as "5min
                                 20s". Pass 0 to disable the timeout
                                 logic. Defaults to
                                 90s.</para></listitem>
                         </varlistentry>
-
-                        <varlistentry>
-                                <term><varname>KillMode=</varname></term>
-                                <listitem><para>Specifies how
-                                processes of this swap shall be
-                                killed. One of
-                                <option>control-group</option>,
-                                <option>process</option>,
-                                <option>none</option>.</para>
-
-                                <para>This option is mostly equivalent
-                                to the <option>KillMode=</option>
-                                option of service files. See
-                                <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>
-                                for details.</para></listitem>
-                        </varlistentry>
-
-                        <varlistentry>
-                                <term><varname>KillSignal=</varname></term>
-                                <listitem><para>Specifies which signal
-                                to use when killing a process of this
-                                swap. Defaults to SIGTERM.
-                                </para></listitem>
-                        </varlistentry>
-
-                        <varlistentry>
-                                <term><varname>SendSIGKILL=</varname></term>
-                                <listitem><para>Specifies whether to
-                                send SIGKILL to remaining processes
-                                after a timeout, if the normal
-                                shutdown procedure left processes of
-                                the swap around. Takes a boolean
-                                value. Defaults to "yes".
-                                </para></listitem>
-                        </varlistentry>
                 </variablelist>
+
+                <para>Check
+                <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+                and
+                <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+                for more settings.</para>
         </refsect1>
 
         <refsect1>
@@ -219,6 +202,7 @@
                           <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
                           <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
                           <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
+                          <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
                           <citerefentry><refentrytitle>systemd.device</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
                           <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
                           <citerefentry><refentrytitle>swapon</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
diff --git a/src/core/dbus-execute.c b/src/core/dbus-execute.c
index a00ad50..e815cb5 100644
--- a/src/core/dbus-execute.c
+++ b/src/core/dbus-execute.c
@@ -30,8 +30,6 @@
 #include "dbus-common.h"
 #include "syscall-list.h"
 
-DEFINE_BUS_PROPERTY_APPEND_ENUM(bus_execute_append_kill_mode, kill_mode, KillMode);
-
 DEFINE_BUS_PROPERTY_APPEND_ENUM(bus_execute_append_input, exec_input, ExecInput);
 DEFINE_BUS_PROPERTY_APPEND_ENUM(bus_execute_append_output, exec_output, ExecOutput);
 
@@ -431,8 +429,6 @@ const BusProperty bus_exec_context_properties[] = {
         { "PrivateTmp",               bus_property_append_bool,              "b", offsetof(ExecContext, private_tmp)                  },
         { "PrivateNetwork",           bus_property_append_bool,              "b", offsetof(ExecContext, private_network)              },
         { "SameProcessGroup",         bus_property_append_bool,              "b", offsetof(ExecContext, same_pgrp)                    },
-        { "KillMode",                 bus_execute_append_kill_mode,          "s", offsetof(ExecContext, kill_mode)                    },
-        { "KillSignal",               bus_property_append_int,               "i", offsetof(ExecContext, kill_signal)                  },
         { "UtmpIdentifier",           bus_property_append_string,            "s", offsetof(ExecContext, utmp_id),                true },
         { "ControlGroupModify",       bus_property_append_bool,              "b", offsetof(ExecContext, control_group_modify)         },
         { "ControlGroupPersistent",   bus_property_append_tristate_false,    "b", offsetof(ExecContext, control_group_persistent)     },
diff --git a/src/core/dbus-execute.h b/src/core/dbus-execute.h
index feb8833..eaa1b73 100644
--- a/src/core/dbus-execute.h
+++ b/src/core/dbus-execute.h
@@ -120,6 +120,5 @@ int bus_execute_append_capabilities(DBusMessageIter *i, const char *property, vo
 int bus_execute_append_capability_bs(DBusMessageIter *i, const char *property, void *data);
 int bus_execute_append_rlimits(DBusMessageIter *i, const char *property, void *data);
 int bus_execute_append_command(DBusMessageIter *u, const char *property, void *data);
-int bus_execute_append_kill_mode(DBusMessageIter *i, const char *property, void *data);
 int bus_execute_append_env_files(DBusMessageIter *i, const char *property, void *data);
 int bus_execute_append_syscall_filter(DBusMessageIter *i, const char *property, void *data);
diff --git a/src/core/dbus-kill.c b/src/core/dbus-kill.c
new file mode 100644
index 0000000..165f630
--- /dev/null
+++ b/src/core/dbus-kill.c
@@ -0,0 +1,35 @@
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
+
+/***
+  This file is part of systemd.
+
+  Copyright 2012 Lennart Poettering
+
+  systemd is free software; you can redistribute it and/or modify it
+  under the terms of the GNU Lesser General Public License as published by
+  the Free Software Foundation; either version 2.1 of the License, or
+  (at your option) any later version.
+
+  systemd is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  Lesser General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public License
+  along with systemd; If not, see <http://www.gnu.org/licenses/>.
+***/
+
+#include <errno.h>
+#include <dbus/dbus.h>
+
+#include "dbus-kill.h"
+#include "dbus-common.h"
+
+DEFINE_BUS_PROPERTY_APPEND_ENUM(bus_kill_append_mode, kill_mode, KillMode);
+
+const BusProperty bus_kill_context_properties[] = {
+        { "KillMode",    bus_kill_append_mode,     "s", offsetof(KillContext, kill_mode)    },
+        { "KillSignal",  bus_property_append_int,  "i", offsetof(KillContext, kill_signal)  },
+        { "SendSIGKILL", bus_property_append_bool, "b", offsetof(KillContext, send_sigkill) },
+        { NULL, }
+};
diff --git a/src/core/dbus-kill.h b/src/core/dbus-kill.h
new file mode 100644
index 0000000..238fbd3
--- /dev/null
+++ b/src/core/dbus-kill.h
@@ -0,0 +1,39 @@
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
+
+#pragma once
+
+/***
+  This file is part of systemd.
+
+  Copyright 2012 Lennart Poettering
+
+  systemd is free software; you can redistribute it and/or modify it
+  under the terms of the GNU Lesser General Public License as published by
+  the Free Software Foundation; either version 2.1 of the License, or
+  (at your option) any later version.
+
+  systemd is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  Lesser General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public License
+  along with systemd; If not, see <http://www.gnu.org/licenses/>.
+***/
+
+#include <dbus/dbus.h>
+
+#include "manager.h"
+#include "dbus-common.h"
+
+#define BUS_KILL_CONTEXT_INTERFACE                                      \
+        "  <property name=\"KillMode\" type=\"s\" access=\"read\"/>\n"  \
+        "  <property name=\"KillSignal\" type=\"i\" access=\"read\"/>\n" \
+        "  <property name=\"SendSIGKILL\" type=\"b\" access=\"read\"/>\n"
+
+#define BUS_KILL_COMMAND_INTERFACE(name)                                \
+        "  <property name=\"" name "\" type=\"a(sasbttuii)\" access=\"read\"/>\n"
+
+extern const BusProperty bus_kill_context_properties[];
+
+int bus_kill_append_mode(DBusMessageIter *i, const char *property, void *data);
diff --git a/src/core/dbus-mount.c b/src/core/dbus-mount.c
index 26b04ab..93bfa4c 100644
--- a/src/core/dbus-mount.c
+++ b/src/core/dbus-mount.c
@@ -23,6 +23,7 @@
 
 #include "dbus-unit.h"
 #include "dbus-mount.h"
+#include "dbus-kill.h"
 #include "dbus-execute.h"
 #include "dbus-common.h"
 
@@ -37,6 +38,7 @@
         BUS_EXEC_COMMAND_INTERFACE("ExecUnmount")                       \
         BUS_EXEC_COMMAND_INTERFACE("ExecRemount")                       \
         BUS_EXEC_CONTEXT_INTERFACE                                      \
+        BUS_KILL_CONTEXT_INTERFACE                                      \
         "  <property name=\"ControlPID\" type=\"u\" access=\"read\"/>\n" \
         "  <property name=\"DirectoryMode\" type=\"u\" access=\"read\"/>\n" \
         "  <property name=\"Result\" type=\"s\" access=\"read\"/>\n"    \
@@ -155,6 +157,7 @@ DBusHandlerResult bus_mount_message_handler(Unit *u, DBusConnection *c, DBusMess
                 { "org.freedesktop.systemd1.Unit",  bus_unit_properties,         u },
                 { "org.freedesktop.systemd1.Mount", bus_mount_properties,        m },
                 { "org.freedesktop.systemd1.Mount", bus_exec_context_properties, &m->exec_context },
+                { "org.freedesktop.systemd1.Mount", bus_kill_context_properties, &m->kill_context },
                 { NULL, }
         };
 
diff --git a/src/core/dbus-service.c b/src/core/dbus-service.c
index 6568cd5..c0fac16 100644
--- a/src/core/dbus-service.c
+++ b/src/core/dbus-service.c
@@ -23,6 +23,7 @@
 
 #include "dbus-unit.h"
 #include "dbus-execute.h"
+#include "dbus-kill.h"
 #include "dbus-service.h"
 #include "dbus-common.h"
 
@@ -47,6 +48,7 @@
         BUS_EXEC_COMMAND_INTERFACE("ExecStop")                          \
         BUS_EXEC_COMMAND_INTERFACE("ExecStopPost")                      \
         BUS_EXEC_CONTEXT_INTERFACE                                      \
+        BUS_KILL_CONTEXT_INTERFACE                                      \
         "  <property name=\"PermissionsStartOnly\" type=\"b\" access=\"read\"/>\n" \
         "  <property name=\"RootDirectoryStartOnly\" type=\"b\" access=\"read\"/>\n" \
         "  <property name=\"RemainAfterExit\" type=\"b\" access=\"read\"/>\n" \
@@ -140,10 +142,12 @@ static const BusProperty bus_service_properties[] = {
 
 DBusHandlerResult bus_service_message_handler(Unit *u, DBusConnection *connection, DBusMessage *message) {
         Service *s = SERVICE(u);
+
         const BusBoundProperties bps[] = {
                 { "org.freedesktop.systemd1.Unit",    bus_unit_properties,             u },
                 { "org.freedesktop.systemd1.Service", bus_service_properties,          s },
                 { "org.freedesktop.systemd1.Service", bus_exec_context_properties,     &s->exec_context },
+                { "org.freedesktop.systemd1.Service", bus_kill_context_properties,     &s->kill_context },
                 { "org.freedesktop.systemd1.Service", bus_exec_main_status_properties, &s->main_exec_status },
                 { NULL, }
         };
diff --git a/src/core/dbus-socket.c b/src/core/dbus-socket.c
index 80d19dd..b204522 100644
--- a/src/core/dbus-socket.c
+++ b/src/core/dbus-socket.c
@@ -24,6 +24,7 @@
 #include "dbus-unit.h"
 #include "dbus-socket.h"
 #include "dbus-execute.h"
+#include "dbus-kill.h"
 #include "dbus-common.h"
 
 #define BUS_SOCKET_INTERFACE                                            \
@@ -36,6 +37,7 @@
         BUS_EXEC_COMMAND_INTERFACE("ExecStopPre")                       \
         BUS_EXEC_COMMAND_INTERFACE("ExecStopPost")                      \
         BUS_EXEC_CONTEXT_INTERFACE                                      \
+        BUS_KILL_CONTEXT_INTERFACE                                      \
         "  <property name=\"ControlPID\" type=\"u\" access=\"read\"/>\n" \
         "  <property name=\"BindToDevice\" type=\"s\" access=\"read\"/>\n" \
         "  <property name=\"DirectoryMode\" type=\"u\" access=\"read\"/>\n" \
@@ -132,6 +134,7 @@ DBusHandlerResult bus_socket_message_handler(Unit *u, DBusConnection *c, DBusMes
                 { "org.freedesktop.systemd1.Unit",   bus_unit_properties,         u },
                 { "org.freedesktop.systemd1.Socket", bus_socket_properties,       s },
                 { "org.freedesktop.systemd1.Socket", bus_exec_context_properties, &s->exec_context },
+                { "org.freedesktop.systemd1.Socket", bus_kill_context_properties, &s->kill_context },
                 { NULL, }
         };
 
diff --git a/src/core/dbus-swap.c b/src/core/dbus-swap.c
index 3ede0e6..cad6ec1 100644
--- a/src/core/dbus-swap.c
+++ b/src/core/dbus-swap.c
@@ -25,6 +25,7 @@
 #include "dbus-unit.h"
 #include "dbus-swap.h"
 #include "dbus-execute.h"
+#include "dbus-kill.h"
 #include "dbus-common.h"
 
 #define BUS_SWAP_INTERFACE                                              \
@@ -35,6 +36,7 @@
         BUS_EXEC_COMMAND_INTERFACE("ExecActivate")                      \
         BUS_EXEC_COMMAND_INTERFACE("ExecDeactivate")                    \
         BUS_EXEC_CONTEXT_INTERFACE                                      \
+        BUS_KILL_CONTEXT_INTERFACE                                      \
         "  <property name=\"ControlPID\" type=\"u\" access=\"read\"/>\n" \
         "  <property name=\"Result\" type=\"s\" access=\"read\"/>\n"    \
         " </interface>\n"
@@ -102,6 +104,7 @@ DBusHandlerResult bus_swap_message_handler(Unit *u, DBusConnection *c, DBusMessa
                 { "org.freedesktop.systemd1.Unit", bus_unit_properties,         u },
                 { "org.freedesktop.systemd1.Swap", bus_swap_properties,         s },
                 { "org.freedesktop.systemd1.Swap", bus_exec_context_properties, &s->exec_context },
+                { "org.freedesktop.systemd1.Swap", bus_kill_context_properties, &s->kill_context },
                 { NULL, }
         };
 
diff --git a/src/core/execute.c b/src/core/execute.c
index db4a8ae..fc0edc6 100644
--- a/src/core/execute.c
+++ b/src/core/execute.c
@@ -1541,8 +1541,6 @@ void exec_context_init(ExecContext *c) {
         c->syslog_priority = LOG_DAEMON|LOG_INFO;
         c->syslog_level_prefix = true;
         c->mount_flags = MS_SHARED;
-        c->kill_signal = SIGTERM;
-        c->send_sigkill = true;
         c->control_group_persistent = -1;
         c->ignore_sigpipe = true;
         c->timer_slack_nsec = (nsec_t) -1;
@@ -1735,7 +1733,8 @@ void exec_context_dump(ExecContext *c, FILE* f, const char *prefix) {
                 "%sPrivateTmp: %s\n"
                 "%sControlGroupModify: %s\n"
                 "%sControlGroupPersistent: %s\n"
-                "%sPrivateNetwork: %s\n",
+                "%sPrivateNetwork: %s\n"
+                "%sIgnoreSIGPIPE: %s\n",
                 prefix, c->umask,
                 prefix, c->working_directory ? c->working_directory : "/",
                 prefix, c->root_directory ? c->root_directory : "/",
@@ -1743,7 +1742,8 @@ void exec_context_dump(ExecContext *c, FILE* f, const char *prefix) {
                 prefix, yes_no(c->private_tmp),
                 prefix, yes_no(c->control_group_modify),
                 prefix, yes_no(c->control_group_persistent),
-                prefix, yes_no(c->private_network));
+                prefix, yes_no(c->private_network),
+                prefix, yes_no(c->ignore_sigpipe));
 
         STRV_FOREACH(e, c->environment)
                 fprintf(f, "%sEnvironment: %s\n", prefix, *e);
@@ -1894,16 +1894,6 @@ void exec_context_dump(ExecContext *c, FILE* f, const char *prefix) {
                 fputs("\n", f);
         }
 
-        fprintf(f,
-                "%sKillMode: %s\n"
-                "%sKillSignal: SIG%s\n"
-                "%sSendSIGKILL: %s\n"
-                "%sIgnoreSIGPIPE: %s\n",
-                prefix, kill_mode_to_string(c->kill_mode),
-                prefix, signal_to_string(c->kill_signal),
-                prefix, yes_no(c->send_sigkill),
-                prefix, yes_no(c->ignore_sigpipe));
-
         if (c->utmp_id)
                 fprintf(f,
                         "%sUtmpIdentifier: %s\n",
@@ -2111,19 +2101,3 @@ static const char* const exec_output_table[_EXEC_OUTPUT_MAX] = {
 };
 
 DEFINE_STRING_TABLE_LOOKUP(exec_output, ExecOutput);
-
-static const char* const kill_mode_table[_KILL_MODE_MAX] = {
-        [KILL_CONTROL_GROUP] = "control-group",
-        [KILL_PROCESS] = "process",
-        [KILL_NONE] = "none"
-};
-
-DEFINE_STRING_TABLE_LOOKUP(kill_mode, KillMode);
-
-static const char* const kill_who_table[_KILL_WHO_MAX] = {
-        [KILL_MAIN] = "main",
-        [KILL_CONTROL] = "control",
-        [KILL_ALL] = "all"
-};
-
-DEFINE_STRING_TABLE_LOOKUP(kill_who, KillWho);
diff --git a/src/core/execute.h b/src/core/execute.h
index 09f246e..2bcd2e1 100644
--- a/src/core/execute.h
+++ b/src/core/execute.h
@@ -39,22 +39,6 @@ struct CGroupAttribute;
 #include "list.h"
 #include "util.h"
 
-typedef enum KillMode {
-        KILL_CONTROL_GROUP = 0,
-        KILL_PROCESS,
-        KILL_NONE,
-        _KILL_MODE_MAX,
-        _KILL_MODE_INVALID = -1
-} KillMode;
-
-typedef enum KillWho {
-        KILL_MAIN,
-        KILL_CONTROL,
-        KILL_ALL,
-        _KILL_WHO_MAX,
-        _KILL_WHO_INVALID = -1
-} KillWho;
-
 typedef enum ExecInput {
         EXEC_INPUT_NULL,
         EXEC_INPUT_TTY,
@@ -146,11 +130,6 @@ struct ExecContext {
 
         uint64_t capability_bounding_set_drop;
 
-        /* Not relevant for spawning processes, just for killing */
-        KillMode kill_mode;
-        int kill_signal;
-        bool send_sigkill;
-
         cap_t capabilities;
         int secure_bits;
 
@@ -228,9 +207,3 @@ ExecOutput exec_output_from_string(const char *s);
 
 const char* exec_input_to_string(ExecInput i);
 ExecInput exec_input_from_string(const char *s);
-
-const char *kill_mode_to_string(KillMode k);
-KillMode kill_mode_from_string(const char *s);
-
-const char *kill_who_to_string(KillWho k);
-KillWho kill_who_from_string(const char *s);
diff --git a/src/core/kill.c b/src/core/kill.c
new file mode 100644
index 0000000..0775653
--- /dev/null
+++ b/src/core/kill.c
@@ -0,0 +1,63 @@
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
+
+/***
+  This file is part of systemd.
+
+  Copyright 2012 Lennart Poettering
+
+  systemd is free software; you can redistribute it and/or modify it
+  under the terms of the GNU Lesser General Public License as published by
+  the Free Software Foundation; either version 2.1 of the License, or
+  (at your option) any later version.
+
+  systemd is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  Lesser General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public License
+  along with systemd; If not, see <http://www.gnu.org/licenses/>.
+***/
+
+#include <string.h>
+
+#include "kill.h"
+#include "util.h"
+
+void kill_context_init(KillContext *c) {
+        assert(c);
+
+        c->kill_signal = SIGTERM;
+        c->send_sigkill = true;
+}
+
+void kill_context_dump(KillContext *c, FILE *f, const char *prefix) {
+        assert(c);
+
+        if (!prefix)
+                prefix = "";
+
+        fprintf(f,
+                "%sKillMode: %s\n"
+                "%sKillSignal: SIG%s\n"
+                "%sSendSIGKILL: %s\n",
+                prefix, kill_mode_to_string(c->kill_mode),
+                prefix, signal_to_string(c->kill_signal),
+                prefix, yes_no(c->send_sigkill));
+}
+
+static const char* const kill_mode_table[_KILL_MODE_MAX] = {
+        [KILL_CONTROL_GROUP] = "control-group",
+        [KILL_PROCESS] = "process",
+        [KILL_NONE] = "none"
+};
+
+DEFINE_STRING_TABLE_LOOKUP(kill_mode, KillMode);
+
+static const char* const kill_who_table[_KILL_WHO_MAX] = {
+        [KILL_MAIN] = "main",
+        [KILL_CONTROL] = "control",
+        [KILL_ALL] = "all"
+};
+
+DEFINE_STRING_TABLE_LOOKUP(kill_who, KillWho);
diff --git a/src/core/kill.h b/src/core/kill.h
new file mode 100644
index 0000000..4f88239
--- /dev/null
+++ b/src/core/kill.h
@@ -0,0 +1,58 @@
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
+
+#pragma once
+
+/***
+  This file is part of systemd.
+
+  Copyright 2012 Lennart Poettering
+
+  systemd is free software; you can redistribute it and/or modify it
+  under the terms of the GNU Lesser General Public License as published by
+  the Free Software Foundation; either version 2.1 of the License, or
+  (at your option) any later version.
+
+  systemd is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  Lesser General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public License
+  along with systemd; If not, see <http://www.gnu.org/licenses/>.
+***/
+
+typedef struct KillContext KillContext;
+
+#include <stdbool.h>
+#include <stdio.h>
+
+typedef enum KillMode {
+        KILL_CONTROL_GROUP = 0,
+        KILL_PROCESS,
+        KILL_NONE,
+        _KILL_MODE_MAX,
+        _KILL_MODE_INVALID = -1
+} KillMode;
+
+struct KillContext {
+        KillMode kill_mode;
+        int kill_signal;
+        bool send_sigkill;
+};
+
+typedef enum KillWho {
+        KILL_MAIN,
+        KILL_CONTROL,
+        KILL_ALL,
+        _KILL_WHO_MAX,
+        _KILL_WHO_INVALID = -1
+} KillWho;
+
+void kill_context_init(KillContext *c);
+void kill_context_dump(KillContext *c, FILE *f, const char *prefix);
+
+const char *kill_mode_to_string(KillMode k);
+KillMode kill_mode_from_string(const char *s);
+
+const char *kill_who_to_string(KillWho k);
+KillWho kill_who_from_string(const char *s);
diff --git a/src/core/load-fragment-gperf.gperf.m4 b/src/core/load-fragment-gperf.gperf.m4
index 140cb9c..d6a4711 100644
--- a/src/core/load-fragment-gperf.gperf.m4
+++ b/src/core/load-fragment-gperf.gperf.m4
@@ -84,14 +84,16 @@ $1.PrivateNetwork,               config_parse_bool,                  0,
 $1.MountFlags,                   config_parse_exec_mount_flags,      0,                             offsetof($1, exec_context)
 $1.TCPWrapName,                  config_parse_unit_string_printf,    0,                             offsetof($1, exec_context.tcpwrap_name)
 $1.PAMName,                      config_parse_unit_string_printf,    0,                             offsetof($1, exec_context.pam_name)
-$1.KillMode,                     config_parse_kill_mode,             0,                             offsetof($1, exec_context.kill_mode)
-$1.KillSignal,                   config_parse_kill_signal,           0,                             offsetof($1, exec_context.kill_signal)
-$1.SendSIGKILL,                  config_parse_bool,                  0,                             offsetof($1, exec_context.send_sigkill)
 $1.IgnoreSIGPIPE,                config_parse_bool,                  0,                             offsetof($1, exec_context.ignore_sigpipe)
 $1.UtmpIdentifier,               config_parse_unit_string_printf,    0,                             offsetof($1, exec_context.utmp_id)
 $1.ControlGroupModify,           config_parse_bool,                  0,                             offsetof($1, exec_context.control_group_modify)
 $1.ControlGroupPersistent,       config_parse_tristate,              0,                             offsetof($1, exec_context.control_group_persistent)'
 )m4_dnl
+m4_define(`KILL_CONTEXT_CONFIG_ITEMS',
+`$1.SendSIGKILL,                  config_parse_bool,                  0,                             offsetof($1, kill_context.send_sigkill)
+$1.KillMode,                     config_parse_kill_mode,             0,                             offsetof($1, kill_context.kill_mode)
+$1.KillSignal,                   config_parse_kill_signal,           0,                             offsetof($1, kill_context.kill_signal)'
+)m4_dnl
 Unit.Description,                config_parse_unit_string_printf,    0,                             offsetof(Unit, description)
 Unit.Documentation,              config_parse_documentation,         0,                             offsetof(Unit, documentation)
 Unit.SourcePath,                 config_parse_path,                  0,                             offsetof(Unit, source_path)
@@ -162,6 +164,7 @@ Service.NotifyAccess,            config_parse_notify_access,         0,
 Service.Sockets,                 config_parse_service_sockets,       0,                             0
 Service.FsckPassNo,              config_parse_fsck_passno,           0,                             offsetof(Service, fsck_passno)
 EXEC_CONTEXT_CONFIG_ITEMS(Service)m4_dnl
+KILL_CONTEXT_CONFIG_ITEMS(Service)m4_dnl
 m4_dnl
 Socket.ListenStream,             config_parse_socket_listen,         0,                             0
 Socket.ListenDatagram,           config_parse_socket_listen,         0,                             0
@@ -200,6 +203,7 @@ Socket.MessageQueueMaxMessages,  config_parse_long,                  0,
 Socket.MessageQueueMessageSize,  config_parse_long,                  0,                             offsetof(Socket, mq_msgsize)
 Socket.Service,                  config_parse_socket_service,        0,                             0
 EXEC_CONTEXT_CONFIG_ITEMS(Socket)m4_dnl
+KILL_CONTEXT_CONFIG_ITEMS(Socket)m4_dnl
 m4_dnl
 Mount.What,                      config_parse_string,                0,                             offsetof(Mount, parameters_fragment.what)
 Mount.Where,                     config_parse_path,                  0,                             offsetof(Mount, where)
@@ -209,6 +213,7 @@ Mount.FsckPassNo,                config_parse_fsck_passno,           0,
 Mount.TimeoutSec,                config_parse_usec,                  0,                             offsetof(Mount, timeout_usec)
 Mount.DirectoryMode,             config_parse_mode,                  0,                             offsetof(Mount, directory_mode)
 EXEC_CONTEXT_CONFIG_ITEMS(Mount)m4_dnl
+KILL_CONTEXT_CONFIG_ITEMS(Mount)m4_dnl
 m4_dnl
 Automount.Where,                 config_parse_path,                  0,                             offsetof(Automount, where)
 Automount.DirectoryMode,         config_parse_mode,                  0,                             offsetof(Automount, directory_mode)
@@ -217,6 +222,7 @@ Swap.What,                       config_parse_path,                  0,
 Swap.Priority,                   config_parse_int,                   0,                             offsetof(Swap, parameters_fragment.priority)
 Swap.TimeoutSec,                 config_parse_usec,                  0,                             offsetof(Swap, timeout_usec)
 EXEC_CONTEXT_CONFIG_ITEMS(Swap)m4_dnl
+KILL_CONTEXT_CONFIG_ITEMS(Swap)m4_dnl
 m4_dnl
 Timer.OnActiveSec,               config_parse_timer,                 0,                             0
 Timer.OnBootSec,                 config_parse_timer,                 0,                             0
diff --git a/src/core/mount.c b/src/core/mount.c
index a88b255..82c64ff 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -79,6 +79,8 @@ static void mount_init(Unit *u) {
                 m->exec_context.std_error = u->manager->default_std_error;
         }
 
+        kill_context_init(&m->kill_context);
+
         /* We need to make sure that /bin/mount is always called in
          * the same process group as us, so that the autofs kernel
          * side doesn't send us another mount request while we are
@@ -529,7 +531,7 @@ static int mount_verify(Mount *m) {
                 return -EBADMSG;
         }
 
-        if (m->exec_context.pam_name && m->exec_context.kill_mode != KILL_CONTROL_GROUP) {
+        if (m->exec_context.pam_name && m->kill_context.kill_mode != KILL_CONTROL_GROUP) {
                 log_error("%s has PAM enabled. Kill mode must be set to 'control-group'. Refusing.", UNIT(m)->id);
                 return -EINVAL;
         }
@@ -783,6 +785,7 @@ static void mount_dump(Unit *u, FILE *f, const char *prefix) {
                         prefix, (unsigned long) m->control_pid);
 
         exec_context_dump(&m->exec_context, f, prefix);
+        kill_context_dump(&m->kill_context, f, prefix);
 }
 
 static int mount_spawn(Mount *m, ExecCommand *c, pid_t *_pid) {
@@ -855,10 +858,10 @@ static void mount_enter_signal(Mount *m, MountState state, MountResult f) {
         if (f != MOUNT_SUCCESS)
                 m->result = f;
 
-        if (m->exec_context.kill_mode != KILL_NONE) {
+        if (m->kill_context.kill_mode != KILL_NONE) {
                 int sig = (state == MOUNT_MOUNTING_SIGTERM ||
                            state == MOUNT_UNMOUNTING_SIGTERM ||
-                           state == MOUNT_REMOUNTING_SIGTERM) ? m->exec_context.kill_signal : SIGKILL;
+                           state == MOUNT_REMOUNTING_SIGTERM) ? m->kill_context.kill_signal : SIGKILL;
 
                 if (m->control_pid > 0) {
                         if (kill_and_sigcont(m->control_pid, sig) < 0 && errno != ESRCH)
@@ -868,7 +871,7 @@ static void mount_enter_signal(Mount *m, MountState state, MountResult f) {
                                 wait_for_exit = true;
                 }
 
-                if (m->exec_context.kill_mode == KILL_CONTROL_GROUP) {
+                if (m->kill_context.kill_mode == KILL_CONTROL_GROUP) {
 
                         if (!(pid_set = set_new(trivial_hash_func, trivial_compare_func))) {
                                 r = -ENOMEM;
@@ -1327,7 +1330,7 @@ static void mount_timer_event(Unit *u, uint64_t elapsed, Watch *w) {
                 break;
 
         case MOUNT_MOUNTING_SIGTERM:
-                if (m->exec_context.send_sigkill) {
+                if (m->kill_context.send_sigkill) {
                         log_warning("%s mounting timed out. Killing.", u->id);
                         mount_enter_signal(m, MOUNT_MOUNTING_SIGKILL, MOUNT_FAILURE_TIMEOUT);
                 } else {
@@ -1341,7 +1344,7 @@ static void mount_timer_event(Unit *u, uint64_t elapsed, Watch *w) {
                 break;
 
         case MOUNT_REMOUNTING_SIGTERM:
-                if (m->exec_context.send_sigkill) {
+                if (m->kill_context.send_sigkill) {
                         log_warning("%s remounting timed out. Killing.", u->id);
                         mount_enter_signal(m, MOUNT_REMOUNTING_SIGKILL, MOUNT_FAILURE_TIMEOUT);
                 } else {
@@ -1355,7 +1358,7 @@ static void mount_timer_event(Unit *u, uint64_t elapsed, Watch *w) {
                 break;
 
         case MOUNT_UNMOUNTING_SIGTERM:
-                if (m->exec_context.send_sigkill) {
+                if (m->kill_context.send_sigkill) {
                         log_warning("%s unmounting timed out. Killing.", u->id);
                         mount_enter_signal(m, MOUNT_UNMOUNTING_SIGKILL, MOUNT_FAILURE_TIMEOUT);
                 } else {
diff --git a/src/core/mount.h b/src/core/mount.h
index 9583eeb..67d6132 100644
--- a/src/core/mount.h
+++ b/src/core/mount.h
@@ -24,6 +24,7 @@
 typedef struct Mount Mount;
 
 #include "unit.h"
+#include "kill.h"
 
 typedef enum MountState {
         MOUNT_DEAD,
@@ -95,6 +96,7 @@ struct Mount {
 
         ExecCommand exec_command[_MOUNT_EXEC_COMMAND_MAX];
         ExecContext exec_context;
+        KillContext kill_context;
 
         MountState state, deserialized_state;
 
diff --git a/src/core/service.c b/src/core/service.c
index 5dc06b3..567e9a4 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -153,6 +153,7 @@ static void service_init(Unit *u) {
         for (i = 0; i < RLIMIT_NLIMITS; i++)
                 if (UNIT(s)->manager->rlimit[i])
                         s->exec_context.rlimit[i] = newdup(struct rlimit, UNIT(s)->manager->rlimit[i], 1);
+        kill_context_init(&s->kill_context);
 
         RATELIMIT_INIT(s->start_limit, 10*USEC_PER_SEC, 5);
 
@@ -928,7 +929,7 @@ static int service_load_sysv_path(Service *s, const char *path) {
         s->guess_main_pid = false;
         s->restart = SERVICE_RESTART_NO;
         s->exec_context.ignore_sigpipe = false;
-        s->exec_context.kill_mode = KILL_PROCESS;
+        s->kill_context.kill_mode = KILL_PROCESS;
 
         /* We use the long description only if
          * no short description is set. */
@@ -1164,7 +1165,7 @@ static int service_verify(Service *s) {
         if (s->bus_name && s->type != SERVICE_DBUS)
                 log_warning("%s has a D-Bus service name specified, but is not of type dbus. Ignoring.", UNIT(s)->id);
 
-        if (s->exec_context.pam_name && s->exec_context.kill_mode != KILL_CONTROL_GROUP) {
+        if (s->exec_context.pam_name && s->kill_context.kill_mode != KILL_CONTROL_GROUP) {
                 log_error("%s has PAM enabled. Kill mode must be set to 'control-group'. Refusing.", UNIT(s)->id);
                 return -EINVAL;
         }
@@ -1351,6 +1352,7 @@ static void service_dump(Unit *u, FILE *f, const char *prefix) {
                         prefix, s->bus_name,
                         prefix, yes_no(s->bus_name_good));
 
+        kill_context_dump(&s->kill_context, f, prefix);
         exec_context_dump(&s->exec_context, f, prefix);
 
         for (c = 0; c < _SERVICE_EXEC_COMMAND_MAX; c++) {
@@ -1967,8 +1969,8 @@ static void service_enter_signal(Service *s, ServiceState state, ServiceResult f
         if (f != SERVICE_SUCCESS)
                 s->result = f;
 
-        if (s->exec_context.kill_mode != KILL_NONE) {
-                int sig = (state == SERVICE_STOP_SIGTERM || state == SERVICE_FINAL_SIGTERM) ? s->exec_context.kill_signal : SIGKILL;
+        if (s->kill_context.kill_mode != KILL_NONE) {
+                int sig = (state == SERVICE_STOP_SIGTERM || state == SERVICE_FINAL_SIGTERM) ? s->kill_context.kill_signal : SIGKILL;
 
                 if (s->main_pid > 0) {
                         if (kill_and_sigcont(s->main_pid, sig) < 0 && errno != ESRCH)
@@ -1984,9 +1986,10 @@ static void service_enter_signal(Service *s, ServiceState state, ServiceResult f
                                 wait_for_exit = true;
                 }
 
-                if (s->exec_context.kill_mode == KILL_CONTROL_GROUP) {
+                if (s->kill_context.kill_mode == KILL_CONTROL_GROUP) {
 
-                        if (!(pid_set = set_new(trivial_hash_func, trivial_compare_func))) {
+                        pid_set = set_new(trivial_hash_func, trivial_compare_func);
+                        if (!pid_set) {
                                 r = -ENOMEM;
                                 goto fail;
                         }
@@ -3144,7 +3147,7 @@ static void service_timer_event(Unit *u, uint64_t elapsed, Watch* w) {
                 break;
 
         case SERVICE_STOP_SIGTERM:
-                if (s->exec_context.send_sigkill) {
+                if (s->kill_context.send_sigkill) {
                         log_warning("%s stopping timed out. Killing.", u->id);
                         service_enter_signal(s, SERVICE_STOP_SIGKILL, SERVICE_FAILURE_TIMEOUT);
                 } else {
@@ -3169,7 +3172,7 @@ static void service_timer_event(Unit *u, uint64_t elapsed, Watch* w) {
                 break;
 
         case SERVICE_FINAL_SIGTERM:
-                if (s->exec_context.send_sigkill) {
+                if (s->kill_context.send_sigkill) {
                         log_warning("%s stopping timed out (2). Killing.", u->id);
                         service_enter_signal(s, SERVICE_FINAL_SIGKILL, SERVICE_FAILURE_TIMEOUT);
                 } else {
diff --git a/src/core/service.h b/src/core/service.h
index 5ad09d0..cc63347 100644
--- a/src/core/service.h
+++ b/src/core/service.h
@@ -27,6 +27,7 @@ typedef struct Service Service;
 #include "path.h"
 #include "ratelimit.h"
 #include "service.h"
+#include "kill.h"
 
 typedef enum ServiceState {
         SERVICE_DEAD,
@@ -126,7 +127,9 @@ struct Service {
         Watch watchdog_watch;
 
         ExecCommand* exec_command[_SERVICE_EXEC_COMMAND_MAX];
+
         ExecContext exec_context;
+        KillContext kill_context;
 
         ServiceState state, deserialized_state;
 
diff --git a/src/core/socket.c b/src/core/socket.c
index 8153a8e..6d41787 100644
--- a/src/core/socket.c
+++ b/src/core/socket.c
@@ -83,6 +83,7 @@ static void socket_init(Unit *u) {
         exec_context_init(&s->exec_context);
         s->exec_context.std_output = u->manager->default_std_output;
         s->exec_context.std_error = u->manager->default_std_error;
+        kill_context_init(&s->kill_context);
 
         s->control_command_id = _SOCKET_EXEC_COMMAND_INVALID;
 }
@@ -223,7 +224,7 @@ static int socket_verify(Socket *s) {
                 return -EINVAL;
         }
 
-        if (s->exec_context.pam_name && s->exec_context.kill_mode != KILL_CONTROL_GROUP) {
+        if (s->exec_context.pam_name && s->kill_context.kill_mode != KILL_CONTROL_GROUP) {
                 log_error("%s has PAM enabled. Kill mode must be set to 'control-group'. Refusing.", UNIT(s)->id);
                 return -EINVAL;
         }
@@ -526,6 +527,7 @@ static void socket_dump(Unit *u, FILE *f, const char *prefix) {
         }
 
         exec_context_dump(&s->exec_context, f, prefix);
+        kill_context_dump(&s->kill_context, f, prefix);
 
         for (c = 0; c < _SOCKET_EXEC_COMMAND_MAX; c++) {
                 if (!s->exec_command[c])
@@ -1226,8 +1228,8 @@ static void socket_enter_signal(Socket *s, SocketState state, SocketResult f) {
         if (f != SOCKET_SUCCESS)
                 s->result = f;
 
-        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_context.kill_mode != KILL_NONE) {
+                int sig = (state == SOCKET_STOP_PRE_SIGTERM || state == SOCKET_FINAL_SIGTERM) ? s->kill_context.kill_signal : SIGKILL;
 
                 if (s->control_pid > 0) {
                         if (kill_and_sigcont(s->control_pid, sig) < 0 && errno != ESRCH)
@@ -1237,7 +1239,7 @@ static void socket_enter_signal(Socket *s, SocketState state, SocketResult f) {
                                 wait_for_exit = true;
                 }
 
-                if (s->exec_context.kill_mode == KILL_CONTROL_GROUP) {
+                if (s->kill_context.kill_mode == KILL_CONTROL_GROUP) {
 
                         if (!(pid_set = set_new(trivial_hash_func, trivial_compare_func))) {
                                 r = -ENOMEM;
@@ -1983,7 +1985,7 @@ static void socket_timer_event(Unit *u, uint64_t elapsed, Watch *w) {
                 break;
 
         case SOCKET_STOP_PRE_SIGTERM:
-                if (s->exec_context.send_sigkill) {
+                if (s->kill_context.send_sigkill) {
                         log_warning("%s stopping timed out. Killing.", u->id);
                         socket_enter_signal(s, SOCKET_STOP_PRE_SIGKILL, SOCKET_FAILURE_TIMEOUT);
                 } else {
@@ -2003,7 +2005,7 @@ static void socket_timer_event(Unit *u, uint64_t elapsed, Watch *w) {
                 break;
 
         case SOCKET_FINAL_SIGTERM:
-                if (s->exec_context.send_sigkill) {
+                if (s->kill_context.send_sigkill) {
                         log_warning("%s stopping timed out (2). Killing.", u->id);
                         socket_enter_signal(s, SOCKET_FINAL_SIGKILL, SOCKET_FAILURE_TIMEOUT);
                 } else {
diff --git a/src/core/socket.h b/src/core/socket.h
index 508f00e..a06b3ea 100644
--- a/src/core/socket.h
+++ b/src/core/socket.h
@@ -101,6 +101,7 @@ struct Socket {
 
         ExecCommand* exec_command[_SOCKET_EXEC_COMMAND_MAX];
         ExecContext exec_context;
+        KillContext kill_context;
 
         /* For Accept=no sockets refers to the one service we'll
         activate. For Accept=yes sockets is either NULL, or filled
diff --git a/src/core/swap.c b/src/core/swap.c
index ed61ba3..03993b1 100644
--- a/src/core/swap.c
+++ b/src/core/swap.c
@@ -86,6 +86,7 @@ static void swap_init(Unit *u) {
         exec_context_init(&s->exec_context);
         s->exec_context.std_output = u->manager->default_std_output;
         s->exec_context.std_error = u->manager->default_std_error;
+        kill_context_init(&s->kill_context);
 
         s->parameters_proc_swaps.priority = s->parameters_fragment.priority = -1;
 
@@ -235,7 +236,7 @@ static int swap_verify(Swap *s) {
                 return -EINVAL;
         }
 
-        if (s->exec_context.pam_name && s->exec_context.kill_mode != KILL_CONTROL_GROUP) {
+        if (s->exec_context.pam_name && s->kill_context.kill_mode != KILL_CONTROL_GROUP) {
                 log_error("%s has PAM enabled. Kill mode must be set to 'control-group'. Refusing.", UNIT(s)->id);
                 return -EINVAL;
         }
@@ -569,6 +570,7 @@ static void swap_dump(Unit *u, FILE *f, const char *prefix) {
                         prefix, (unsigned long) s->control_pid);
 
         exec_context_dump(&s->exec_context, f, prefix);
+        kill_context_dump(&s->kill_context, f, prefix);
 }
 
 static int swap_spawn(Swap *s, ExecCommand *c, pid_t *_pid) {
@@ -641,9 +643,9 @@ static void swap_enter_signal(Swap *s, SwapState state, SwapResult f) {
         if (f != SWAP_SUCCESS)
                 s->result = f;
 
-        if (s->exec_context.kill_mode != KILL_NONE) {
+        if (s->kill_context.kill_mode != KILL_NONE) {
                 int sig = (state == SWAP_ACTIVATING_SIGTERM ||
-                           state == SWAP_DEACTIVATING_SIGTERM) ? s->exec_context.kill_signal : SIGKILL;
+                           state == SWAP_DEACTIVATING_SIGTERM) ? s->kill_context.kill_signal : SIGKILL;
 
                 if (s->control_pid > 0) {
                         if (kill_and_sigcont(s->control_pid, sig) < 0 && errno != ESRCH)
@@ -653,7 +655,7 @@ static void swap_enter_signal(Swap *s, SwapState state, SwapResult f) {
                                 wait_for_exit = true;
                 }
 
-                if (s->exec_context.kill_mode == KILL_CONTROL_GROUP) {
+                if (s->kill_context.kill_mode == KILL_CONTROL_GROUP) {
 
                         if (!(pid_set = set_new(trivial_hash_func, trivial_compare_func))) {
                                 r = -ENOMEM;
@@ -993,7 +995,7 @@ static void swap_timer_event(Unit *u, uint64_t elapsed, Watch *w) {
                 break;
 
         case SWAP_ACTIVATING_SIGTERM:
-                if (s->exec_context.send_sigkill) {
+                if (s->kill_context.send_sigkill) {
                         log_warning("%s activation timed out. Killing.", u->id);
                         swap_enter_signal(s, SWAP_ACTIVATING_SIGKILL, SWAP_FAILURE_TIMEOUT);
                 } else {
@@ -1003,7 +1005,7 @@ static void swap_timer_event(Unit *u, uint64_t elapsed, Watch *w) {
                 break;
 
         case SWAP_DEACTIVATING_SIGTERM:
-                if (s->exec_context.send_sigkill) {
+                if (s->kill_context.send_sigkill) {
                         log_warning("%s deactivation timed out. Killing.", u->id);
                         swap_enter_signal(s, SWAP_DEACTIVATING_SIGKILL, SWAP_FAILURE_TIMEOUT);
                 } else {
diff --git a/src/core/swap.h b/src/core/swap.h
index d8888e1..35d47fd 100644
--- a/src/core/swap.h
+++ b/src/core/swap.h
@@ -87,6 +87,7 @@ struct Swap {
 
         ExecCommand exec_command[_SWAP_EXEC_COMMAND_MAX];
         ExecContext exec_context;
+        KillContext kill_context;
 
         SwapState state, deserialized_state;
 

commit f8813ec7950f02858ad0b902b4ba5d8b79ed67d6
Author: Lennart Poettering <lennart at poettering.net>
Date:   Thu Jul 19 23:39:53 2012 +0200

    man: add reference to export format spec to journalctl

diff --git a/man/journalctl.xml b/man/journalctl.xml
index f9abbfb..922ff4f 100644
--- a/man/journalctl.xml
+++ b/man/journalctl.xml
@@ -173,8 +173,8 @@
                                 <term><option>-o</option></term>
 
                                 <listitem><para>Controls the
-                                formatting of the journal entries that are
-                                shown. Takes one of
+                                formatting of the journal entries that
+                                are shown. Takes one of
                                 <literal>short</literal>,
                                 <literal>short-monotonic</literal>,
                                 <literal>verbose</literal>,
@@ -195,7 +195,10 @@
                                 serializes the journal into a binary
                                 (but mostly text-based) stream
                                 suitable for backups and network
-                                transfer. <literal>json</literal>
+                                transfer (see <ulink
+                                url="http://www.freedesktop.org/wiki/Software/systemd/export">Journal
+                                Export Format</ulink> for more
+                                information). <literal>json</literal>
                                 formats entries as JSON data
                                 structures. <literal>cat</literal>
                                 generates a very terse output only



More information about the systemd-commits mailing list