summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorKay Sievers <kay@vrfy.org>2015-06-17 16:37:55 +0200
committerKay Sievers <kay@vrfy.org>2015-06-17 18:01:49 +0200
commit1b09f548c7f303b486b5b1321c06336bff72ada4 (patch)
tree0fda8c2849b2226ba773dcdc7d7d15132dbac5f6 /src/shared
parenta54941f1b47507e1609f0d8eb224f5a5a5732c0e (diff)
turn kdbus support into a runtime option
./configure --enable/disable-kdbus can be used to set the default behavior regarding kdbus. If no kdbus kernel support is available, dbus-dameon will be used. With --enable-kdbus, the kernel command line option "kdbus=0" can be used to disable kdbus. With --disable-kdbus, the kernel command line option "kdbus=1" is required to enable kdbus support.
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/bus-util.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c
index 8fcc289957..11350dad71 100644
--- a/src/shared/bus-util.c
+++ b/src/shared/bus-util.c
@@ -545,7 +545,6 @@ int bus_open_system_systemd(sd_bus **_bus) {
* directly to the system instance, instead of going via the
* bus */
-#ifdef ENABLE_KDBUS
r = sd_bus_new(&bus);
if (r < 0)
return r;
@@ -564,7 +563,6 @@ int bus_open_system_systemd(sd_bus **_bus) {
}
bus = sd_bus_unref(bus);
-#endif
r = sd_bus_new(&bus);
if (r < 0)
@@ -598,7 +596,6 @@ int bus_open_user_systemd(sd_bus **_bus) {
assert(_bus);
-#ifdef ENABLE_KDBUS
r = sd_bus_new(&bus);
if (r < 0)
return r;
@@ -616,7 +613,6 @@ int bus_open_user_systemd(sd_bus **_bus) {
}
bus = sd_bus_unref(bus);
-#endif
e = secure_getenv("XDG_RUNTIME_DIR");
if (!e)
@@ -2034,15 +2030,22 @@ int bus_path_decode_unique(const char *path, const char *prefix, char **ret_send
bool is_kdbus_wanted(void) {
_cleanup_free_ char *value = NULL;
+#ifdef ENABLE_KDBUS
+ const bool configured = true;
+#else
+ const bool configured = false;
+#endif
+
int r;
- if (get_proc_cmdline_key("kdbus", NULL) <= 0) {
- r = get_proc_cmdline_key("kdbus=", &value);
- if (r <= 0 || parse_boolean(value) != 1)
- return false;
- }
+ if (get_proc_cmdline_key("kdbus", NULL) > 0)
+ return true;
+
+ r = get_proc_cmdline_key("kdbus=", &value);
+ if (r <= 0)
+ return configured;
- return true;
+ return parse_boolean(value) == 1;
}
bool is_kdbus_available(void) {