summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-bus/bus-control.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-03-19 04:17:00 +0100
committerLennart Poettering <lennart@poettering.net>2014-03-19 04:17:00 +0100
commit09365592341b4ba4ceca677bb551dcde811e0333 (patch)
tree662f7de7e71fe5d05226164cc3a90088dfbf7cf6 /src/libsystemd/sd-bus/bus-control.c
parent4f10118016f9b2fd7e1d26c9ef7d91eb33fba694 (diff)
sd-bus: add proper monitoring API
Diffstat (limited to 'src/libsystemd/sd-bus/bus-control.c')
-rw-r--r--src/libsystemd/sd-bus/bus-control.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/libsystemd/sd-bus/bus-control.c b/src/libsystemd/sd-bus/bus-control.c
index db0c11b0fe..bb6683efff 100644
--- a/src/libsystemd/sd-bus/bus-control.c
+++ b/src/libsystemd/sd-bus/bus-control.c
@@ -1098,13 +1098,22 @@ int bus_add_match_internal_kernel(
return 0;
}
+#define internal_match(bus, m) \
+ ((bus)->hello_flags & KDBUS_HELLO_MONITOR \
+ ? (isempty(m) ? "eavesdrop='true'" : strappenda((m), ",eavesdrop='true'")) \
+ : (m))
+
static int bus_add_match_internal_dbus1(
sd_bus *bus,
const char *match) {
+ const char *e;
+
assert(bus);
assert(match);
+ e = internal_match(bus, match);
+
return sd_bus_call_method(
bus,
"org.freedesktop.DBus",
@@ -1114,7 +1123,7 @@ static int bus_add_match_internal_dbus1(
NULL,
NULL,
"s",
- match);
+ e);
}
int bus_add_match_internal(
@@ -1159,9 +1168,13 @@ static int bus_remove_match_internal_dbus1(
sd_bus *bus,
const char *match) {
+ const char *e;
+
assert(bus);
assert(match);
+ e = internal_match(bus, match);
+
return sd_bus_call_method(
bus,
"org.freedesktop.DBus",
@@ -1171,7 +1184,7 @@ static int bus_remove_match_internal_dbus1(
NULL,
NULL,
"s",
- match);
+ e);
}
int bus_remove_match_internal(