chiark / gitweb /
machined: add new GetImage() bus call for retrieving the bus path for an image
[elogind.git] / src / libsystemd / sd-bus / bus-kernel.c
index 112292735b4018a6ad9f92b9d35c3a9ab3e21894..cdca48d92baa9cde3b403c042bcce8b7b6a89164 100644 (file)
@@ -815,6 +815,10 @@ fail:
 }
 
 int bus_kernel_take_fd(sd_bus *b) {
+        struct kdbus_cmd_free cmd_free = {
+                .size = sizeof(cmd_free),
+                .flags = 0,
+        };
         struct kdbus_bloom_parameter *bloom = NULL;
         struct kdbus_cmd_hello *hello;
         struct kdbus_item_list *items;
@@ -982,7 +986,8 @@ int bus_kernel_take_fd(sd_bus *b) {
         return bus_start_running(b);
 
 fail:
-        (void) bus_kernel_cmd_free(b, hello->offset);
+        cmd_free.offset = hello->offset;
+        (void) ioctl(b->input_fd, KDBUS_CMD_FREE, &cmd_free);
         return r;
 }
 
@@ -1505,6 +1510,7 @@ int bus_kernel_create_bus(const char *name, bool world, char **s) {
         make = alloca0_align(offsetof(struct kdbus_cmd_make, items) +
                              ALIGN8(offsetof(struct kdbus_item, bloom_parameter) + sizeof(struct kdbus_bloom_parameter)) +
                              ALIGN8(offsetof(struct kdbus_item, data64) + sizeof(uint64_t)) +
+                             ALIGN8(offsetof(struct kdbus_item, data64) + sizeof(uint64_t)) +
                              ALIGN8(offsetof(struct kdbus_item, str) + DECIMAL_STR_MAX(uid_t) + 1 + l + 1),
                              8);
 
@@ -1531,6 +1537,13 @@ int bus_kernel_create_bus(const char *name, bool world, char **s) {
         n->data64[0] = _KDBUS_ATTACH_ANY;
         make->size += ALIGN8(n->size);
 
+        /* Provide all metadata via bus-owner queries */
+        n = KDBUS_ITEM_NEXT(n);
+        n->type = KDBUS_ITEM_ATTACH_FLAGS_SEND;
+        n->size = offsetof(struct kdbus_item, data64) + sizeof(uint64_t);
+        n->data64[0] = _KDBUS_ATTACH_ANY;
+        make->size += ALIGN8(n->size);
+
         /* Set the a good name */
         n = KDBUS_ITEM_NEXT(n);
         sprintf(n->str, UID_FMT "-%s", getuid(), name);