diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-08-16 14:34:36 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-08-16 14:34:36 +0200 |
commit | e59679246ef6faf4348e2055db80baa8dec380e5 (patch) | |
tree | 47220e36c65d9ecf706cb8fdc0b9b652f1fef421 /src/shared/bus-util.c | |
parent | ab5838fce7408061514b6322a39b1b5e27cc19b1 (diff) | |
parent | d4d00020d6ad855d65d31020fefa5003e1bb477f (diff) |
Merge pull request #932 from kaysievers/bus
sd-bus: do not connect to dbus-1 socket when kdbus is available
Diffstat (limited to 'src/shared/bus-util.c')
-rw-r--r-- | src/shared/bus-util.c | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c index aa87cd0910..0df0594ea3 100644 --- a/src/shared/bus-util.c +++ b/src/shared/bus-util.c @@ -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; -} |