]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-bus: do not connect to dbus-1 socket when kdbus is available 932/head
authorKay Sievers <kay@vrfy.org>
Tue, 11 Aug 2015 18:46:05 +0000 (20:46 +0200)
committerKay Sievers <kay@vrfy.org>
Tue, 11 Aug 2015 18:49:36 +0000 (20:49 +0200)
We should not fall back to dbus-1 and connect to the proxy when kdbus
returns an error that indicates that kdbus is running but just does not
accept new connections because of quota limits or something similar.

Using is_kdbus_available() in libsystemd/ requires it to move from
shared/ to libsystemd/.

Based on a patch from David Herrmann:
  https://github.com/systemd/systemd/pull/886

31 files changed:
src/basic/def.h
src/bus-proxyd/bus-proxyd.c
src/bus-proxyd/stdio-bridge.c
src/core/automount.c
src/core/service.c
src/core/socket.c
src/core/timer.c
src/dbus1-generator/dbus1-generator.c
src/libsystemd/sd-bus/bus-control.c
src/libsystemd/sd-bus/bus-convenience.c
src/libsystemd/sd-bus/bus-creds.c
src/libsystemd/sd-bus/bus-internal.c
src/libsystemd/sd-bus/bus-internal.h
src/libsystemd/sd-bus/bus-kernel.c
src/libsystemd/sd-bus/bus-match.c
src/libsystemd/sd-bus/bus-message.c
src/libsystemd/sd-bus/bus-objects.c
src/libsystemd/sd-bus/bus-track.c
src/libsystemd/sd-bus/busctl.c
src/libsystemd/sd-bus/sd-bus.c
src/libsystemd/sd-bus/test-bus-benchmark.c
src/libsystemd/sd-bus/test-bus-chat.c
src/libsystemd/sd-bus/test-bus-cleanup.c
src/libsystemd/sd-bus/test-bus-error.c
src/libsystemd/sd-bus/test-bus-gvariant.c
src/libsystemd/sd-bus/test-bus-kernel.c
src/libsystemd/sd-bus/test-bus-match.c
src/libsystemd/sd-bus/test-bus-objects.c
src/libsystemd/sd-bus/test-bus-server.c
src/shared/bus-util.c
src/shared/bus-util.h

index 5aaba1fe87264d06b2ca6448eafae0e167a9f07b..e0d6822f38f6c67771a517435d63011caf300593 100644 (file)
@@ -63,7 +63,6 @@
 
 #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"
-#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 3cc3b33ae70a7322c71afc478bd15fed940c61c3..6e07aea94e2c0128f12b76d413493cf0996dee68 100644 (file)
@@ -177,8 +177,9 @@ static int help(void) {
                "     --configuration=PATH Configuration file or directory\n"
                "     --machine=MACHINE    Connect to specified machine\n"
                "     --address=ADDRESS    Connect to the bus specified by ADDRESS\n"
-               "                          (default: " DEFAULT_SYSTEM_BUS_ADDRESS ")\n",
-               program_invocation_short_name);
+               "                          (default: %s)\n",
+               program_invocation_short_name,
+               is_kdbus_available() ? KERNEL_SYSTEM_BUS_ADDRESS : UNIX_SYSTEM_BUS_ADDRESS);
 
         return 0;
 }
@@ -262,7 +263,7 @@ static int parse_argv(int argc, char *argv[]) {
         }
 
         if (!arg_address) {
-                arg_address = strdup(DEFAULT_SYSTEM_BUS_ADDRESS);
+                arg_address = strdup(is_kdbus_available() ? KERNEL_SYSTEM_BUS_ADDRESS : UNIX_SYSTEM_BUS_ADDRESS);
                 if (!arg_address)
                         return log_oom();
         }
index f275f6705fb6bc5c0eff6045f532a7cd8548da62..c5dac396d3259e4b6b03616f6d38e5f2ef9907b3 100644 (file)
@@ -50,8 +50,9 @@ static int help(void) {
                "     --version            Show package version\n"
                "     --machine=MACHINE    Connect to specified machine\n"
                "     --address=ADDRESS    Connect to the bus specified by ADDRESS\n"
-               "                          (default: " DEFAULT_SYSTEM_BUS_ADDRESS ")\n",
-               program_invocation_short_name);
+               "                          (default: %s)\n",
+               program_invocation_short_name,
+               is_kdbus_available() ? KERNEL_SYSTEM_BUS_ADDRESS : UNIX_SYSTEM_BUS_ADDRESS);
 
         return 0;
 }
