chiark / gitweb /
core: introduce new stop protocol for unit scopes
[elogind.git] / src / run / run.c
index 539db6f4942776d205fea291b04014d18511972e..b9e1700d33da67d75ede3279b71ffcb66fc1841e 100644 (file)
@@ -208,7 +208,7 @@ static int message_start_transient_unit_new(sd_bus *bus, const char *name, sd_bu
         if (!isempty(arg_slice)) {
                 _cleanup_free_ char *slice;
 
-                slice = unit_name_mangle_with_suffix(arg_slice, ".slice");
+                slice = unit_name_mangle_with_suffix(arg_slice, MANGLE_NOGLOB, ".slice");
                 if (!slice)
                         return -ENOMEM;
 
@@ -237,6 +237,10 @@ static int message_start_transient_unit_send(sd_bus *bus, sd_bus_message *m, sd_
         if (r < 0)
                 return r;
 
+        r = sd_bus_message_append(m, "a(sa(sv))", 0);
+        if (r < 0)
+                return r;
+
         return sd_bus_call(bus, m, 0, error, reply);
 }
 
@@ -251,7 +255,7 @@ static int start_transient_service(
         int r;
 
         if (arg_unit)
-                name = unit_name_mangle_with_suffix(arg_unit, ".service");
+                name = unit_name_mangle_with_suffix(arg_unit, MANGLE_NOGLOB, ".service");
         else
                 asprintf(&name, "run-%lu.service", (unsigned long) getpid());
         if (!name)
@@ -338,7 +342,7 @@ static int start_transient_scope(
         assert(bus);
 
         if (arg_unit)
-                name = unit_name_mangle_with_suffix(arg_unit, ".scope");
+                name = unit_name_mangle_with_suffix(arg_unit, MANGLE_NOGLOB, ".scope");
         else
                 asprintf(&name, "run-%lu.scope", (unsigned long) getpid());
         if (!name)
@@ -352,6 +356,14 @@ static int start_transient_scope(
         if (r < 0)
                 return r;
 
+        {
+                const char *unique_id;
+                sd_bus_get_unique_name(bus, &unique_id);
+                r = sd_bus_message_append(m, "(sv)", "Controller", "s", unique_id);
+                if (r < 0)
+                        return r;
+        }
+
         r = message_start_transient_unit_send(bus, m, error, NULL);
         if (r < 0)
                 return r;