chiark / gitweb /
libsystemd-bus: copy over kdbus provided 128-bit bus id
authorDaniel Mack <zonque@gmail.com>
Fri, 29 Nov 2013 15:24:40 +0000 (16:24 +0100)
committerDaniel Mack <zonque@gmail.com>
Fri, 29 Nov 2013 15:27:30 +0000 (16:27 +0100)
kdbus now copies the bus unique id back to userspace in the hello
ioctl(). Use these bytes to set the server id of the sd_bus.

src/libsystemd-bus/bus-kernel.c
src/libsystemd-bus/kdbus.h

index 959392a62d742c1f3d093879b0b4530cd64e3f98..d2fcfd7f928e38780053e31be826f408d002eeb0 100644 (file)
@@ -357,6 +357,9 @@ int bus_kernel_take_fd(sd_bus *b) {
         b->bus_client = true;
         b->can_fds = !!(hello.conn_flags & KDBUS_HELLO_ACCEPT_FD);
 
+        /* the kernel told us the UUID of the underlying bus */
+        memcpy(b->server_id.bytes, hello.id128, sizeof(b->server_id.bytes));
+
         r = bus_start_running(b);
         if (r < 0)
                 return r;
index 52085b92c94bae4d5ad39eaa619ce877058f64cc..c69c1feec79e691c659c9466d8917849486718ce 100644 (file)
@@ -276,6 +276,8 @@ struct kdbus_cmd_hello {
        __u64 bloom_size;       /* The bloom filter size chosen by the
                                 * bus owner */
        __u64 pool_size;        /* maximum size of pool buffer */
+       __u8 id128[16];         /* the unique id of the bus */
+
        struct kdbus_item items[0];
 };