mirror of
https://github.com/systemd/systemd
synced 2024-09-06 16:56:43 +00:00
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.
This commit is contained in:
parent
a54941f1b4
commit
1b09f548c7
|
@ -1052,7 +1052,6 @@ MANPAGES_ALIAS += \
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if ENABLE_KDBUS
|
|
||||||
MANPAGES += \
|
MANPAGES += \
|
||||||
man/sd_bus_creds_get_pid.3 \
|
man/sd_bus_creds_get_pid.3 \
|
||||||
man/sd_bus_creds_new_from_pid.3 \
|
man/sd_bus_creds_new_from_pid.3 \
|
||||||
|
@ -1491,8 +1490,6 @@ man/sd_event_unref.html: man/sd_event_new.html
|
||||||
man/systemd-bus-proxyd.socket.html: man/systemd-bus-proxyd@.service.html
|
man/systemd-bus-proxyd.socket.html: man/systemd-bus-proxyd@.service.html
|
||||||
$(html-alias)
|
$(html-alias)
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
if ENABLE_LOCALED
|
if ENABLE_LOCALED
|
||||||
MANPAGES += \
|
MANPAGES += \
|
||||||
man/localectl.1 \
|
man/localectl.1 \
|
||||||
|
|
24
Makefile.am
24
Makefile.am
|
@ -338,10 +338,8 @@ INSTALL_EXEC_HOOKS += \
|
||||||
install-aliases-hook \
|
install-aliases-hook \
|
||||||
install-touch-usr-hook
|
install-touch-usr-hook
|
||||||
|
|
||||||
if ENABLE_KDBUS
|
|
||||||
INSTALL_EXEC_HOOKS += \
|
INSTALL_EXEC_HOOKS += \
|
||||||
install-busnames-target-wants-hook
|
install-busnames-target-wants-hook
|
||||||
endif
|
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
AM_V_M4 = $(AM_V_M4_$(V))
|
AM_V_M4 = $(AM_V_M4_$(V))
|
||||||
|
@ -522,10 +520,8 @@ dist_systemunit_DATA = \
|
||||||
units/initrd-switch-root.target \
|
units/initrd-switch-root.target \
|
||||||
units/machines.target
|
units/machines.target
|
||||||
|
|
||||||
if ENABLE_KDBUS
|
|
||||||
dist_systemunit_DATA += \
|
dist_systemunit_DATA += \
|
||||||
$(dist_systemunit_DATA_busnames)
|
$(dist_systemunit_DATA_busnames)
|
||||||
endif
|
|
||||||
|
|
||||||
dist_systemunit_DATA_busnames += \
|
dist_systemunit_DATA_busnames += \
|
||||||
units/busnames.target
|
units/busnames.target
|
||||||
|
@ -2622,7 +2618,6 @@ systemd_gpt_auto_generator_CFLAGS = \
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
if ENABLE_KDBUS
|
|
||||||
systemgenerator_PROGRAMS += \
|
systemgenerator_PROGRAMS += \
|
||||||
systemd-dbus1-generator
|
systemd-dbus1-generator
|
||||||
|
|
||||||
|
@ -2645,7 +2640,6 @@ dist_xinitrc_SCRIPTS = \
|
||||||
|
|
||||||
INSTALL_EXEC_HOOKS += dbus1-generator-install-hook
|
INSTALL_EXEC_HOOKS += dbus1-generator-install-hook
|
||||||
UNINSTALL_EXEC_HOOKS += dbus1-generator-uninstall-hook
|
UNINSTALL_EXEC_HOOKS += dbus1-generator-uninstall-hook
|
||||||
endif
|
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
systemd_sysv_generator_SOURCES = \
|
systemd_sysv_generator_SOURCES = \
|
||||||
|
@ -2793,7 +2787,6 @@ systemd_stdio_bridge_LDADD = \
|
||||||
libbus-proxy-core.la \
|
libbus-proxy-core.la \
|
||||||
libshared.la
|
libshared.la
|
||||||
|
|
||||||
if ENABLE_KDBUS
|
|
||||||
nodist_systemunit_DATA += \
|
nodist_systemunit_DATA += \
|
||||||
units/systemd-bus-proxyd.service
|
units/systemd-bus-proxyd.service
|
||||||
|
|
||||||
|
@ -2805,7 +2798,6 @@ nodist_userunit_DATA += \
|
||||||
|
|
||||||
dist_userunit_DATA += \
|
dist_userunit_DATA += \
|
||||||
units/user/systemd-bus-proxyd.socket
|
units/user/systemd-bus-proxyd.socket
|
||||||
endif
|
|
||||||
|
|
||||||
EXTRA_DIST += \
|
EXTRA_DIST += \
|
||||||
units/systemd-bus-proxyd.service.m4.in \
|
units/systemd-bus-proxyd.service.m4.in \
|
||||||
|
@ -2971,14 +2963,6 @@ pkginclude_HEADERS += \
|
||||||
src/systemd/sd-id128.h \
|
src/systemd/sd-id128.h \
|
||||||
src/systemd/sd-daemon.h
|
src/systemd/sd-daemon.h
|
||||||
|
|
||||||
if ENABLE_KDBUS
|
|
||||||
pkginclude_HEADERS += \
|
|
||||||
src/systemd/sd-utf8.h \
|
|
||||||
src/systemd/sd-netlink.h \
|
|
||||||
src/systemd/sd-resolve.h \
|
|
||||||
src/systemd/sd-path.h
|
|
||||||
endif
|
|
||||||
|
|
||||||
lib_LTLIBRARIES += \
|
lib_LTLIBRARIES += \
|
||||||
libsystemd.la
|
libsystemd.la
|
||||||
|
|
||||||
|
@ -6174,10 +6158,8 @@ USER_UNIT_ALIASES += \
|
||||||
$(systemunitdir)/sound.target sound.target \
|
$(systemunitdir)/sound.target sound.target \
|
||||||
$(systemunitdir)/smartcard.target smartcard.target
|
$(systemunitdir)/smartcard.target smartcard.target
|
||||||
|
|
||||||
if ENABLE_KDBUS
|
|
||||||
USER_UNIT_ALIASES += \
|
USER_UNIT_ALIASES += \
|
||||||
$(systemunitdir)/busnames.target busnames.target
|
$(systemunitdir)/busnames.target busnames.target
|
||||||
endif
|
|
||||||
|
|
||||||
GENERAL_ALIASES += \
|
GENERAL_ALIASES += \
|
||||||
$(systemunitdir)/remote-fs.target $(pkgsysconfdir)/system/multi-user.target.wants/remote-fs.target \
|
$(systemunitdir)/remote-fs.target $(pkgsysconfdir)/system/multi-user.target.wants/remote-fs.target \
|
||||||
|
@ -6238,7 +6220,6 @@ DISTCHECK_CONFIGURE_FLAGS = \
|
||||||
--with-pamlibdir=$$dc_install_base/$(pamlibdir) \
|
--with-pamlibdir=$$dc_install_base/$(pamlibdir) \
|
||||||
--with-pamconfdir=$$dc_install_base/$(pamconfdir) \
|
--with-pamconfdir=$$dc_install_base/$(pamconfdir) \
|
||||||
--with-rootprefix=$$dc_install_base \
|
--with-rootprefix=$$dc_install_base \
|
||||||
--enable-kdbus \
|
|
||||||
--enable-compat-libs
|
--enable-compat-libs
|
||||||
|
|
||||||
if HAVE_SYSV_COMPAT
|
if HAVE_SYSV_COMPAT
|
||||||
|
@ -6299,11 +6280,6 @@ hwdb-update:
|
||||||
http://standards.ieee.org/develop/regauth/iab/iab.txt && \
|
http://standards.ieee.org/develop/regauth/iab/iab.txt && \
|
||||||
./ids-update.pl )
|
./ids-update.pl )
|
||||||
|
|
||||||
.PHONY: kdbus-update
|
|
||||||
kdbus-update:
|
|
||||||
( cd $(top_srcdir)/src/libsystemd/sd-bus/ && \
|
|
||||||
wget -N https://d-bus.googlecode.com/git/kdbus.h )
|
|
||||||
|
|
||||||
.PHONY: git-tag
|
.PHONY: git-tag
|
||||||
git-tag:
|
git-tag:
|
||||||
git tag -s "v$(VERSION)" -m "systemd $(VERSION)"
|
git tag -s "v$(VERSION)" -m "systemd $(VERSION)"
|
||||||
|
|
|
@ -1203,9 +1203,9 @@ AM_CONDITIONAL(ENABLE_TERMINAL, [test "x$have_terminal" = "xyes" -a "x$have_unif
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
have_kdbus=no
|
have_kdbus=no
|
||||||
AC_ARG_ENABLE(kdbus, AS_HELP_STRING([--enable-kdbus], [do connect to kdbus by default]))
|
AC_ARG_ENABLE(kdbus, AS_HELP_STRING([--disable-kdbus], [do not connect to kdbus by default]))
|
||||||
if test "x$enable_kdbus" = "xyes"; then
|
if test "x$enable_kdbus" != "xno"; then
|
||||||
AC_DEFINE(ENABLE_KDBUS, 1, [Define if kdbus support is to be enabled])
|
AC_DEFINE(ENABLE_KDBUS, 1, [Define if kdbus is to be connected to by default])
|
||||||
have_kdbus=yes
|
have_kdbus=yes
|
||||||
M4_DEFINES="$M4_DEFINES -DENABLE_KDBUS"
|
M4_DEFINES="$M4_DEFINES -DENABLE_KDBUS"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<refentry id="systemd-bus-proxyd" conditional="ENABLE_KDBUS"
|
<refentry id="systemd-bus-proxyd"
|
||||||
xmlns:xi="http://www.w3.org/2001/XInclude">
|
xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||||
|
|
||||||
<refentryinfo>
|
<refentryinfo>
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<refentry id="systemd-bus-proxyd@.service" conditional='ENABLE_KDBUS'>
|
<refentry id="systemd-bus-proxyd@.service">
|
||||||
|
|
||||||
<refentryinfo>
|
<refentryinfo>
|
||||||
<title>systemd-bus-proxyd@.service</title>
|
<title>systemd-bus-proxyd@.service</title>
|
||||||
|
|
|
@ -63,13 +63,7 @@
|
||||||
|
|
||||||
#define UNIX_SYSTEM_BUS_ADDRESS "unix:path=/var/run/dbus/system_bus_socket"
|
#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 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
|
#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 UNIX_USER_BUS_ADDRESS_FMT "unix:path=%s/bus"
|
#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"
|
#define KERNEL_USER_BUS_ADDRESS_FMT "kernel:path=/sys/fs/kdbus/"UID_FMT"-user/bus"
|
||||||
|
|
||||||
|
|
|
@ -239,11 +239,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||||
if (!e)
|
if (!e)
|
||||||
return log_oom();
|
return log_oom();
|
||||||
|
|
||||||
#ifdef ENABLE_KDBUS
|
|
||||||
a = strjoin("x-machine-kernel:machine=", e, ";x-machine-unix:machine=", e, NULL);
|
a = strjoin("x-machine-kernel:machine=", e, ";x-machine-unix:machine=", e, NULL);
|
||||||
#else
|
|
||||||
a = strjoin("x-machine-unix:machine=", e, NULL);
|
|
||||||
#endif
|
|
||||||
if (!a)
|
if (!a)
|
||||||
return log_oom();
|
return log_oom();
|
||||||
|
|
||||||
|
|
|
@ -110,11 +110,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||||
if (!e)
|
if (!e)
|
||||||
return log_oom();
|
return log_oom();
|
||||||
|
|
||||||
#ifdef ENABLE_KDBUS
|
|
||||||
a = strjoin("x-machine-kernel:machine=", e, ";x-machine-unix:machine=", e, NULL);
|
a = strjoin("x-machine-kernel:machine=", e, ";x-machine-unix:machine=", e, NULL);
|
||||||
#else
|
|
||||||
a = strjoin("x-machine-unix:machine=", e, NULL);
|
|
||||||
#endif
|
|
||||||
if (!a)
|
if (!a)
|
||||||
return log_oom();
|
return log_oom();
|
||||||
|
|
||||||
|
|
|
@ -1514,7 +1514,6 @@ static int exec_child(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_KDBUS
|
|
||||||
if (params->bus_endpoint_fd >= 0 && context->bus_endpoint) {
|
if (params->bus_endpoint_fd >= 0 && context->bus_endpoint) {
|
||||||
uid_t ep_uid = (uid == UID_INVALID) ? 0 : uid;
|
uid_t ep_uid = (uid == UID_INVALID) ? 0 : uid;
|
||||||
|
|
||||||
|
@ -1524,7 +1523,6 @@ static int exec_child(
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/* If delegation is enabled we'll pass ownership of the cgroup
|
/* If delegation is enabled we'll pass ownership of the cgroup
|
||||||
* (but only in systemd's own controller hierarchy!) to the
|
* (but only in systemd's own controller hierarchy!) to the
|
||||||
|
|
|
@ -66,10 +66,8 @@ int kmod_setup(void) {
|
||||||
/* this should never be a module */
|
/* this should never be a module */
|
||||||
{ "unix", "/proc/net/unix", true, true, NULL },
|
{ "unix", "/proc/net/unix", true, true, NULL },
|
||||||
|
|
||||||
#ifdef ENABLE_KDBUS
|
|
||||||
/* IPC is needed before we bring up any other services */
|
/* IPC is needed before we bring up any other services */
|
||||||
{ "kdbus", "/sys/fs/kdbus", false, false, is_kdbus_wanted },
|
{ "kdbus", "/sys/fs/kdbus", false, false, is_kdbus_wanted },
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_LIBIPTC
|
#ifdef HAVE_LIBIPTC
|
||||||
/* netfilter is needed by networkd, nspawn among others, and cannot be autoloaded */
|
/* netfilter is needed by networkd, nspawn among others, and cannot be autoloaded */
|
||||||
|
|
|
@ -229,9 +229,7 @@ Service.BusName, config_parse_bus_name, 0,
|
||||||
Service.FileDescriptorStoreMax, config_parse_unsigned, 0, offsetof(Service, n_fd_store_max)
|
Service.FileDescriptorStoreMax, config_parse_unsigned, 0, offsetof(Service, n_fd_store_max)
|
||||||
Service.NotifyAccess, config_parse_notify_access, 0, offsetof(Service, notify_access)
|
Service.NotifyAccess, config_parse_notify_access, 0, offsetof(Service, notify_access)
|
||||||
Service.Sockets, config_parse_service_sockets, 0, 0
|
Service.Sockets, config_parse_service_sockets, 0, 0
|
||||||
m4_ifdef(`ENABLE_KDBUS',
|
Service.BusPolicy, config_parse_bus_endpoint_policy, 0, offsetof(Service, exec_context)
|
||||||
`Service.BusPolicy, config_parse_bus_endpoint_policy, 0, offsetof(Service, exec_context)',
|
|
||||||
`Service.BusPolicy, config_parse_warn_compat, DISABLED_EXPERIMENTAL, 0')
|
|
||||||
EXEC_CONTEXT_CONFIG_ITEMS(Service)m4_dnl
|
EXEC_CONTEXT_CONFIG_ITEMS(Service)m4_dnl
|
||||||
CGROUP_CONTEXT_CONFIG_ITEMS(Service)m4_dnl
|
CGROUP_CONTEXT_CONFIG_ITEMS(Service)m4_dnl
|
||||||
KILL_CONTEXT_CONFIG_ITEMS(Service)m4_dnl
|
KILL_CONTEXT_CONFIG_ITEMS(Service)m4_dnl
|
||||||
|
|
|
@ -731,7 +731,6 @@ static int manager_setup_notify(Manager *m) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int manager_setup_kdbus(Manager *m) {
|
static int manager_setup_kdbus(Manager *m) {
|
||||||
#ifdef ENABLE_KDBUS
|
|
||||||
_cleanup_free_ char *p = NULL;
|
_cleanup_free_ char *p = NULL;
|
||||||
|
|
||||||
assert(m);
|
assert(m);
|
||||||
|
@ -749,7 +748,6 @@ static int manager_setup_kdbus(Manager *m) {
|
||||||
return log_debug_errno(m->kdbus_fd, "Failed to set up kdbus: %m");
|
return log_debug_errno(m->kdbus_fd, "Failed to set up kdbus: %m");
|
||||||
|
|
||||||
log_debug("Successfully set up kdbus on %s", p);
|
log_debug("Successfully set up kdbus on %s", p);
|
||||||
#endif
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,10 +104,8 @@ static const MountPoint mount_table[] = {
|
||||||
{ "efivarfs", "/sys/firmware/efi/efivars", "efivarfs", NULL, MS_NOSUID|MS_NOEXEC|MS_NODEV,
|
{ "efivarfs", "/sys/firmware/efi/efivars", "efivarfs", NULL, MS_NOSUID|MS_NOEXEC|MS_NODEV,
|
||||||
is_efi_boot, MNT_NONE },
|
is_efi_boot, MNT_NONE },
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_KDBUS
|
|
||||||
{ "kdbusfs", "/sys/fs/kdbus", "kdbusfs", NULL, MS_NOSUID|MS_NOEXEC|MS_NODEV,
|
{ "kdbusfs", "/sys/fs/kdbus", "kdbusfs", NULL, MS_NOSUID|MS_NOEXEC|MS_NODEV,
|
||||||
NULL, MNT_IN_CONTAINER },
|
NULL, MNT_IN_CONTAINER },
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* These are API file systems that might be mounted by other software,
|
/* These are API file systems that might be mounted by other software,
|
||||||
|
|
|
@ -568,14 +568,12 @@ static int service_add_extras(Service *s) {
|
||||||
s->notify_access = NOTIFY_MAIN;
|
s->notify_access = NOTIFY_MAIN;
|
||||||
|
|
||||||
if (s->bus_name) {
|
if (s->bus_name) {
|
||||||
#ifdef ENABLE_KDBUS
|
|
||||||
const char *n;
|
const char *n;
|
||||||
|
|
||||||
n = strjoina(s->bus_name, ".busname");
|
n = strjoina(s->bus_name, ".busname");
|
||||||
r = unit_add_dependency_by_name(UNIT(s), UNIT_AFTER, n, NULL, true);
|
r = unit_add_dependency_by_name(UNIT(s), UNIT_AFTER, n, NULL, true);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
#endif
|
|
||||||
|
|
||||||
r = unit_watch_bus_name(UNIT(s), s->bus_name);
|
r = unit_watch_bus_name(UNIT(s), s->bus_name);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
|
@ -1180,7 +1178,6 @@ static int service_spawn(
|
||||||
} else
|
} else
|
||||||
path = UNIT(s)->cgroup_path;
|
path = UNIT(s)->cgroup_path;
|
||||||
|
|
||||||
#ifdef ENABLE_KDBUS
|
|
||||||
if (s->exec_context.bus_endpoint) {
|
if (s->exec_context.bus_endpoint) {
|
||||||
r = bus_kernel_create_endpoint(UNIT(s)->manager->running_as == MANAGER_SYSTEM ? "system" : "user",
|
r = bus_kernel_create_endpoint(UNIT(s)->manager->running_as == MANAGER_SYSTEM ? "system" : "user",
|
||||||
UNIT(s)->id, &bus_endpoint_path);
|
UNIT(s)->id, &bus_endpoint_path);
|
||||||
|
@ -1192,7 +1189,6 @@ static int service_spawn(
|
||||||
* as the service is running. */
|
* as the service is running. */
|
||||||
exec_params.bus_endpoint_fd = s->bus_endpoint_fd = r;
|
exec_params.bus_endpoint_fd = s->bus_endpoint_fd = r;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
exec_params.argv = argv;
|
exec_params.argv = argv;
|
||||||
exec_params.fds = fds;
|
exec_params.fds = fds;
|
||||||
|
|
|
@ -1239,18 +1239,9 @@ int bus_set_address_user(sd_bus *b) {
|
||||||
if (!ee)
|
if (!ee)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
#ifdef ENABLE_KDBUS
|
|
||||||
(void) asprintf(&b->address, KERNEL_USER_BUS_ADDRESS_FMT ";" UNIX_USER_BUS_ADDRESS_FMT, getuid(), ee);
|
(void) asprintf(&b->address, KERNEL_USER_BUS_ADDRESS_FMT ";" UNIX_USER_BUS_ADDRESS_FMT, getuid(), ee);
|
||||||
#else
|
} else
|
||||||
(void) asprintf(&b->address, UNIX_USER_BUS_ADDRESS_FMT, ee);
|
|
||||||
#endif
|
|
||||||
} else {
|
|
||||||
#ifdef ENABLE_KDBUS
|
|
||||||
(void) asprintf(&b->address, KERNEL_USER_BUS_ADDRESS_FMT, getuid());
|
(void) asprintf(&b->address, KERNEL_USER_BUS_ADDRESS_FMT, getuid());
|
||||||
#else
|
|
||||||
return -ECONNREFUSED;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!b->address)
|
if (!b->address)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
@ -1372,11 +1363,7 @@ int bus_set_address_system_machine(sd_bus *b, const char *machine) {
|
||||||
if (!e)
|
if (!e)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
#ifdef ENABLE_KDBUS
|
|
||||||
b->address = strjoin("x-machine-kernel:machine=", e, ";x-machine-unix:machine=", e, NULL);
|
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)
|
if (!b->address)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
|
|
@ -177,7 +177,6 @@ static int export_legacy_dbus_address(
|
||||||
uid_t uid,
|
uid_t uid,
|
||||||
const char *runtime) {
|
const char *runtime) {
|
||||||
|
|
||||||
#ifdef ENABLE_KDBUS
|
|
||||||
_cleanup_free_ char *s = NULL;
|
_cleanup_free_ char *s = NULL;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
|
@ -195,7 +194,7 @@ static int export_legacy_dbus_address(
|
||||||
pam_syslog(handle, LOG_ERR, "Failed to set bus variable.");
|
pam_syslog(handle, LOG_ERR, "Failed to set bus variable.");
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return PAM_SUCCESS;
|
return PAM_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -509,11 +509,7 @@ int bus_machine_method_open_login(sd_bus_message *message, void *userdata, sd_bu
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
#ifdef ENABLE_KDBUS
|
|
||||||
# define ADDRESS_FMT "x-machine-kernel:pid=%1$" PID_PRI ";x-machine-unix:pid=%1$" PID_PRI
|
# define ADDRESS_FMT "x-machine-kernel:pid=%1$" PID_PRI ";x-machine-unix:pid=%1$" PID_PRI
|
||||||
#else
|
|
||||||
# define ADDRESS_FMT "x-machine-unix:pid=%1$" PID_PRI
|
|
||||||
#endif
|
|
||||||
if (asprintf(&address, ADDRESS_FMT, m->leader) < 0)
|
if (asprintf(&address, ADDRESS_FMT, m->leader) < 0)
|
||||||
return log_oom();
|
return log_oom();
|
||||||
|
|
||||||
|
|
|
@ -545,7 +545,6 @@ int bus_open_system_systemd(sd_bus **_bus) {
|
||||||
* directly to the system instance, instead of going via the
|
* directly to the system instance, instead of going via the
|
||||||
* bus */
|
* bus */
|
||||||
|
|
||||||
#ifdef ENABLE_KDBUS
|
|
||||||
r = sd_bus_new(&bus);
|
r = sd_bus_new(&bus);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
@ -564,7 +563,6 @@ int bus_open_system_systemd(sd_bus **_bus) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bus = sd_bus_unref(bus);
|
bus = sd_bus_unref(bus);
|
||||||
#endif
|
|
||||||
|
|
||||||
r = sd_bus_new(&bus);
|
r = sd_bus_new(&bus);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
|
@ -598,7 +596,6 @@ int bus_open_user_systemd(sd_bus **_bus) {
|
||||||
|
|
||||||
assert(_bus);
|
assert(_bus);
|
||||||
|
|
||||||
#ifdef ENABLE_KDBUS
|
|
||||||
r = sd_bus_new(&bus);
|
r = sd_bus_new(&bus);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
@ -616,7 +613,6 @@ int bus_open_user_systemd(sd_bus **_bus) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bus = sd_bus_unref(bus);
|
bus = sd_bus_unref(bus);
|
||||||
#endif
|
|
||||||
|
|
||||||
e = secure_getenv("XDG_RUNTIME_DIR");
|
e = secure_getenv("XDG_RUNTIME_DIR");
|
||||||
if (!e)
|
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) {
|
bool is_kdbus_wanted(void) {
|
||||||
_cleanup_free_ char *value = NULL;
|
_cleanup_free_ char *value = NULL;
|
||||||
|
#ifdef ENABLE_KDBUS
|
||||||
|
const bool configured = true;
|
||||||
|
#else
|
||||||
|
const bool configured = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
if (get_proc_cmdline_key("kdbus", NULL) <= 0) {
|
if (get_proc_cmdline_key("kdbus", NULL) > 0)
|
||||||
r = get_proc_cmdline_key("kdbus=", &value);
|
|
||||||
if (r <= 0 || parse_boolean(value) != 1)
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
r = get_proc_cmdline_key("kdbus=", &value);
|
||||||
|
if (r <= 0)
|
||||||
|
return configured;
|
||||||
|
|
||||||
|
return parse_boolean(value) == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_kdbus_available(void) {
|
bool is_kdbus_available(void) {
|
||||||
|
|
|
@ -6,9 +6,7 @@
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
|
|
||||||
g systemd-journal - -
|
g systemd-journal - -
|
||||||
m4_ifdef(`ENABLE_KDBUS',
|
|
||||||
u systemd-bus-proxy - "systemd Bus Proxy"
|
u systemd-bus-proxy - "systemd Bus Proxy"
|
||||||
)m4_dnl
|
|
||||||
m4_ifdef(`ENABLE_NETWORKD',
|
m4_ifdef(`ENABLE_NETWORKD',
|
||||||
u systemd-network - "systemd Network Management"
|
u systemd-network - "systemd Network Management"
|
||||||
)m4_dnl
|
)m4_dnl
|
||||||
|
|
|
@ -17,13 +17,11 @@ Before=network.target multi-user.target shutdown.target
|
||||||
Conflicts=shutdown.target
|
Conflicts=shutdown.target
|
||||||
Wants=network.target
|
Wants=network.target
|
||||||
|
|
||||||
m4_ifdef(`ENABLE_KDBUS',
|
|
||||||
# On kdbus systems we pull in the busname explicitly, because it
|
# On kdbus systems we pull in the busname explicitly, because it
|
||||||
# carries policy that allows the daemon to acquire its name.
|
# carries policy that allows the daemon to acquire its name.
|
||||||
Wants=org.freedesktop.network1.busname
|
Wants=org.freedesktop.network1.busname
|
||||||
After=org.freedesktop.network1.busname
|
After=org.freedesktop.network1.busname
|
||||||
|
|
||||||
)m4_dnl
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=notify
|
Type=notify
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
|
|
|
@ -10,13 +10,11 @@ Description=Network Name Resolution
|
||||||
Documentation=man:systemd-resolved.service(8)
|
Documentation=man:systemd-resolved.service(8)
|
||||||
After=systemd-networkd.service network.target
|
After=systemd-networkd.service network.target
|
||||||
|
|
||||||
m4_ifdef(`ENABLE_KDBUS',
|
|
||||||
# On kdbus systems we pull in the busname explicitly, because it
|
# On kdbus systems we pull in the busname explicitly, because it
|
||||||
# carries policy that allows the daemon to acquire its name.
|
# carries policy that allows the daemon to acquire its name.
|
||||||
Wants=org.freedesktop.resolve1.busname
|
Wants=org.freedesktop.resolve1.busname
|
||||||
After=org.freedesktop.resolve1.busname
|
After=org.freedesktop.resolve1.busname
|
||||||
|
|
||||||
)m4_dnl
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=notify
|
Type=notify
|
||||||
Restart=always
|
Restart=always
|
||||||
|
|
Loading…
Reference in a new issue