summaryrefslogtreecommitdiff
path: root/src/libsystemd-bus/sd-bus.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-11-30 20:18:48 +0100
committerLennart Poettering <lennart@poettering.net>2013-11-30 20:18:48 +0100
commit626851be97b4332fc0401d754c81ae7bbc0f5dc4 (patch)
treee164c6cbc5722fa8ba5eb41968f5645964260b47 /src/libsystemd-bus/sd-bus.c
parent4734b895641bd1cfb47b2eb62b0ce3f2565aa578 (diff)
bus: do kdbus only if this is enabled on the configure switch
Since we want to retain the ability to break kernel ←→ userspace ABI after the next release, let's not make use by default of kdbus, so that people with future kernels will not suddenly break with current systemd versions. kdbus support is left in all builds but must now be explicitly requested at runtime (for example via setting $DBUS_SESSION_BUS). Via a configure switch the old behaviour can be restored. In fact, we change autogen.sh to do this, so that git builds (which run autogen.sh) get kdbus by default, but tarball builds (which ue the configure defaults) do not get it, and hence this stays out of the distros by default.
Diffstat (limited to 'src/libsystemd-bus/sd-bus.c')
-rw-r--r--src/libsystemd-bus/sd-bus.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/libsystemd-bus/sd-bus.c b/src/libsystemd-bus/sd-bus.c
index e224be7056..1244ec2f6d 100644
--- a/src/libsystemd-bus/sd-bus.c
+++ b/src/libsystemd-bus/sd-bus.c
@@ -993,7 +993,11 @@ _public_ int sd_bus_open_system(sd_bus **ret) {
if (e)
r = sd_bus_set_address(b, e);
else
+#ifdef ENABLE_KDBUS
r = sd_bus_set_address(b, "kernel:path=/dev/kdbus/0-system/bus;unix:path=/run/dbus/system_bus_socket");
+#else
+ r = sd_bus_set_address(b, "unix:path=/run/dbus/system_bus_socket");
+#endif
if (r < 0)
goto fail;
@@ -1035,13 +1039,22 @@ _public_ int sd_bus_open_user(sd_bus **ret) {
ee = bus_address_escape(e);
if (!ee) {
- r = -ENOENT;
+ r = -ENOMEM;
goto fail;
}
+#ifdef ENABLE_KDBUS
asprintf(&b->address, "kernel:path=/dev/kdbus/%lu-user/bus;unix:path=%s/bus", (unsigned long) getuid(), ee);
- } else
+#else
+ b->address = strjoin("unix:path=", ee, "/bus", NULL);
+#endif
+ } else {
+#ifdef ENABLE_KDBUS
asprintf(&b->address, "kernel:path=/dev/kdbus/%lu-user/bus", (unsigned long) getuid());
+#else
+ return -ECONNREFUSED;
+#endif
+ }
if (!b->address) {
r = -ENOMEM;