@@ -137,7 +138,7 @@ static int parse_argv(int argc, char *argv[]) {
         }
 
         if (!arg_address) {
-                arg_address = strdup(DEFAULT_SYSTEM_BUS_ADDRESS);
+                arg_address = strdup(is_kdbus_available() ? KERNEL_SYSTEM_BUS_ADDRESS : UNIX_SYSTEM_BUS_ADDRESS);
                 if (!arg_address)
                         return log_oom();
         }
index 4af381b4b62510be609754378f8187156a16d834..2b84c441b2b9cc9e3848754a6639b25841425920 100644 (file)
@@ -39,7 +39,6 @@
 #include "path-util.h"
 #include "dbus-automount.h"
 #include "bus-util.h"
-#include "bus-error.h"
 #include "formats-util.h"
 #include "process-util.h"
 #include "async.h"
index b790ec98befa71ca438ed10f99c2a03bad4866ad..7bd8cb8b91929eb6c9552144e3797b1846b08103 100644 (file)
@@ -42,7 +42,6 @@
 #include "utf8.h"
 #include "env-util.h"
 #include "fileio.h"
-#include "bus-error.h"
 #include "bus-util.h"
 #include "bus-kernel.h"
 #include "formats-util.h"
index a3870574732edbace69b1d8b12cd111a7bcc9fdd..c78e8ad01b8eab6fcfff1e561427b3f09cf70458 100644 (file)
@@ -43,7 +43,6 @@
 #include "def.h"
 #include "smack-util.h"
 #include "bus-util.h"
-#include "bus-error.h"
 #include "selinux-util.h"
 #include "dbus-socket.h"
 #include "unit.h"
index 7f4a2eb716276e371d27f297eb806e72edb25346..51cd56ca84c370e867335319b469cb83b972ef74 100644 (file)
@@ -27,7 +27,6 @@
 #include "dbus-timer.h"
 #include "special.h"
 #include "bus-util.h"
