[systemd-devel] [PATCH 1/2] bus: Add bus_kernel_monitor function
Lukasz Skalski
l.skalski at partner.samsung.com
Tue Dec 3 06:17:55 PST 2013
---
src/libsystemd-bus/bus-kernel.c | 16 ++++++++++++++++
src/libsystemd-bus/bus-kernel.h | 2 ++
2 files changed, 18 insertions(+)
diff --git a/src/libsystemd-bus/bus-kernel.c b/src/libsystemd-bus/bus-kernel.c
index ca36eb8..603aa97 100644
--- a/src/libsystemd-bus/bus-kernel.c
+++ b/src/libsystemd-bus/bus-kernel.c
@@ -1196,3 +1196,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 a9dddc2..7ad49a5 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);
--
1.8.3.2
More information about the systemd-devel
mailing list