summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO2
-rwxr-xr-xautogen.sh6
-rw-r--r--configure.ac10
-rw-r--r--src/core/manager.c3
-rw-r--r--src/libsystemd-bus/sd-bus.c17
5 files changed, 32 insertions, 6 deletions
diff --git a/TODO b/TODO
index 65b11c7b28..e4acb15e9e 100644
--- a/TODO
+++ b/TODO
@@ -129,7 +129,7 @@ Features:
- support "const" properties as flag
- add API to clone sd_bus_message objects
- SD_BUS_COMMENT() macro for inclusion in vtables, syntax inspired by gdbus
- - unelss configure option is specified refuse connecting and creating kdbus, so that we can break compat
+ - make sd_bus_open_system_container() kdbus aware
- longer term:
* priority queues
* priority inheritance
diff --git a/autogen.sh b/autogen.sh
index 9869c156ae..d0a2f3fee2 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -54,10 +54,10 @@ args="$args \
fi
if [ "x$1" = "xc" ]; then
- ./configure CFLAGS='-g -O0' $args
+ ./configure CFLAGS='-g -O0' --enable-kdbus $args
make clean
elif [ "x$1" = "xg" ]; then
- ./configure CFLAGS='-g -Og' $args
+ ./configure CFLAGS='-g -Og' --enable-kdbus $args
make clean
else
echo
@@ -65,6 +65,6 @@ else
echo "Initialized build system. For a common configuration please run:"
echo "----------------------------------------------------------------"
echo
- echo "./configure CFLAGS='-g -O0' $args"
+ echo "./configure CFLAGS='-g -O0' --enable-kdbus $args"
echo
fi
diff --git a/configure.ac b/configure.ac
index 6995e78406..6ada38af94 100644
--- a/configure.ac
+++ b/configure.ac
@@ -800,6 +800,15 @@ fi
AM_CONDITIONAL(ENABLE_MULTI_SEAT_X, [test "$have_multi_seat_x" = "yes"])
# ------------------------------------------------------------------------------
+have_kdbus=no
+AC_ARG_ENABLE(kdbus, AS_HELP_STRING([--enable-kdbus], [do not connect to kdbus by default]))
+if test "x$enable_kdbus" == "xyes"; then
+ AC_DEFINE(ENABLE_KDBUS, 1, [Define if kdbus support is to be enabled])
+ have_kdbus=yes
+fi
+AM_CONDITIONAL(ENABLE_KDBUS, [test "$have_kdbus" = "yes"])
+
+# ------------------------------------------------------------------------------
AC_ARG_WITH(rc-local-script-path-start,
AS_HELP_STRING([--with-rc-local-script-path-start=PATH],
[Path to /etc/rc.local]),
@@ -1084,6 +1093,7 @@ AC_MSG_RESULT([
gudev: ${enable_gudev}
gintrospection: ${enable_introspection}
multi-seat-x: ${have_multi_seat_x}
+ kdbus: ${have_kdbus}
Python: ${have_python}
Python Headers: ${have_python_devel}
man pages: ${have_manpages}
diff --git a/src/core/manager.c b/src/core/manager.c
index 7de0b26811..badf19e954 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -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;
}
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;