summaryrefslogtreecommitdiff
path: root/src/libsystemd
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2015-08-27 16:32:22 +0200
committerDavid Herrmann <dh.herrmann@gmail.com>2015-08-27 16:32:22 +0200
commit057171efc103ac76c60a2a0d277d8bbf25415c21 (patch)
tree1f86acb043d5bf79725d89240c377fe2ed679066 /src/libsystemd
parent8faae625dc9b6322db452937f54176e56e65265a (diff)
Revert "sd-bus: do not connect to dbus-1 socket when kdbus is available"
This reverts commit d4d00020d6ad855d65d31020fefa5003e1bb477f. The idea of the commit is broken and needs to be reworked. We really cannot reduce the bus-addresses to a single address. We always will have systemd with native clients and legacy clients at the same time, so we also need both addresses at the same time.
Diffstat (limited to 'src/libsystemd')
-rw-r--r--src/libsystemd/sd-bus/bus-control.c1
-rw-r--r--src/libsystemd/sd-bus/bus-convenience.c1
-rw-r--r--src/libsystemd/sd-bus/bus-creds.c2
-rw-r--r--src/libsystemd/sd-bus/bus-internal.c42
-rw-r--r--src/libsystemd/sd-bus/bus-internal.h26
-rw-r--r--src/libsystemd/sd-bus/bus-kernel.c1
-rw-r--r--src/libsystemd/sd-bus/bus-match.c1
-rw-r--r--src/libsystemd/sd-bus/bus-message.c1
-rw-r--r--src/libsystemd/sd-bus/bus-objects.c1
-rw-r--r--src/libsystemd/sd-bus/bus-track.c1
-rw-r--r--src/libsystemd/sd-bus/busctl.c1
-rw-r--r--src/libsystemd/sd-bus/sd-bus.c15
-rw-r--r--src/libsystemd/sd-bus/test-bus-benchmark.c1
-rw-r--r--src/libsystemd/sd-bus/test-bus-chat.c1
-rw-r--r--src/libsystemd/sd-bus/test-bus-cleanup.c1
-rw-r--r--src/libsystemd/sd-bus/test-bus-error.c1
-rw-r--r--src/libsystemd/sd-bus/test-bus-gvariant.c1
-rw-r--r--src/libsystemd/sd-bus/test-bus-kernel.c2
-rw-r--r--src/libsystemd/sd-bus/test-bus-match.c1
-rw-r--r--src/libsystemd/sd-bus/test-bus-objects.c1
-rw-r--r--src/libsystemd/sd-bus/test-bus-server.c1
21 files changed, 24 insertions, 79 deletions
diff --git a/src/libsystemd/sd-bus/bus-control.c b/src/libsystemd/sd-bus/bus-control.c
index ef3e087b28..aeb48bedd1 100644
--- a/src/libsystemd/sd-bus/bus-control.c
+++ b/src/libsystemd/sd-bus/bus-control.c
@@ -32,6 +32,7 @@
#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) {
diff --git a/src/libsystemd/sd-bus/bus-convenience.c b/src/libsystemd/sd-bus/bus-convenience.c
index 79747e058b..af5f7da11c 100644
--- a/src/libsystemd/sd-bus/bus-convenience.c
+++ b/src/libsystemd/sd-bus/bus-convenience.c
@@ -22,6 +22,7 @@
#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(
diff --git a/src/libsystemd/sd-bus/bus-creds.c b/src/libsystemd/sd-bus/bus-creds.c
index 130fbf7a23..1c365b7fcd 100644
--- a/src/libsystemd/sd-bus/bus-creds.c
+++ b/src/libsystemd/sd-bus/bus-creds.c
@@ -31,10 +31,10 @@
#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,
diff --git a/src/libsystemd/sd-bus/bus-internal.c b/src/libsystemd/sd-bus/bus-internal.c
index f4ab57f5bc..fea796cd30 100644
--- a/src/libsystemd/sd-bus/bus-internal.c
+++ b/src/libsystemd/sd-bus/bus-internal.c
@@ -371,45 +371,3 @@ 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;
-}
diff --git a/src/libsystemd/sd-bus/bus-internal.h b/src/libsystemd/sd-bus/bus-internal.h
index 9b68fdd642..7af61a9433 100644
--- a/src/libsystemd/sd-bus/bus-internal.h
+++ b/src/libsystemd/sd-bus/bus-internal.h
@@ -37,29 +37,6 @@
#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;
@@ -417,9 +394,6 @@ 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);
-
#define bus_assert_return(expr, r, error) \
do { \
if (!assert_log(expr)) \
diff --git a/src/libsystemd/sd-bus/bus-kernel.c b/src/libsystemd/sd-bus/bus-kernel.c
index 6750cbd77b..577a8b44c3 100644
--- a/src/libsystemd/sd-bus/bus-kernel.c
+++ b/src/libsystemd/sd-bus/bus-kernel.c
@@ -45,6 +45,7 @@
#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))
diff --git a/src/libsystemd/sd-bus/bus-match.c b/src/libsystemd/sd-bus/bus-match.c
index 7175cbe8ed..2b83f439a7 100644
--- a/src/libsystemd/sd-bus/bus-match.c
+++ b/src/libsystemd/sd-bus/bus-match.c
@@ -22,6 +22,7 @@
#include "bus-internal.h"
#include "bus-message.h"
#include "bus-match.h"
+#include "bus-util.h"
#include "strv.h"
/* Example:
diff --git a/src/libsystemd/sd-bus/bus-message.c b/src/libsystemd/sd-bus/bus-message.c
index 970aaabdc2..a21ed8cb62 100644
--- a/src/libsystemd/sd-bus/bus-message.c
+++ b/src/libsystemd/sd-bus/bus-message.c
@@ -35,6 +35,7 @@
#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);
diff --git a/src/libsystemd/sd-bus/bus-objects.c b/src/libsystemd/sd-bus/bus-objects.c
index a8e9a12494..0593aa658a 100644
--- a/src/libsystemd/sd-bus/bus-objects.c
+++ b/src/libsystemd/sd-bus/bus-objects.c
@@ -26,6 +26,7 @@
#include "bus-type.h"
#include "bus-signature.h"
#include "bus-introspect.h"
+#include "bus-util.h"
#include "bus-slot.h"
#include "bus-objects.h"
diff --git a/src/libsystemd/sd-bus/bus-track.c b/src/libsystemd/sd-bus/bus-track.c
index 7803e39c3d..e43891be25 100644
--- a/src/libsystemd/sd-bus/bus-track.c
+++ b/src/libsystemd/sd-bus/bus-track.c
@@ -20,6 +20,7 @@
***/
#include "sd-bus.h"
+#include "bus-util.h"
#include "bus-internal.h"
#include "bus-track.h"
diff --git a/src/libsystemd/sd-bus/busctl.c b/src/libsystemd/sd-bus/busctl.c
index 181621ffc7..a1f0f30d6c 100644
--- a/src/libsystemd/sd-bus/busctl.c
+++ b/src/libsystemd/sd-bus/busctl.c
@@ -30,6 +30,7 @@
#include "set.h"
#include "sd-bus.h"
+#include "bus-internal.h"
#include "bus-util.h"
#include "bus-dump.h"
#include "bus-signature.h"
diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c
index 31cdcb4e5b..5434d62af5 100644
--- a/src/libsystemd/sd-bus/sd-bus.c
+++ b/src/libsystemd/sd-bus/sd-bus.c
@@ -44,6 +44,7 @@
#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,10 +1174,7 @@ int bus_set_address_system(sd_bus *b) {
if (e)
return sd_bus_set_address(b, e);
- if (is_kdbus_available())
- return sd_bus_set_address(b, KERNEL_SYSTEM_BUS_ADDRESS);
-
- return sd_bus_set_address(b, UNIX_SYSTEM_BUS_ADDRESS);
+ return sd_bus_set_address(b, DEFAULT_SYSTEM_BUS_ADDRESS);
}
_public_ int sd_bus_open_system(sd_bus **ret) {
@@ -1224,17 +1222,16 @@ int bus_set_address_user(sd_bus *b) {
return sd_bus_set_address(b, e);
e = secure_getenv("XDG_RUNTIME_DIR");
- if (is_kdbus_available())
- (void) asprintf(&b->address, KERNEL_USER_BUS_ADDRESS_FMT, getuid());
- else if (e) {
+ if (e) {
_cleanup_free_ char *ee = NULL;
ee = bus_address_escape(e);
if (!ee)
return -ENOMEM;
- (void) asprintf(&b->address, UNIX_USER_BUS_ADDRESS_FMT, ee);
- }
+ (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());
if (!b->address)
return -ENOMEM;
diff --git a/src/libsystemd/sd-bus/test-bus-benchmark.c b/src/libsystemd/sd-bus/test-bus-benchmark.c
index d3bf6da850..d14110aa04 100644
--- a/src/libsystemd/sd-bus/test-bus-benchmark.c
+++ b/src/libsystemd/sd-bus/test-bus-benchmark.c
@@ -28,6 +28,7 @@
#include "sd-bus.h"
#include "bus-kernel.h"
#include "bus-internal.h"
+#include "bus-util.h"
#define MAX_SIZE (2*1024*1024)
diff --git a/src/libsystemd/sd-bus/test-bus-chat.c b/src/libsystemd/sd-bus/test-bus-chat.c
index a0aecc1f55..20f1b532b7 100644
--- a/src/libsystemd/sd-bus/test-bus-chat.c
+++ b/src/libsystemd/sd-bus/test-bus-chat.c
@@ -33,6 +33,7 @@
#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)));
diff --git a/src/libsystemd/sd-bus/test-bus-cleanup.c b/src/libsystemd/sd-bus/test-bus-cleanup.c
index b483d47468..f586880593 100644
--- a/src/libsystemd/sd-bus/test-bus-cleanup.c
+++ b/src/libsystemd/sd-bus/test-bus-cleanup.c
@@ -22,6 +22,7 @@
#include <stdio.h>
#include "sd-bus.h"
+#include "bus-util.h"
#include "bus-internal.h"
#include "bus-message.h"
#include "refcnt.h"
diff --git a/src/libsystemd/sd-bus/test-bus-error.c b/src/libsystemd/sd-bus/test-bus-error.c
index f2cfbc706f..5753c04b0e 100644
--- a/src/libsystemd/sd-bus/test-bus-error.c
+++ b/src/libsystemd/sd-bus/test-bus-error.c
@@ -20,6 +20,7 @@
***/
#include "sd-bus.h"
+#include "bus-error.h"
#include "bus-util.h"
#include "errno-list.h"
#include "bus-common-errors.h"
diff --git a/src/libsystemd/sd-bus/test-bus-gvariant.c b/src/libsystemd/sd-bus/test-bus-gvariant.c
index 414d4e9a58..b078bdc5f6 100644
--- a/src/libsystemd/sd-bus/test-bus-gvariant.c
+++ b/src/libsystemd/sd-bus/test-bus-gvariant.c
@@ -27,6 +27,7 @@
#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"
diff --git a/src/libsystemd/sd-bus/test-bus-kernel.c b/src/libsystemd/sd-bus/test-bus-kernel.c
index 6284153a58..6506eaab2e 100644
--- a/src/libsystemd/sd-bus/test-bus-kernel.c
+++ b/src/libsystemd/sd-bus/test-bus-kernel.c
@@ -25,8 +25,8 @@
#include "log.h"
#include "sd-bus.h"
-#include "bus-util.h"
#include "bus-kernel.h"
+#include "bus-util.h"
#include "bus-dump.h"
int main(int argc, char *argv[]) {
diff --git a/src/libsystemd/sd-bus/test-bus-match.c b/src/libsystemd/sd-bus/test-bus-match.c
index e29975db44..75ea28371b 100644
--- a/src/libsystemd/sd-bus/test-bus-match.c
+++ b/src/libsystemd/sd-bus/test-bus-match.c
@@ -24,6 +24,7 @@
#include "bus-match.h"
#include "bus-message.h"
+#include "bus-util.h"
#include "bus-slot.h"
static bool mask[32];
diff --git a/src/libsystemd/sd-bus/test-bus-objects.c b/src/libsystemd/sd-bus/test-bus-objects.c
index 195013f49a..0a35b750b3 100644
--- a/src/libsystemd/sd-bus/test-bus-objects.c
+++ b/src/libsystemd/sd-bus/test-bus-objects.c
@@ -30,6 +30,7 @@
#include "sd-bus.h"
#include "bus-internal.h"
#include "bus-message.h"
+#include "bus-util.h"
#include "bus-dump.h"
struct context {
diff --git a/src/libsystemd/sd-bus/test-bus-server.c b/src/libsystemd/sd-bus/test-bus-server.c
index 604df098cc..080d8eddb7 100644
--- a/src/libsystemd/sd-bus/test-bus-server.c
+++ b/src/libsystemd/sd-bus/test-bus-server.c
@@ -28,6 +28,7 @@
#include "sd-bus.h"
#include "bus-internal.h"
+#include "bus-util.h"
struct context {
int fds[2];