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.
This commit is contained in:
@@ -414,6 +414,7 @@ static int manager_setup_kdbus(Manager *m) {
|
||||
|
||||
assert(m);
|
||||
|
||||
#ifdef ENABLE_KDBUS
|
||||
if (m->kdbus_fd >= 0)
|
||||
return 0;
|
||||
|
||||
@@ -428,6 +429,8 @@ static int manager_setup_kdbus(Manager *m) {
|
||||
}
|
||||
|
||||
log_info("Successfully set up kdbus on %s", p);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user