chiark / gitweb /
turn kdbus support into a runtime option
authorKay Sievers <kay@vrfy.org>
Wed, 17 Jun 2015 14:37:55 +0000 (16:37 +0200)
committerSven Eden <yamakuzure@gmx.net>
Tue, 14 Mar 2017 09:03:48 +0000 (10:03 +0100)
./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.

src/libelogind/libelogind.pc.in
src/libelogind/sd-bus/bus-util.c
src/libelogind/sd-bus/sd-bus.c
src/login/pam_elogind.c
src/shared/def.h
units/systemd-networkd.service.m4.in

index e74b026..81b1d79 100644 (file)
@@ -5,15 +5,14 @@
 #  the Free Software Foundation; either version 2.1 of the License, or
 #  (at your option) any later version.
 
-# See tmpfiles.d(5) for details
-
-L /etc/os-release - - - - ../usr/lib/os-release
-L /etc/localtime - - - - ../usr/share/zoneinfo/UTC
-L+ /etc/mtab - - - - ../proc/self/mounts
+g systemd-journal   - -
+u systemd-bus-proxy - "systemd Bus Proxy"
+m4_ifdef(`ENABLE_NETWORKD',
+u systemd-network   - "systemd Network Management"
+)m4_dnl
 m4_ifdef(`ENABLE_RESOLVED',
-L! /etc/resolv.conf - - - - ../run/systemd/resolve/resolv.conf
+u systemd-resolve   - "systemd Resolver"
 )m4_dnl
-C /etc/nsswitch.conf - - - -
-m4_ifdef(`HAVE_PAM',
-C /etc/pam.d - - - -
+m4_ifdef(`ENABLE_TIMESYNCD',
+u systemd-timesync  - "systemd Time Synchronization"
 )m4_dnl
index 96296aa..2e4cd57 100644 (file)
@@ -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)
@@ -2049,15 +2045,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) {
index 57c09d9..0c18296 100644 (file)
@@ -1236,18 +1236,9 @@ int bus_set_address_user(sd_bus *b) {
                 if (!ee)
                         return -ENOMEM;
 
-#ifdef ENABLE_KDBUS
                 (void) asprintf(&b->address, KERNEL_USER_BUS_ADDRESS_FMT ";" UNIX_USER_BUS_ADDRESS_FMT, getuid(), ee);
-#else
-                (void) asprintf(&b->address, UNIX_USER_BUS_ADDRESS_FMT, ee);
-#endif
-        } else {
-#ifdef ENABLE_KDBUS
+        } else
                 (void) asprintf(&b->address, KERNEL_USER_BUS_ADDRESS_FMT, getuid());
-#else
-                return -ECONNREFUSED;
-#endif
-        }
 
         if (!b->address)
                 return -ENOMEM;
@@ -1369,11 +1360,7 @@ int bus_set_address_system_machine(sd_bus *b, const char *machine) {
         if (!e)
                 return -ENOMEM;
 
-#ifdef ENABLE_KDBUS
         b->address = strjoin("x-machine-kernel:machine=", e, ";x-machine-unix:machine=", e, NULL);
-#else
-        b->address = strjoin("x-machine-unix:machine=", e, NULL);
-#endif
         if (!b->address)
                 return -ENOMEM;
 
index f42da90..9554ce6 100644 (file)
@@ -177,7 +177,6 @@ static int export_legacy_dbus_address(
                 uid_t uid,
                 const char *runtime) {
 
-#ifdef ENABLE_KDBUS
         _cleanup_free_ char *s = NULL;
         int r;
 
@@ -195,7 +194,7 @@ static int export_legacy_dbus_address(
                 pam_syslog(handle, LOG_ERR, "Failed to set bus variable.");
                 return r;
         }
-#endif
+
         return PAM_SUCCESS;
 }
 
index 9665347..ea54e25 100644 (file)
 
 #define UNIX_SYSTEM_BUS_ADDRESS "unix:path=/var/run/dbus/system_bus_socket"
 #define KERNEL_SYSTEM_BUS_ADDRESS "kernel:path=/sys/fs/kdbus/0-system/bus"
-
-#ifdef ENABLE_KDBUS
-#  define DEFAULT_SYSTEM_BUS_ADDRESS KERNEL_SYSTEM_BUS_ADDRESS ";" UNIX_SYSTEM_BUS_ADDRESS
-#else
-#  define DEFAULT_SYSTEM_BUS_ADDRESS UNIX_SYSTEM_BUS_ADDRESS
-#endif
-
+#define DEFAULT_SYSTEM_BUS_ADDRESS KERNEL_SYSTEM_BUS_ADDRESS ";" UNIX_SYSTEM_BUS_ADDRESS
 #define UNIX_USER_BUS_ADDRESS_FMT "unix:path=%s/bus"
 #define KERNEL_USER_BUS_ADDRESS_FMT "kernel:path=/sys/fs/kdbus/"UID_FMT"-user/bus"
 
index 7f216f3..64d9130 100644 (file)
@@ -17,13 +17,11 @@ Before=network.target multi-user.target shutdown.target
 Conflicts=shutdown.target
 Wants=network.target
 
-m4_ifdef(`ENABLE_KDBUS',
 # On kdbus systems we pull in the busname explicitly, because it
 # carries policy that allows the daemon to acquire its name.
 Wants=org.freedesktop.network1.busname
 After=org.freedesktop.network1.busname
 
-)m4_dnl
 [Service]
 Type=notify
 Restart=on-failure