[systemd-devel] [PATCH 7/7] run: Support KillMode via --kill-mode=... flag
Hristo Venev
hristo at venev.name
Sun Dec 1 11:25:58 PST 2013
---
src/run/run.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/src/run/run.c b/src/run/run.c
index 537b725..c5c5c77 100644
--- a/src/run/run.c
+++ b/src/run/run.c
@@ -35,6 +35,7 @@ static bool arg_remain_after_exit = false;
static const char *arg_unit = NULL;
static const char *arg_description = NULL;
static const char *arg_slice = NULL;
+static const char *arg_kill_mode = NULL;
static bool arg_send_sighup = false;
static BusTransport arg_transport = BUS_TRANSPORT_LOCAL;
static char *arg_host = NULL;
@@ -55,7 +56,8 @@ static int help(void) {
" --description=TEXT Description for unit\n"
" --slice=SLICE Run in the specified slice\n"
" -r --remain-after-exit Leave service around until explicitly stopped\n"
- " --send-sighup Send SIGHUP when terminating\n",
+ " --send-sighup Send SIGHUP when terminating\n"
+ " --kill-mode=KillMode Specify KillMode of service\n",
program_invocation_short_name);
return 0;
@@ -73,6 +75,7 @@ static int parse_argv(int argc, char *argv[]) {
ARG_DESCRIPTION,
ARG_SLICE,
ARG_SEND_SIGHUP,
+ ARG_KILL_MODE
};
static const struct option options[] = {
@@ -89,6 +92,7 @@ static int parse_argv(int argc, char *argv[]) {
{ "send-sighup", no_argument, NULL, ARG_SEND_SIGHUP },
{ "host", required_argument, NULL, 'H' },
{ "machine", required_argument, NULL, 'M' },
+ { "kill-mode", required_argument, NULL, ARG_KILL_MODE },
{},
};
@@ -141,6 +145,10 @@ static int parse_argv(int argc, char *argv[]) {
arg_send_sighup = true;
break;
+ case ARG_KILL_MODE:
+ arg_kill_mode = optarg;
+ break;
+
case 'r':
arg_remain_after_exit = true;
break;
@@ -276,6 +284,12 @@ static int start_transient_service(
if (r < 0)
return r;
+ if (arg_kill_mode ) {
+ r = sd_bus_message_append(m, "(sv)", "KillMode", "s", arg_kill_mode);
+ if (r < 0)
+ return r;
+ }
+
r = sd_bus_message_open_container(m, 'r', "sv");
if (r < 0)
return r;
--
1.8.4.4
More information about the systemd-devel
mailing list