diff options
-rw-r--r-- | src/libsystemd-bus/bus-kernel.c | 16 | ||||
-rw-r--r-- | src/libsystemd-bus/bus-kernel.h | 2 |
2 files changed, 18 insertions, 0 deletions
diff --git a/src/libsystemd-bus/bus-kernel.c b/src/libsystemd-bus/bus-kernel.c index d0a9fbc3fb..e2e825f0f3 100644 --- a/src/libsystemd-bus/bus-kernel.c +++ b/src/libsystemd-bus/bus-kernel.c @@ -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; +} diff --git a/src/libsystemd-bus/bus-kernel.h b/src/libsystemd-bus/bus-kernel.h index 1771020903..c5d469c98b 100644 --- a/src/libsystemd-bus/bus-kernel.h +++ b/src/libsystemd-bus/bus-kernel.h @@ -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); |