diff options
author | Lukasz Skalski <l.skalski@partner.samsung.com> | 2013-12-03 15:17:55 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-12-10 20:32:20 +0000 |
commit | c8fa3f60302f6d1bf7b2f7b31fb7e5a46b3d53c1 (patch) | |
tree | 8606fbdc755fb65ae40338990f3e3c80cfa4a4b6 | |
parent | 65a6df56f136ed3977f7fcd688f62a25371506fa (diff) |
bus: Add bus_kernel_monitor function
-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); |