chiark / gitweb /
bus: Add bus_kernel_monitor function
authorLukasz Skalski <l.skalski@partner.samsung.com>
Tue, 3 Dec 2013 14:17:55 +0000 (15:17 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 10 Dec 2013 20:32:20 +0000 (20:32 +0000)
src/libsystemd-bus/bus-kernel.c
src/libsystemd-bus/bus-kernel.h

index d0a9fbc..e2e825f 100644 (file)
@@ -1211,3 +1211,19 @@ int bus_kernel_create_namespace(const char *name, char **s) {
 
         return fd;
 }
+
+int bus_kernel_monitor(sd_bus *bus) {
+        struct kdbus_cmd_monitor cmd_monitor;
+        int r;
+
+        assert(bus);
+
+        cmd_monitor.id = 0;
+        cmd_monitor.flags = KDBUS_MONITOR_ENABLE;
+
+        r = ioctl(bus->input_fd, KDBUS_CMD_MONITOR, &cmd_monitor);
+        if (r < 0)
+                return -errno;
+
+        return 1;
+}
index 1771020..c5d469c 100644 (file)
@@ -73,3 +73,5 @@ int bus_kernel_parse_unique_name(const char *s, uint64_t *id);
 
 int kdbus_translate_request_name_flags(uint64_t sd_bus_flags, uint64_t *kdbus_flags);
 int kdbus_translate_attach_flags(uint64_t sd_bus_flags, uint64_t *kdbus_flags);
+
+int bus_kernel_monitor(sd_bus *bus);