-#include "bus-error.h"
 
 static const UnitActiveState state_translation_table[_TIMER_STATE_MAX] = {
         [TIMER_DEAD] = UNIT_INACTIVE,
index 4980fccc31b6a4c3f8e07291b63a18438b6c8770..25c8e209fd7b3fc607be5776ce1b7b81413d9bcf 100644 (file)
@@ -84,7 +84,8 @@ static int create_dbus_files(
                         fprintf(f, "Environment=DBUS_STARTER_BUS_TYPE=%s\n", type);
 
                         if (streq(type, "system"))
-                                fprintf(f, "Environment=DBUS_STARTER_ADDRESS=" DEFAULT_SYSTEM_BUS_ADDRESS "\n");
+                                fprintf(f, "Environment=DBUS_STARTER_ADDRESS=%s\n",
+                                        is_kdbus_available() ? KERNEL_SYSTEM_BUS_ADDRESS : UNIX_SYSTEM_BUS_ADDRESS);
                         else if (streq(type, "session")) {
                                 char *run;
 
@@ -94,8 +95,10 @@ static int create_dbus_files(
                                         return -EINVAL;
                                 }
 
-                                fprintf(f, "Environment=DBUS_STARTER_ADDRESS="KERNEL_USER_BUS_ADDRESS_FMT ";" UNIX_USER_BUS_ADDRESS_FMT "\n",
-                                        getuid(), run);
+                                if (is_kdbus_available())
+                                        fprintf(f, "Environment=DBUS_STARTER_ADDRESS="KERNEL_USER_BUS_ADDRESS_FMT "\n", getuid());
+                                else
+                                        fprintf(f, "Environment=DBUS_STARTER_ADDRESS="UNIX_USER_BUS_ADDRESS_FMT "\n", run);
                         }
                 }
 
index 773c264cf05ba13b757e08041ffb793c3cc88d61..92b12f2ae83638924f982f3a6027ff64c64157ed 100644 (file)
@@ -32,7 +32,6 @@
 #include "bus-message.h"
 #include "bus-control.h"
 #include "bus-bloom.h"
-#include "bus-util.h"
 #include "capability.h"
 
 _public_ int sd_bus_get_unique_name(sd_bus *bus, const char **unique) {
index dfd82e746d678722f82347236e181b800800bbb8..87898449e6c40792f20421164751b260ad62bbe5 100644 (file)
@@ -22,7 +22,6 @@
 #include "bus-internal.h"
 #include "bus-message.h"
 #include "bus-signature.h"
-#include "bus-util.h"
 #include "bus-type.h"
 
 _public_ int sd_bus_emit_signal(
index 1c365b7fcd54960da7dfc2e1cae6504882cbe304..130fbf7a23f45c00cc516da08e4d2ed9b8e4edf1 100644 (file)
 #include "fileio.h"
 #include "audit.h"
 #include "bus-message.h"
-#include "bus-util.h"
 #include "strv.h"
 #include "bus-creds.h"
 #include "bus-label.h"
+#include "bus-internal.h"
 
 enum {
         CAP_OFFSET_INHERITABLE = 0,
index fea796cd30483d01c7984a010f9072030fe120d1..f4ab57f5bc2e9c8a361739c0e1566677c4435a87 100644 (file)
@@ -371,3 +371,45 @@ int bus_maybe_reply_error(sd_bus_message *m, int r, sd_bus_error *error) {
 
         return 1;
 }
+
+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)
+                return true;
+
+        r = get_proc_cmdline_key("kdbus=", &value);
+        if (r <= 0)
+                return configured;
+
+        return parse_boolean(value) == 1;
+}
+
+bool is_kdbus_available(void) {
+        static int cached = -1;
+        _cleanup_close_ int fd = -1;
+        struct kdbus_cmd cmd = { .size = sizeof(cmd), .flags = KDBUS_FLAG_NEGOTIATE };
+
+        if (cached >= 0)
+                return (bool) cached;
+
+        if (!is_kdbus_wanted()) {
+                cached = false;
+                return false;
+        }
+
+        fd = open("/sys/fs/kdbus/control", O_RDWR | O_CLOEXEC | O_NONBLOCK | O_NOCTTY);
+        if (fd < 0) {
+                cached = false;
+                return false;
+        }
+
+        cached = ioctl(fd, KDBUS_CMD_BUS_MAKE, &cmd) >= 0;
+        return cached;
+}
index c3e20ee1bf70167000a212f98ad659a40634f079..d420a7594f0faf66bed2fadeec458df5641c9125 100644 (file)
 #include "bus-kernel.h"
 #include "kdbus.h"
 
+typedef enum BusTransport {
+        BUS_TRANSPORT_LOCAL,
+        BUS_TRANSPORT_REMOTE,
+        BUS_TRANSPORT_MACHINE,
+        _BUS_TRANSPORT_MAX,
+        _BUS_TRANSPORT_INVALID = -1
+} BusTransport;
+
+DEFINE_TRIVIAL_CLEANUP_FUNC(sd_bus*, sd_bus_unref);
+DEFINE_TRIVIAL_CLEANUP_FUNC(sd_bus*, sd_bus_flush_close_unref);
+DEFINE_TRIVIAL_CLEANUP_FUNC(sd_bus_slot*, sd_bus_slot_unref);
+DEFINE_TRIVIAL_CLEANUP_FUNC(sd_bus_message*, sd_bus_message_unref);
+DEFINE_TRIVIAL_CLEANUP_FUNC(sd_bus_creds*, sd_bus_creds_unref);
+DEFINE_TRIVIAL_CLEANUP_FUNC(sd_bus_track*, sd_bus_track_unref);
+
+#define _cleanup_bus_unref_ _cleanup_(sd_bus_unrefp)
+#define _cleanup_bus_flush_close_unref_ _cleanup_(sd_bus_flush_close_unrefp)
+#define _cleanup_bus_slot_unref_ _cleanup_(sd_bus_slot_unrefp)
+#define _cleanup_bus_message_unref_ _cleanup_(sd_bus_message_unrefp)
+#define _cleanup_bus_creds_unref_ _cleanup_(sd_bus_creds_unrefp)
+#define _cleanup_bus_track_unref_ _cleanup_(sd_bus_slot_unrefp)
+#define _cleanup_bus_error_free_ _cleanup_(sd_bus_error_free)
+
 struct reply_callback {
         sd_bus_message_handler_t callback;
         usec_t timeout;
@@ -393,3 +416,6 @@ int bus_remove_match_by_string(sd_bus *bus, const char *match, sd_bus_message_ha
 int bus_get_root_path(sd_bus *bus);
 
 int bus_maybe_reply_error(sd_bus_message *m, int r, sd_bus_error *error);
+
+bool is_kdbus_wanted(void);
+bool is_kdbus_available(void);
index 22a43c4542c1a1ad34a3f237243baf358db71885..21f37001289e37c13be341caea156abe9641f546 100644 (file)
@@ -45,7 +45,6 @@
 #include "bus-message.h"
 #include "bus-kernel.h"
 #include "bus-bloom.h"
-#include "bus-util.h"
 #include "bus-label.h"
 
 #define UNIQUE_NAME_MAX (3+DECIMAL_STR_MAX(uint64_t))
index 18c36ce2431594d4344615b1a0fe0e75eaeada97..f3b49c0c9058a10b05df24db7527aca18563edf5 100644 (file)
@@ -22,7 +22,6 @@
 #include "bus-internal.h"
 #include "bus-message.h"
 #include "bus-match.h"
-#include "bus-util.h"
 #include "strv.h"
 
 /* Example:
index 94427ed664f0cf470123b62f044f82acfdf17ae9..b0577cc412cce3b3f228c5727f7b5d89cb78c944 100644 (file)
@@ -35,7 +35,6 @@
 #include "bus-type.h"
 #include "bus-signature.h"
 #include "bus-gvariant.h"
-#include "bus-util.h"
 
 static int message_append_basic(sd_bus_message *m, char type, const void *p, const void **stored);
 
index c25293e5e96cb9782091ee414417fdc7a0c8a5cd..17ce2975105641a47e6f644b15d74e09a93b497b 100644 (file)
@@ -26,7 +26,6 @@
 #include "bus-type.h"
 #include "bus-signature.h"
 #include "bus-introspect.h"
-#include "bus-util.h"
 #include "bus-slot.h"
 #include "bus-objects.h"
 
index e43891be258477a686b397855e741d979e2e613e..7803e39c3def331a8024d0896af68d9823644d22 100644 (file)
@@ -20,7 +20,6 @@
 ***/
 
 #include "sd-bus.h"
-#include "bus-util.h"
 #include "bus-internal.h"
 #include "bus-track.h"
 
index a1f0f30d6cdc39284e5ec44e208af9bb46424b95..181621ffc7298a701e19433636c176458b9452d2 100644 (file)
@@ -30,7 +30,6 @@
 #include "set.h"
 
 #include "sd-bus.h"
-#include "bus-internal.h"
 #include "bus-util.h"
 #include "bus-dump.h"
 #include "bus-signature.h"
index 0f075907d55d9f5926d0afe6fcfaa4d11f4a2c00..763f830e2d68c37e95070118e837464e33bfbd27 100644 (file)
@@ -43,7 +43,6 @@
 #include "bus-kernel.h"
 #include "bus-control.h"
 #include "bus-objects.h"
-#include "bus-util.h"
 #include "bus-container.h"
 #include "bus-protocol.h"
 #include "bus-track.h"
@@ -1173,7 +1172,10 @@ int bus_set_address_system(sd_bus *b) {
         if (e)
                 return sd_bus_set_address(b, e);
 
-        return sd_bus_set_address(b, DEFAULT_SYSTEM_BUS_ADDRESS);
+        if (is_kdbus_available())
+                return sd_bus_set_address(b, KERNEL_SYSTEM_BUS_ADDRESS);
+
+        return sd_bus_set_address(b, UNIX_SYSTEM_BUS_ADDRESS);
 }
 
 _public_ int sd_bus_open_system(sd_bus **ret) {
@@ -1221,16 +1223,17 @@ int bus_set_address_user(sd_bus *b) {
                 return sd_bus_set_address(b, e);
 
         e = secure_getenv("XDG_RUNTIME_DIR");
-        if (e) {
+        if (is_kdbus_available())
+                (void) asprintf(&b->address, KERNEL_USER_BUS_ADDRESS_FMT, getuid());
+        else if (e) {
                 _cleanup_free_ char *ee = NULL;
 
                 ee = bus_address_escape(e);
                 if (!ee)
                         return -ENOMEM;
 
-                (void) asprintf(&b->address, KERNEL_USER_BUS_ADDRESS_FMT ";" UNIX_USER_BUS_ADDRESS_FMT, getuid(), ee);
-        } else
-                (void) asprintf(&b->address, KERNEL_USER_BUS_ADDRESS_FMT, getuid());
+                (void) asprintf(&b->address, UNIX_USER_BUS_ADDRESS_FMT, ee);
+        }
 
         if (!b->address)
                 return -ENOMEM;
index d14110aa04e9951d3599bfeda1d145828b4245ea..d3bf6da850ca2e4a414029f985e4d0bc7554a32c 100644 (file)
@@ -28,7 +28,6 @@
 #include "sd-bus.h"
 #include "bus-kernel.h"
 #include "bus-internal.h"
-#include "bus-util.h"
 
 #define MAX_SIZE (2*1024*1024)
 
index 754335b5e7d98afbe8be0406710f6a0537d64f70..b97729caf7190d765acb58959c633056bd6fd5c6 100644 (file)
@@ -33,7 +33,6 @@
 #include "bus-error.h"
 #include "bus-match.h"
 #include "bus-internal.h"
-#include "bus-util.h"
 
 static int match_callback(sd_bus_message *m, void *userdata, sd_bus_error *ret_error) {
         log_info("Match triggered! interface=%s member=%s", strna(sd_bus_message_get_interface(m)), strna(sd_bus_message_get_member(m)));
index f58688059304e821be5be2495317eeaf9814eb9f..b483d47468481736f4d6d940f1634b525fa69080 100644 (file)
@@ -22,7 +22,6 @@
 #include <stdio.h>
 
 #include "sd-bus.h"
-#include "bus-util.h"
 #include "bus-internal.h"
 #include "bus-message.h"
 #include "refcnt.h"
index 5753c04b0e818dac8e9a69fe3818a02cf9744e25..f2cfbc706fbb827984337ba654b8ced54151bc5a 100644 (file)
@@ -20,7 +20,6 @@
 ***/
 
 #include "sd-bus.h"
-#include "bus-error.h"
 #include "bus-util.h"
 #include "errno-list.h"
 #include "bus-common-errors.h"
index b078bdc5f6809c26fa82ab2166b549608a524264..414d4e9a58f09c4264358bcf60883c0607b14539 100644 (file)
@@ -27,7 +27,6 @@
 #include "macro.h"
 #include "sd-bus.h"
 #include "bus-gvariant.h"
-#include "bus-util.h"
 #include "bus-internal.h"
 #include "bus-message.h"
 #include "bus-dump.h"
index 6506eaab2e52e414e15735c8c21aad3de08dc465..6284153a58d63974a3ec0ea3d91d3ddbaf20a699 100644 (file)
@@ -25,8 +25,8 @@
 #include "log.h"
 
 #include "sd-bus.h"
-#include "bus-kernel.h"
 #include "bus-util.h"
+#include "bus-kernel.h"
 #include "bus-dump.h"
 
 int main(int argc, char *argv[]) {
index 83cb5c62c2c4fb88180ecedb7d93ae0cf61ac9e3..f659ba3124d1f4945603b020ba31ac96db465646 100644 (file)
@@ -24,7 +24,6 @@
 
 #include "bus-match.h"
 #include "bus-message.h"
-#include "bus-util.h"
 #include "bus-slot.h"
 
 static bool mask[32];
index 359984c7f3045d14ccdceb29291ffad8dc88197f..1457759d0e5d05cd87c16930b7aefabc57d5a759 100644 (file)
@@ -30,7 +30,6 @@
 #include "sd-bus.h"
 #include "bus-internal.h"
 #include "bus-message.h"
-#include "bus-util.h"
 #include "bus-dump.h"
 
 struct context {
index 080d8eddb76ddc2fa4c939c13050cf6a5a3eefa7..604df098cc67f42c6a2fd426ec628c96b085ef34 100644 (file)
@@ -28,7 +28,6 @@
 
 #include "sd-bus.h"
 #include "bus-internal.h"
-#include "bus-util.h"
 
 struct context {
         int fds[2];
index aa87cd0910239d5efbc186355db131fbf958be6e..0df0594ea3ec42c52285ed7893ea00a4696c17d9 100644 (file)
@@ -2027,37 +2027,3 @@ int bus_path_decode_unique(const char *path, const char *prefix, char **ret_send
         *ret_external = external;
         return 1;
 }
-
-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)
-                return true;
-
-        r = get_proc_cmdline_key("kdbus=", &value);
-        if (r <= 0)
-                return configured;
-
-        return parse_boolean(value) == 1;
-}
-
-bool is_kdbus_available(void) {
-        _cleanup_close_ int fd = -1;
-        struct kdbus_cmd cmd = { .size = sizeof(cmd), .flags = KDBUS_FLAG_NEGOTIATE };
-
-        if (!is_kdbus_wanted())
-                return false;
-
-        fd = open("/sys/fs/kdbus/control", O_RDWR | O_CLOEXEC | O_NONBLOCK | O_NOCTTY);
-        if (fd < 0)
-                return false;
-
-        return ioctl(fd, KDBUS_CMD_BUS_MAKE, &cmd) >= 0;
-}
index 4ae216b7d9c400cab586d4e18fccb0a23260d3a3..0c683c071301281c225c32b8bf07f90da0452784 100644 (file)
 
 #include "sd-event.h"
 #include "sd-bus.h"
+#include "bus-error.h"
+#include "bus-internal.h"
 #include "hashmap.h"
 #include "install.h"
 #include "time-util.h"
 
-typedef enum BusTransport {
-        BUS_TRANSPORT_LOCAL,
-        BUS_TRANSPORT_REMOTE,
-        BUS_TRANSPORT_MACHINE,
-        _BUS_TRANSPORT_MAX,
-        _BUS_TRANSPORT_INVALID = -1
-} BusTransport;
-
 typedef int (*bus_property_set_t) (sd_bus *bus, const char *member, sd_bus_message *m, sd_bus_error *error, void *userdata);
 
 struct bus_properties_map {
@@ -135,21 +129,6 @@ typedef struct UnitInfo {
 
 int bus_parse_unit_info(sd_bus_message *message, UnitInfo *u);
 
-DEFINE_TRIVIAL_CLEANUP_FUNC(sd_bus*, sd_bus_unref);
-DEFINE_TRIVIAL_CLEANUP_FUNC(sd_bus*, sd_bus_flush_close_unref);
-DEFINE_TRIVIAL_CLEANUP_FUNC(sd_bus_slot*, sd_bus_slot_unref);
-DEFINE_TRIVIAL_CLEANUP_FUNC(sd_bus_message*, sd_bus_message_unref);
-DEFINE_TRIVIAL_CLEANUP_FUNC(sd_bus_creds*, sd_bus_creds_unref);
-DEFINE_TRIVIAL_CLEANUP_FUNC(sd_bus_track*, sd_bus_track_unref);
-
-#define _cleanup_bus_unref_ _cleanup_(sd_bus_unrefp)
-#define _cleanup_bus_flush_close_unref_ _cleanup_(sd_bus_flush_close_unrefp)
-#define _cleanup_bus_slot_unref_ _cleanup_(sd_bus_slot_unrefp)
-#define _cleanup_bus_message_unref_ _cleanup_(sd_bus_message_unrefp)
-#define _cleanup_bus_creds_unref_ _cleanup_(sd_bus_creds_unrefp)
-#define _cleanup_bus_track_unref_ _cleanup_(sd_bus_slot_unrefp)
-#define _cleanup_bus_error_free_ _cleanup_(sd_bus_error_free)
-
 #define BUS_DEFINE_PROPERTY_GET_ENUM(function, name, type)              \
         int function(sd_bus *bus,                                       \
                      const char *path,                                  \
@@ -197,6 +176,3 @@ int bus_deserialize_and_dump_unit_file_changes(sd_bus_message *m, bool quiet, Un
 
 int bus_path_encode_unique(sd_bus *b, const char *prefix, const char *sender_id, const char *external_id, char **ret_path);
 int bus_path_decode_unique(const char *path, const char *prefix, char **ret_sender, char **ret_external);
-
-bool is_kdbus_wanted(void);
-bool is_kdbus_available(void);