diff options
30 files changed, 91 insertions, 165 deletions
diff --git a/Makefile-man.am b/Makefile-man.am index 15781ba44a..9e2f4ba2e3 100644 --- a/Makefile-man.am +++ b/Makefile-man.am @@ -1052,7 +1052,6 @@ MANPAGES_ALIAS += \ endif -if ENABLE_KDBUS MANPAGES += \ man/sd_bus_creds_get_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 $(html-alias) -endif - if ENABLE_LOCALED MANPAGES += \ man/localectl.1 \ diff --git a/Makefile.am b/Makefile.am index 2a79a2a683..7cc70445cc 100644 --- a/Makefile.am +++ b/Makefile.am @@ -338,10 +338,8 @@ INSTALL_EXEC_HOOKS += \ install-aliases-hook \ install-touch-usr-hook -if ENABLE_KDBUS INSTALL_EXEC_HOOKS += \ install-busnames-target-wants-hook -endif # ------------------------------------------------------------------------------ AM_V_M4 = $(AM_V_M4_$(V)) @@ -522,10 +520,8 @@ dist_systemunit_DATA = \ units/initrd-switch-root.target \ units/machines.target -if ENABLE_KDBUS dist_systemunit_DATA += \ $(dist_systemunit_DATA_busnames) -endif dist_systemunit_DATA_busnames += \ units/busnames.target @@ -2622,7 +2618,6 @@ systemd_gpt_auto_generator_CFLAGS = \ endif # ------------------------------------------------------------------------------ -if ENABLE_KDBUS systemgenerator_PROGRAMS += \ systemd-dbus1-generator @@ -2645,7 +2640,6 @@ dist_xinitrc_SCRIPTS = \ INSTALL_EXEC_HOOKS += dbus1-generator-install-hook UNINSTALL_EXEC_HOOKS += dbus1-generator-uninstall-hook -endif # ------------------------------------------------------------------------------ systemd_sysv_generator_SOURCES = \ @@ -2793,7 +2787,6 @@ systemd_stdio_bridge_LDADD = \ libbus-proxy-core.la \ libshared.la -if ENABLE_KDBUS nodist_systemunit_DATA += \ units/systemd-bus-proxyd.service @@ -2805,7 +2798,6 @@ nodist_userunit_DATA += \ dist_userunit_DATA += \ units/user/systemd-bus-proxyd.socket -endif EXTRA_DIST += \ units/systemd-bus-proxyd.service.m4.in \ @@ -2841,6 +2833,7 @@ libsystemd_internal_la_SOURCES = \ src/systemd/sd-network.h \ src/systemd/sd-hwdb.h \ src/systemd/sd-device.h \ + src/libsystemd/libsystemd.sym \ src/libsystemd/sd-bus/sd-bus.c \ src/libsystemd/sd-bus/bus-control.c \ src/libsystemd/sd-bus/bus-control.h \ @@ -2917,9 +2910,6 @@ libsystemd_internal_la_SOURCES = \ src/libsystemd/sd-resolve/sd-resolve.c \ src/libsystemd/sd-resolve/resolve-util.h -nodist_libsystemd_internal_la_SOURCES = \ - src/libsystemd/libsystemd.sym - libsystemd_internal_la_LIBADD = \ libbasic.la \ -lresolv @@ -2928,14 +2918,10 @@ noinst_LTLIBRARIES += \ libsystemd-internal.la EXTRA_DIST += \ - src/libsystemd/libsystemd.sym.m4 \ src/libsystemd/libsystemd.pc.in \ src/libsystemd/sd-bus/DIFFERENCES \ src/libsystemd/sd-bus/GVARIANT-SERIALIZATION -BUILT_SOURCES += \ - src/libsystemd/libsystemd.sym - libsystemd_la_SOURCES = \ $(libsystemd_internal_la_SOURCES) \ $(libsystemd_journal_internal_la_SOURCES) @@ -2950,7 +2936,7 @@ libsystemd_la_CFLAGS = \ libsystemd_la_LDFLAGS = \ $(AM_LDFLAGS) \ -version-info $(LIBSYSTEMD_CURRENT):$(LIBSYSTEMD_REVISION):$(LIBSYSTEMD_AGE) \ - -Wl,--version-script=$(top_builddir)/src/libsystemd/libsystemd.sym + -Wl,--version-script=$(top_srcdir)/src/libsystemd/libsystemd.sym libsystemd_la_LIBADD = \ $(libsystemd_internal_la_LIBADD) \ @@ -2977,14 +2963,6 @@ pkginclude_HEADERS += \ src/systemd/sd-id128.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 += \ libsystemd.la @@ -5960,6 +5938,7 @@ substitutions = \ '|systemgidmax=$(SYSTEM_GID_MAX)|' \ '|TTY_GID=$(TTY_GID)|' \ '|systemsleepdir=$(systemsleepdir)|' \ + '|systemshutdowndir=$(systemshutdowndir)|' \ '|binfmtdir=$(binfmtdir)|' \ '|modulesloaddir=$(modulesloaddir)|' @@ -6179,10 +6158,8 @@ USER_UNIT_ALIASES += \ $(systemunitdir)/sound.target sound.target \ $(systemunitdir)/smartcard.target smartcard.target -if ENABLE_KDBUS USER_UNIT_ALIASES += \ $(systemunitdir)/busnames.target busnames.target -endif GENERAL_ALIASES += \ $(systemunitdir)/remote-fs.target $(pkgsysconfdir)/system/multi-user.target.wants/remote-fs.target \ @@ -6243,7 +6220,6 @@ DISTCHECK_CONFIGURE_FLAGS = \ --with-pamlibdir=$$dc_install_base/$(pamlibdir) \ --with-pamconfdir=$$dc_install_base/$(pamconfdir) \ --with-rootprefix=$$dc_install_base \ - --enable-kdbus \ --enable-compat-libs if HAVE_SYSV_COMPAT @@ -6304,11 +6280,6 @@ hwdb-update: http://standards.ieee.org/develop/regauth/iab/iab.txt && \ ./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 git-tag: git tag -s "v$(VERSION)" -m "systemd $(VERSION)" diff --git a/configure.ac b/configure.ac index b94dbd1613..e5d3994439 100644 --- a/configure.ac +++ b/configure.ac @@ -1203,9 +1203,9 @@ AM_CONDITIONAL(ENABLE_TERMINAL, [test "x$have_terminal" = "xyes" -a "x$have_unif # ------------------------------------------------------------------------------ have_kdbus=no -AC_ARG_ENABLE(kdbus, AS_HELP_STRING([--enable-kdbus], [do connect to kdbus by default])) -if test "x$enable_kdbus" = "xyes"; then - AC_DEFINE(ENABLE_KDBUS, 1, [Define if kdbus support is to be enabled]) +AC_ARG_ENABLE(kdbus, AS_HELP_STRING([--disable-kdbus], [do not connect to kdbus by default])) +if test "x$enable_kdbus" != "xno"; then + AC_DEFINE(ENABLE_KDBUS, 1, [Define if kdbus is to be connected to by default]) have_kdbus=yes M4_DEFINES="$M4_DEFINES -DENABLE_KDBUS" fi diff --git a/man/systemd-bus-proxyd.xml b/man/systemd-bus-proxyd.xml index bbcf3d0981..f7b94cd481 100644 --- a/man/systemd-bus-proxyd.xml +++ b/man/systemd-bus-proxyd.xml @@ -24,7 +24,7 @@ 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"> <refentryinfo> diff --git a/man/systemd-bus-proxyd@.service.xml b/man/systemd-bus-proxyd@.service.xml index 9dabc4dd5f..4ac6ba040c 100644 --- a/man/systemd-bus-proxyd@.service.xml +++ b/man/systemd-bus-proxyd@.service.xml @@ -24,7 +24,7 @@ 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> <title>systemd-bus-proxyd@.service</title> diff --git a/src/basic/def.h b/src/basic/def.h index 011c7c667e..5aaba1fe87 100644 --- a/src/basic/def.h +++ b/src/basic/def.h @@ -63,13 +63,7 @@ #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" diff --git a/src/bus-proxyd/bus-proxyd.c b/src/bus-proxyd/bus-proxyd.c index 3e398b53e9..3cc3b33ae7 100644 --- a/src/bus-proxyd/bus-proxyd.c +++ b/src/bus-proxyd/bus-proxyd.c @@ -239,11 +239,7 @@ static int parse_argv(int argc, char *argv[]) { if (!e) return log_oom(); -#ifdef ENABLE_KDBUS 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) return log_oom(); diff --git a/src/bus-proxyd/stdio-bridge.c b/src/bus-proxyd/stdio-bridge.c index 61bc08ae33..f275f6705f 100644 --- a/src/bus-proxyd/stdio-bridge.c +++ b/src/bus-proxyd/stdio-bridge.c @@ -110,11 +110,7 @@ static int parse_argv(int argc, char *argv[]) { if (!e) return log_oom(); -#ifdef ENABLE_KDBUS 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) return log_oom(); diff --git a/src/core/execute.c b/src/core/execute.c index a6ff5ac56e..94cc101738 100644 --- a/src/core/execute.c +++ b/src/core/execute.c @@ -1514,7 +1514,6 @@ static int exec_child( } } -#ifdef ENABLE_KDBUS if (params->bus_endpoint_fd >= 0 && context->bus_endpoint) { uid_t ep_uid = (uid == UID_INVALID) ? 0 : uid; @@ -1524,7 +1523,6 @@ static int exec_child( return r; } } -#endif /* If delegation is enabled we'll pass ownership of the cgroup * (but only in systemd's own controller hierarchy!) to the diff --git a/src/core/kmod-setup.c b/src/core/kmod-setup.c index f5584b6b14..e7a6bdc8c4 100644 --- a/src/core/kmod-setup.c +++ b/src/core/kmod-setup.c @@ -66,10 +66,8 @@ int kmod_setup(void) { /* this should never be a module */ { "unix", "/proc/net/unix", true, true, NULL }, -#ifdef ENABLE_KDBUS /* IPC is needed before we bring up any other services */ { "kdbus", "/sys/fs/kdbus", false, false, is_kdbus_wanted }, -#endif #ifdef HAVE_LIBIPTC /* netfilter is needed by networkd, nspawn among others, and cannot be autoloaded */ diff --git a/src/core/load-fragment-gperf.gperf.m4 b/src/core/load-fragment-gperf.gperf.m4 index 66c9145aa6..aae81c80cb 100644 --- a/src/core/load-fragment-gperf.gperf.m4 +++ b/src/core/load-fragment-gperf.gperf.m4 @@ -229,9 +229,7 @@ Service.BusName, config_parse_bus_name, 0, Service.FileDescriptorStoreMax, config_parse_unsigned, 0, offsetof(Service, n_fd_store_max) Service.NotifyAccess, config_parse_notify_access, 0, offsetof(Service, notify_access) 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_warn_compat, DISABLED_EXPERIMENTAL, 0') +Service.BusPolicy, config_parse_bus_endpoint_policy, 0, offsetof(Service, exec_context) EXEC_CONTEXT_CONFIG_ITEMS(Service)m4_dnl CGROUP_CONTEXT_CONFIG_ITEMS(Service)m4_dnl KILL_CONTEXT_CONFIG_ITEMS(Service)m4_dnl diff --git a/src/core/manager.c b/src/core/manager.c index eb80dd1b46..a1f37bbbb3 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -731,7 +731,6 @@ static int manager_setup_notify(Manager *m) { } static int manager_setup_kdbus(Manager *m) { -#ifdef ENABLE_KDBUS _cleanup_free_ char *p = NULL; 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"); log_debug("Successfully set up kdbus on %s", p); -#endif return 0; } diff --git a/src/core/mount-setup.c b/src/core/mount-setup.c index c35248eeae..42a6b952b9 100644 --- a/src/core/mount-setup.c +++ b/src/core/mount-setup.c @@ -104,10 +104,8 @@ static const MountPoint mount_table[] = { { "efivarfs", "/sys/firmware/efi/efivars", "efivarfs", NULL, MS_NOSUID|MS_NOEXEC|MS_NODEV, is_efi_boot, MNT_NONE }, #endif -#ifdef ENABLE_KDBUS { "kdbusfs", "/sys/fs/kdbus", "kdbusfs", NULL, MS_NOSUID|MS_NOEXEC|MS_NODEV, NULL, MNT_IN_CONTAINER }, -#endif }; /* These are API file systems that might be mounted by other software, diff --git a/src/core/service.c b/src/core/service.c index 71252e29e2..fa1e80b710 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -568,14 +568,12 @@ static int service_add_extras(Service *s) { s->notify_access = NOTIFY_MAIN; if (s->bus_name) { -#ifdef ENABLE_KDBUS const char *n; n = strjoina(s->bus_name, ".busname"); r = unit_add_dependency_by_name(UNIT(s), UNIT_AFTER, n, NULL, true); if (r < 0) return r; -#endif r = unit_watch_bus_name(UNIT(s), s->bus_name); if (r < 0) @@ -1180,7 +1178,6 @@ static int service_spawn( } else path = UNIT(s)->cgroup_path; -#ifdef ENABLE_KDBUS if (s->exec_context.bus_endpoint) { r = bus_kernel_create_endpoint(UNIT(s)->manager->running_as == MANAGER_SYSTEM ? "system" : "user", UNIT(s)->id, &bus_endpoint_path); @@ -1192,7 +1189,6 @@ static int service_spawn( * as the service is running. */ exec_params.bus_endpoint_fd = s->bus_endpoint_fd = r; } -#endif exec_params.argv = argv; exec_params.fds = fds; diff --git a/src/libsystemd/.gitignore b/src/libsystemd/.gitignore index d48e1cdd13..50a1692374 100644 --- a/src/libsystemd/.gitignore +++ b/src/libsystemd/.gitignore @@ -1,2 +1 @@ -/libsystemd.sym /libsystemd.pc diff --git a/src/libsystemd/libsystemd.sym.m4 b/src/libsystemd/libsystemd.sym index 3121e71282..809db1f6cc 100644 --- a/src/libsystemd/libsystemd.sym.m4 +++ b/src/libsystemd/libsystemd.sym @@ -459,41 +459,3 @@ global: sd_event_source_get_signal; sd_event_source_get_child_pid; } LIBSYSTEMD_220; - -m4_ifdef(`ENABLE_KDBUS', -LIBSYSTEMD_FUTURE { -global: - /* sd-utf8 */ - sd_utf8_is_valid; - sd_ascii_is_valid; - - /* sd-resolve */ - sd_resolve_default; - sd_resolve_new; - sd_resolve_ref; - sd_resolve_unref; - sd_resolve_get_fd; - sd_resolve_get_events; - sd_resolve_get_timeout; - sd_resolve_process; - sd_resolve_wait; - sd_resolve_get_tid; - sd_resolve_attach_event; - sd_resolve_detach_event; - sd_resolve_get_event; - sd_resolve_getaddrinfo; - sd_resolve_getnameinfo; - sd_resolve_res_query; - sd_resolve_res_search; - sd_resolve_query_ref; - sd_resolve_query_unref; - sd_resolve_query_is_done; - sd_resolve_query_get_userdata; - sd_resolve_query_set_userdata; - sd_resolve_query_get_resolve; - - /* sd-path */ - sd_path_home; - sd_path_search; -} LIBSYSTEMD_220; -) diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c index 0881b4779a..5dd6468707 100644 --- a/src/libsystemd/sd-bus/sd-bus.c +++ b/src/libsystemd/sd-bus/sd-bus.c @@ -1239,18 +1239,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; @@ -1372,11 +1363,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; @@ -2958,10 +2945,8 @@ _public_ int sd_bus_add_match( /* Do not install server-side matches for matches * against the local service, interface or bus - * path. Also, when on kdbus don't install driver - * matches server side. */ - if (scope == BUS_MATCH_GENERIC || - (!bus->is_kernel && scope == BUS_MATCH_DRIVER)) { + * path. */ + if (scope != BUS_MATCH_LOCAL) { if (!bus->is_kernel) { /* When this is not a kernel transport, we diff --git a/src/login/logind-button.c b/src/login/logind-button.c index 8079d0b5aa..210b889c4f 100644 --- a/src/login/logind-button.c +++ b/src/login/logind-button.c @@ -100,7 +100,7 @@ static void button_lid_switch_handle_action(Manager *manager, bool is_edge) { assert(manager); /* If we are docked, handle the lid switch differently */ - if (manager_is_docked_or_multiple_displays(manager)) + if (manager_is_docked_or_external_displays(manager)) handle_action = manager->handle_lid_switch_docked; else handle_action = manager->handle_lid_switch; diff --git a/src/login/logind-core.c b/src/login/logind-core.c index f9e6ddfb3f..a6c01f7d85 100644 --- a/src/login/logind-core.c +++ b/src/login/logind-core.c @@ -477,7 +477,7 @@ int manager_spawn_autovt(Manager *m, unsigned int vtnr) { return r; } -bool manager_is_docked(Manager *m) { +static bool manager_is_docked(Manager *m) { Iterator i; Button *b; @@ -488,7 +488,7 @@ bool manager_is_docked(Manager *m) { return false; } -int manager_count_displays(Manager *m) { +static int manager_count_external_displays(Manager *m) { _cleanup_udev_enumerate_unref_ struct udev_enumerate *e = NULL; struct udev_list_entry *item = NULL, *first = NULL; int r; @@ -510,7 +510,8 @@ int manager_count_displays(Manager *m) { udev_list_entry_foreach(item, first) { _cleanup_udev_device_unref_ struct udev_device *d = NULL; struct udev_device *p; - const char *status; + const char *status, *enabled, *dash, *nn, *i; + bool external = false; d = udev_device_new_from_syspath(m->udev, udev_list_entry_get_name(item)); if (!d) @@ -526,6 +527,40 @@ int manager_count_displays(Manager *m) { if (!streq_ptr(udev_device_get_subsystem(p), "drm")) continue; + nn = udev_device_get_sysname(d); + if (!nn) + continue; + + /* Ignore internal displays: the type is encoded in + * the sysfs name, as the second dash seperated item + * (the first is the card name, the last the connector + * number). We implement a whitelist of external + * displays here, rather than a whitelist, to ensure + * we don't block suspends too eagerly. */ + dash = strchr(nn, '-'); + if (!dash) + continue; + + dash++; + FOREACH_STRING(i, "VGA-", "DVI-I-", "DVI-D-", "DVI-A-" + "Composite-", "SVIDEO-", "Component-", + "DIN-", "DP-", "HDMI-A-", "HDMI-B-", "TV-") { + + if (startswith(dash, i)) { + external = true; + break; + } + } + if (!external) + continue; + + /* Ignore ports that are not enabled */ + enabled = udev_device_get_sysattr_value(d, "enabled"); + if (!enabled) + continue; + if (!streq_ptr(enabled, "enabled")) + continue; + /* We count any connector which is not explicitly * "disconnected" as connected. */ status = udev_device_get_sysattr_value(d, "status"); @@ -536,7 +571,7 @@ int manager_count_displays(Manager *m) { return n; } -bool manager_is_docked_or_multiple_displays(Manager *m) { +bool manager_is_docked_or_external_displays(Manager *m) { int n; /* If we are docked don't react to lid closing */ @@ -547,11 +582,11 @@ bool manager_is_docked_or_multiple_displays(Manager *m) { /* If we have more than one display connected, * assume that we are docked. */ - n = manager_count_displays(m); + n = manager_count_external_displays(m); if (n < 0) log_warning_errno(n, "Display counting failed: %m"); - else if (n > 1) { - log_debug("Multiple (%i) displays connected.", n); + else if (n >= 1) { + log_debug("External (%i) displays connected.", n); return true; } diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c index e6f9ec7845..8ebcd3f5ca 100644 --- a/src/login/logind-dbus.c +++ b/src/login/logind-dbus.c @@ -258,7 +258,7 @@ static int property_get_docked( assert(reply); assert(m); - return sd_bus_message_append(reply, "b", manager_is_docked_or_multiple_displays(m)); + return sd_bus_message_append(reply, "b", manager_is_docked_or_external_displays(m)); } static int method_get_session(sd_bus_message *message, void *userdata, sd_bus_error *error) { diff --git a/src/login/logind-user.c b/src/login/logind-user.c index bfbdc9b1b8..21d7268120 100644 --- a/src/login/logind-user.c +++ b/src/login/logind-user.c @@ -36,9 +36,10 @@ #include "bus-error.h" #include "conf-parser.h" #include "clean-ipc.h" -#include "logind-user.h" #include "smack-util.h" #include "formats-util.h" +#include "label.h" +#include "logind-user.h" User* user_new(Manager *m, uid_t uid, gid_t gid, const char *name) { User *u; @@ -329,7 +330,7 @@ static int user_mkdir_runtime_path(User *u) { if (path_is_mount_point(p, 0) <= 0) { _cleanup_free_ char *t = NULL; - (void) mkdir(p, 0700); + (void) mkdir_label(p, 0700); if (mac_smack_use()) r = asprintf(&t, "mode=0700,smackfsroot=*,uid=" UID_FMT ",gid=" GID_FMT ",size=%zu", u->uid, u->gid, u->manager->runtime_dir_size); @@ -357,6 +358,10 @@ static int user_mkdir_runtime_path(User *u) { goto fail; } } + + r = label_fix(p, false, false); + if (r < 0) + log_warning_errno(r, "Failed to fix label of '%s', ignoring: %m", p); } u->runtime_path = p; diff --git a/src/login/logind.h b/src/login/logind.h index cd226f55fc..feb381d0b1 100644 --- a/src/login/logind.h +++ b/src/login/logind.h @@ -156,9 +156,7 @@ int manager_get_idle_hint(Manager *m, dual_timestamp *t); int manager_get_user_by_pid(Manager *m, pid_t pid, User **user); int manager_get_session_by_pid(Manager *m, pid_t pid, Session **session); -bool manager_is_docked(Manager *m); -int manager_count_displays(Manager *m); -bool manager_is_docked_or_multiple_displays(Manager *m); +bool manager_is_docked_or_external_displays(Manager *m); extern const sd_bus_vtable manager_vtable[]; diff --git a/src/login/pam_systemd.c b/src/login/pam_systemd.c index b5d419000c..0ebdfdf19e 100644 --- a/src/login/pam_systemd.c +++ b/src/login/pam_systemd.c @@ -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; } diff --git a/src/machine/machine-dbus.c b/src/machine/machine-dbus.c index 9f026beb13..7813a0bcc7 100644 --- a/src/machine/machine-dbus.c +++ b/src/machine/machine-dbus.c @@ -509,11 +509,7 @@ int bus_machine_method_open_login(sd_bus_message *message, void *userdata, sd_bu if (r < 0) return r; -#ifdef ENABLE_KDBUS # 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) return log_oom(); diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c index 8fcc289957..11350dad71 100644 --- a/src/shared/bus-util.c +++ b/src/shared/bus-util.c @@ -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) @@ -2034,15 +2030,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) { diff --git a/src/shared/watchdog.c b/src/shared/watchdog.c index 2fe4eb81cf..9d39beb340 100644 --- a/src/shared/watchdog.c +++ b/src/shared/watchdog.c @@ -60,8 +60,13 @@ static int update_timeout(void) { flags = WDIOS_ENABLECARD; r = ioctl(watchdog_fd, WDIOC_SETOPTIONS, &flags); - if (r < 0) - return log_warning_errno(errno, "Failed to enable hardware watchdog: %m"); + if (r < 0) { + /* ENOTTY means the watchdog is always enabled so we're fine */ + log_full(errno == ENOTTY ? LOG_DEBUG : LOG_WARNING, + "Failed to enable hardware watchdog: %m"); + if (errno != ENOTTY) + return -errno; + } r = ioctl(watchdog_fd, WDIOC_KEEPALIVE, 0); if (r < 0) diff --git a/src/udev/udevd.c b/src/udev/udevd.c index 5ce11606c9..11f1f6372e 100644 --- a/src/udev/udevd.c +++ b/src/udev/udevd.c @@ -43,6 +43,7 @@ #include "sd-daemon.h" #include "sd-event.h" +#include "terminal-util.h" #include "signal-util.h" #include "event-util.h" #include "netlink-util.h" @@ -1687,6 +1688,10 @@ int main(int argc, char *argv[]) { log_info("starting version " VERSION); + /* connect /dev/null to stdin, stdout, stderr */ + if (log_get_max_level() < LOG_DEBUG) + (void) make_null_stdio(); + pid = fork(); switch (pid) { case 0: diff --git a/sysusers.d/systemd.conf.m4 b/sysusers.d/systemd.conf.m4 index 23175de1f5..81b1d79c37 100644 --- a/sysusers.d/systemd.conf.m4 +++ b/sysusers.d/systemd.conf.m4 @@ -6,9 +6,7 @@ # (at your option) any later version. g systemd-journal - - -m4_ifdef(`ENABLE_KDBUS', u systemd-bus-proxy - "systemd Bus Proxy" -)m4_dnl m4_ifdef(`ENABLE_NETWORKD', u systemd-network - "systemd Network Management" )m4_dnl diff --git a/units/systemd-networkd.service.m4.in b/units/systemd-networkd.service.m4.in index 7f216f331c..64d9130c24 100644 --- a/units/systemd-networkd.service.m4.in +++ b/units/systemd-networkd.service.m4.in @@ -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 diff --git a/units/systemd-resolved.service.m4.in b/units/systemd-resolved.service.m4.in index 98ae564af6..dce5402458 100644 --- a/units/systemd-resolved.service.m4.in +++ b/units/systemd-resolved.service.m4.in @@ -10,13 +10,11 @@ Description=Network Name Resolution Documentation=man:systemd-resolved.service(8) After=systemd-networkd.service 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.resolve1.busname After=org.freedesktop.resolve1.busname -)m4_dnl [Service] Type=notify Restart=always |