summaryrefslogtreecommitdiff
path: root/src/libsystemd
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsystemd')
-rw-r--r--src/libsystemd/sd-bus/bus-kernel.c13
-rw-r--r--src/libsystemd/sd-bus/bus-kernel.h2
2 files changed, 15 insertions, 0 deletions
diff --git a/src/libsystemd/sd-bus/bus-kernel.c b/src/libsystemd/sd-bus/bus-kernel.c
index a33e7a323c..b46cada648 100644
--- a/src/libsystemd/sd-bus/bus-kernel.c
+++ b/src/libsystemd/sd-bus/bus-kernel.c
@@ -1476,3 +1476,16 @@ int bus_kernel_try_close(sd_bus *bus) {
return 0;
}
+
+int bus_kernel_drop_one(int fd) {
+ struct kdbus_cmd_recv recv = {
+ .flags = KDBUS_RECV_DROP
+ };
+
+ assert(fd >= 0);
+
+ if (ioctl(fd, KDBUS_CMD_MSG_RECV, &recv) < 0)
+ return -errno;
+
+ return 0;
+}
diff --git a/src/libsystemd/sd-bus/bus-kernel.h b/src/libsystemd/sd-bus/bus-kernel.h
index e9f776d9fd..de02b84f88 100644
--- a/src/libsystemd/sd-bus/bus-kernel.h
+++ b/src/libsystemd/sd-bus/bus-kernel.h
@@ -79,3 +79,5 @@ int kdbus_translate_request_name_flags(uint64_t sd_bus_flags, uint64_t *kdbus_fl
int kdbus_translate_attach_flags(uint64_t sd_bus_flags, uint64_t *kdbus_flags);
int bus_kernel_try_close(sd_bus *bus);
+
+int bus_kernel_drop_one(int fd);