summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bootchart/bootchart.c2
-rw-r--r--src/core/busname.c2
-rw-r--r--src/core/kmod-setup.c20
-rw-r--r--src/core/manager.c2
-rw-r--r--src/core/socket.c4
-rw-r--r--src/hwdb/hwdb.c1
-rw-r--r--src/libsystemd-network/lldp-tlv.c2
-rw-r--r--src/libsystemd/sd-bus/bus-kernel.c9
-rw-r--r--src/login/logind-user.c90
-rw-r--r--src/network/networkctl.c2
-rw-r--r--src/network/networkd-ipv4ll.c2
-rw-r--r--src/network/networkd-link.c6
-rw-r--r--src/network/networkd-manager.c4
-rw-r--r--src/network/networkd.h1
-rw-r--r--src/nss-resolve/nss-resolve.c14
-rw-r--r--src/shared/efivars.c2
-rw-r--r--src/shared/util.c17
-rw-r--r--src/udev/udev-event.c6
-rw-r--r--src/udev/udev-rules.c2
-rw-r--r--src/udev/udevadm-hwdb.c1
-rw-r--r--src/udev/udevd.c2
21 files changed, 99 insertions, 92 deletions
diff --git a/src/bootchart/bootchart.c b/src/bootchart/bootchart.c
index 45fab92598..3360bc85be 100644
--- a/src/bootchart/bootchart.c
+++ b/src/bootchart/bootchart.c
@@ -531,7 +531,7 @@ int main(int argc, char *argv[]) {
/* don't complain when overrun once, happens most commonly on 1st sample */
if (overrun > 1)
- log_warning("systemd-boochart: sample time overrun %i times\n", overrun);
+ log_warning("systemd-bootchart: sample time overrun %i times\n", overrun);
return 0;
}
diff --git a/src/core/busname.c b/src/core/busname.c
index 11f3b98009..3f5abbcb24 100644
--- a/src/core/busname.c
+++ b/src/core/busname.c
@@ -125,7 +125,7 @@ static int busname_arm_timer(BusName *n) {
return sd_event_source_set_enabled(n->timer_event_source, SD_EVENT_ONESHOT);
}
- r = sd_event_add_time(
+ r = sd_event_add_time(
UNIT(n)->manager->event,
&n->timer_event_source,
CLOCK_MONOTONIC,
diff --git a/src/core/kmod-setup.c b/src/core/kmod-setup.c
index 6cc5951719..cf543c81a3 100644
--- a/src/core/kmod-setup.c
+++ b/src/core/kmod-setup.c
@@ -53,26 +53,27 @@ int kmod_setup(void) {
static const struct {
const char *module;
const char *path;
- bool warn;
+ bool warn_if_unavailable:1;
+ bool warn_if_module:1;
bool (*condition_fn)(void);
} kmod_table[] = {
/* auto-loading on use doesn't work before udev is up */
- { "autofs4", "/sys/class/misc/autofs", true, NULL },
+ { "autofs4", "/sys/class/misc/autofs", true, false, NULL },
/* early configure of ::1 on the loopback device */
- { "ipv6", "/sys/module/ipv6", true, NULL },
+ { "ipv6", "/sys/module/ipv6", false, true, NULL },
/* this should never be a module */
- { "unix", "/proc/net/unix", true, NULL },
+ { "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, is_kdbus_wanted },
+ { "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 */
- { "ip_tables", "/proc/net/ip_tables_names", false, NULL },
+ { "ip_tables", "/proc/net/ip_tables_names", false, false, NULL },
#endif
};
struct kmod_ctx *ctx = NULL;
@@ -91,7 +92,7 @@ int kmod_setup(void) {
if (kmod_table[i].condition_fn && !kmod_table[i].condition_fn())
continue;
- if (kmod_table[i].warn)
+ if (kmod_table[i].warn_if_module)
log_debug("Your kernel apparently lacks built-in %s support. Might be "
"a good idea to compile it in. We'll now try to work around "
"this by loading the module...", kmod_table[i].module);
@@ -116,8 +117,9 @@ int kmod_setup(void) {
log_info("Inserted module '%s'", kmod_module_get_name(mod));
else if (r == KMOD_PROBE_APPLY_BLACKLIST)
log_info("Module '%s' is blacklisted", kmod_module_get_name(mod));
- else if (kmod_table[i].warn)
- log_error("Failed to insert module '%s'", kmod_module_get_name(mod));
+ else
+ log_full((kmod_table[i].warn_if_unavailable || (r < 0 && r != -ENOENT)) ? LOG_ERR : LOG_DEBUG,
+ "Failed to insert module '%s'", kmod_module_get_name(mod));
kmod_module_unref(mod);
}
diff --git a/src/core/manager.c b/src/core/manager.c
index a1c54339ea..564fb5d579 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -665,7 +665,7 @@ static int manager_setup_notify(Manager *m) {
if (m->notify_fd < 0) {
_cleanup_close_ int fd = -1;
- union sockaddr_union sa = {
+ union sockaddr_union sa = {
.sa.sa_family = AF_UNIX,
};
static const int one = 1;
diff --git a/src/core/socket.c b/src/core/socket.c
index fc5eb1464a..0239962055 100644
--- a/src/core/socket.c
+++ b/src/core/socket.c
@@ -832,7 +832,7 @@ static void socket_apply_socket_options(Socket *s, int fd) {
}
if (s->keep_alive_interval) {
- int value = s->keep_alive_interval / USEC_PER_SEC;
+ int value = s->keep_alive_interval / USEC_PER_SEC;
if (setsockopt(fd, SOL_TCP, TCP_KEEPINTVL, &value, sizeof(value)) < 0)
log_unit_warning_errno(UNIT(s), errno, "TCP_KEEPINTVL failed: %m");
}
@@ -2589,7 +2589,7 @@ static void socket_trigger_notify(Unit *u, Unit *other) {
/* Don't propagate state changes from the service if we are
already down or accepting connections */
- if ((s->state != SOCKET_RUNNING &&
+ if ((s->state != SOCKET_RUNNING &&
s->state != SOCKET_LISTENING) ||
s->accept)
return;
diff --git a/src/hwdb/hwdb.c b/src/hwdb/hwdb.c
index 446de3a2fc..62b76c9e89 100644
--- a/src/hwdb/hwdb.c
+++ b/src/hwdb/hwdb.c
@@ -43,6 +43,7 @@ static const char *arg_root = "";
static const char * const conf_file_dirs[] = {
"/etc/udev/hwdb.d",
+ "/run/udev/hwdb.d",
UDEVLIBEXECDIR "/hwdb.d",
NULL
};
diff --git a/src/libsystemd-network/lldp-tlv.c b/src/libsystemd-network/lldp-tlv.c
index e32783f3eb..0cea5b10a6 100644
--- a/src/libsystemd-network/lldp-tlv.c
+++ b/src/libsystemd-network/lldp-tlv.c
@@ -221,7 +221,7 @@ int tlv_packet_read_string(tlv_packet *m, char **data, uint16_t *data_length) {
return r;
*data = (char *) val;
- *data_length = m->container->length;
+ *data_length = m->container->length;
m->container->read_pos += m->container->length;
diff --git a/src/libsystemd/sd-bus/bus-kernel.c b/src/libsystemd/sd-bus/bus-kernel.c
index 417e4d5903..572a9c6e64 100644
--- a/src/libsystemd/sd-bus/bus-kernel.c
+++ b/src/libsystemd/sd-bus/bus-kernel.c
@@ -1574,7 +1574,6 @@ int bus_kernel_create_bus(const char *name, bool world, char **s) {
make = alloca0_align(offsetof(struct kdbus_cmd, items) +
ALIGN8(offsetof(struct kdbus_item, bloom_parameter) + sizeof(struct kdbus_bloom_parameter)) +
ALIGN8(offsetof(struct kdbus_item, data64) + sizeof(uint64_t)) +
- ALIGN8(offsetof(struct kdbus_item, data64) + sizeof(uint64_t)) +
ALIGN8(offsetof(struct kdbus_item, str) + DECIMAL_STR_MAX(uid_t) + 1 + l + 1),
8);
@@ -1593,14 +1592,6 @@ int bus_kernel_create_bus(const char *name, bool world, char **s) {
make->size += ALIGN8(n->size);
- /* The buses we create make no restrictions on what metadata
- * peers can read from incoming messages. */
- n = KDBUS_ITEM_NEXT(n);
- n->type = KDBUS_ITEM_ATTACH_FLAGS_RECV;
- n->size = offsetof(struct kdbus_item, data64) + sizeof(uint64_t);
- n->data64[0] = _KDBUS_ATTACH_ANY;
- make->size += ALIGN8(n->size);
-
/* Provide all metadata via bus-owner queries */
n = KDBUS_ITEM_NEXT(n);
n->type = KDBUS_ITEM_ATTACH_FLAGS_SEND;
diff --git a/src/login/logind-user.c b/src/login/logind-user.c
index dc3db9abda..373c9938e7 100644
--- a/src/login/logind-user.c
+++ b/src/login/logind-user.c
@@ -738,54 +738,72 @@ int user_kill(User *u, int signo) {
return manager_kill_unit(u->manager, u->slice, KILL_ALL, signo, NULL);
}
+static bool
+elect_display_filter(Session *s) {
+ /* Return true if the session is a candidate for the user’s ‘primary
+ * session’ or ‘display’. */
+ assert(s);
+
+ return (s->class == SESSION_USER && !s->stopping);
+}
+
+static int
+elect_display_compare(Session *s1, Session *s2) {
+ /* Indexed by SessionType. Lower numbers mean more preferred. */
+ const int type_ranks[_SESSION_TYPE_MAX] = {
+ [SESSION_UNSPECIFIED] = 0,
+ [SESSION_TTY] = -2,
+ [SESSION_X11] = -3,
+ [SESSION_WAYLAND] = -3,
+ [SESSION_MIR] = -3,
+ [SESSION_WEB] = -1,
+ };
+
+ /* Calculate the partial order relationship between s1 and s2,
+ * returning < 0 if s1 is preferred as the user’s ‘primary session’,
+ * 0 if s1 and s2 are equally preferred or incomparable, or > 0 if s2
+ * is preferred.
+ *
+ * s1 or s2 may be NULL. */
+ if ((s1 == NULL) != (s2 == NULL))
+ return (s1 == NULL) - (s2 == NULL);
+
+ if (s1->stopping != s2->stopping)
+ return s1->stopping - s2->stopping;
+
+ if ((s1->class != SESSION_USER) != (s2->class != SESSION_USER))
+ return (s1->class != SESSION_USER) - (s2->class != SESSION_USER);
+
+ if ((s1->type == _SESSION_TYPE_INVALID) != (s2->type == _SESSION_TYPE_INVALID))
+ return (s1->type == _SESSION_TYPE_INVALID) - (s2->type == _SESSION_TYPE_INVALID);
+
+ if (s1->type != s2->type)
+ return type_ranks[s1->type] - type_ranks[s2->type];
+
+ return 0;
+}
+
void user_elect_display(User *u) {
- Session *graphical = NULL, *text = NULL, *other = NULL, *s;
+ Session *s;
assert(u);
/* This elects a primary session for each user, which we call
* the "display". We try to keep the assignment stable, but we
* "upgrade" to better choices. */
+ log_debug("Electing new display for user %s", u->name);
LIST_FOREACH(sessions_by_user, s, u->sessions) {
-
- if (s->class != SESSION_USER)
- continue;
-
- if (s->stopping)
+ if (!elect_display_filter(s)) {
+ log_debug("Ignoring session %s", s->id);
continue;
+ }
- if (SESSION_TYPE_IS_GRAPHICAL(s->type))
- graphical = s;
- else if (s->type == SESSION_TTY)
- text = s;
- else
- other = s;
- }
-
- if (graphical &&
- (!u->display ||
- u->display->class != SESSION_USER ||
- u->display->stopping ||
- !SESSION_TYPE_IS_GRAPHICAL(u->display->type))) {
- u->display = graphical;
- return;
- }
-
- if (text &&
- (!u->display ||
- u->display->class != SESSION_USER ||
- u->display->stopping ||
- u->display->type != SESSION_TTY)) {
- u->display = text;
- return;
+ if (elect_display_compare(s, u->display) < 0) {
+ log_debug("Choosing session %s in preference to %s", s->id, u->display ? u->display->id : "-");
+ u->display = s;
+ }
}
-
- if (other &&
- (!u->display ||
- u->display->class != SESSION_USER ||
- u->display->stopping))
- u->display = other;
}
static const char* const user_state_table[_USER_STATE_MAX] = {
diff --git a/src/network/networkctl.c b/src/network/networkctl.c
index 3454394977..68925debe6 100644
--- a/src/network/networkctl.c
+++ b/src/network/networkctl.c
@@ -814,7 +814,7 @@ static char *lldp_system_caps(uint16_t cap) {
}
if (cap & LLDP_SYSTEM_CAPABILITIES_ROUTER) {
- s = strjoin(t, lldp_system_capability_to_string(LLDP_SYSTEM_CAPABILITIES_ROUTER), " ", NULL);
+ s = strjoin(t, lldp_system_capability_to_string(LLDP_SYSTEM_CAPABILITIES_ROUTER), " ", NULL);
if (!s)
return NULL;
diff --git a/src/network/networkd-ipv4ll.c b/src/network/networkd-ipv4ll.c
index cfc0d90470..14b8770429 100644
--- a/src/network/networkd-ipv4ll.c
+++ b/src/network/networkd-ipv4ll.c
@@ -34,7 +34,7 @@ static int ipv4ll_address_lost(Link *link) {
assert(link);
link->ipv4ll_route = false;
- link->ipv4ll_address = false;
+ link->ipv4ll_address = false;
r = sd_ipv4ll_get_address(link->ipv4ll, &addr);
if (r < 0)
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index 5c62300b70..127bc1249a 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -1481,9 +1481,6 @@ static int link_set_ipv4_forward(Link *link) {
const char *p = NULL;
int r;
- if (link->network->ip_forward == ADDRESS_FAMILY_KERNEL)
- return 0;
-
p = strjoina("/proc/sys/net/ipv4/conf/", link->ifname, "/forwarding");
r = write_string_file_no_create(p, one_zero(link_ipv4_forward_enabled(link)));
if (r < 0)
@@ -1500,9 +1497,6 @@ static int link_set_ipv6_forward(Link *link) {
if (!socket_ipv6_is_supported())
return 0;
- if (link->network->ip_forward == ADDRESS_FAMILY_KERNEL)
- return 0;
-
p = strjoina("/proc/sys/net/ipv6/conf/", link->ifname, "/forwarding");
r = write_string_file_no_create(p, one_zero(link_ipv6_forward_enabled(link)));
if (r < 0)
diff --git a/src/network/networkd-manager.c b/src/network/networkd-manager.c
index 2cc53df4b1..db737ad484 100644
--- a/src/network/networkd-manager.c
+++ b/src/network/networkd-manager.c
@@ -853,8 +853,6 @@ const char *address_family_boolean_to_string(AddressFamilyBoolean b) {
return "ipv4";
if (b == ADDRESS_FAMILY_IPV6)
return "ipv6";
- if (b == ADDRESS_FAMILY_KERNEL)
- return "kernel";
return NULL;
}
@@ -874,8 +872,6 @@ AddressFamilyBoolean address_family_boolean_from_string(const char *s) {
return ADDRESS_FAMILY_IPV4;
if (streq(s, "ipv6"))
return ADDRESS_FAMILY_IPV6;
- if (streq(s, "kernel"))
- return ADDRESS_FAMILY_KERNEL;
return _ADDRESS_FAMILY_BOOLEAN_INVALID;
}
diff --git a/src/network/networkd.h b/src/network/networkd.h
index 49afeffe81..4b13d4aed1 100644
--- a/src/network/networkd.h
+++ b/src/network/networkd.h
@@ -60,7 +60,6 @@ typedef enum AddressFamilyBoolean {
ADDRESS_FAMILY_IPV4 = 1,
ADDRESS_FAMILY_IPV6 = 2,
ADDRESS_FAMILY_YES = 3,
- ADDRESS_FAMILY_KERNEL = 4,
_ADDRESS_FAMILY_BOOLEAN_MAX,
_ADDRESS_FAMILY_BOOLEAN_INVALID = -1,
} AddressFamilyBoolean;
diff --git a/src/nss-resolve/nss-resolve.c b/src/nss-resolve/nss-resolve.c
index bc6c5dc2a0..8f181a6c72 100644
--- a/src/nss-resolve/nss-resolve.c
+++ b/src/nss-resolve/nss-resolve.c
@@ -365,13 +365,13 @@ enum nss_status _nss_resolve_gethostbyname3_r(
int32_t *ttlp,
char **canonp);
- fallback = (enum nss_status (*)(const char *name,
- int af,
- struct hostent *result,
- char *buffer, size_t buflen,
- int *errnop, int *h_errnop,
- int32_t *ttlp,
- char **canonp))
+ fallback = (enum nss_status (*)(const char *name,
+ int af,
+ struct hostent *result,
+ char *buffer, size_t buflen,
+ int *errnop, int *h_errnop,
+ int32_t *ttlp,
+ char **canonp))
find_fallback("libnss_dns.so.2", "_nss_dns_gethostbyname3_r");
if (fallback)
return fallback(name, af, result, buffer, buflen, errnop, h_errnop, ttlp, canonp);
diff --git a/src/shared/efivars.c b/src/shared/efivars.c
index d34d977b9a..0d6ecf52cf 100644
--- a/src/shared/efivars.c
+++ b/src/shared/efivars.c
@@ -483,7 +483,7 @@ int efi_add_boot_option(uint16_t id, const char *title,
devicep->length = offsetof(struct device_path, drive) + sizeof(struct drive_path);
devicep->drive.part_nr = part;
devicep->drive.part_start = pstart;
- devicep->drive.part_size = psize;
+ devicep->drive.part_size = psize;
devicep->drive.signature_type = SIGNATURE_TYPE_GUID;
devicep->drive.mbr_type = MBR_TYPE_EFI_PARTITION_TABLE_HEADER;
id128_to_efi_guid(part_uuid, devicep->drive.signature);
diff --git a/src/shared/util.c b/src/shared/util.c
index 311acbb349..1442301cd7 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -4931,11 +4931,15 @@ int bind_remount_recursive(const char *prefix, bool ro) {
while ((x = set_steal_first(todo))) {
- r = set_consume(done, x);
- if (r == -EEXIST)
+ r = set_put(done, x);
+ if (r == -EEXIST) {
+ free(x);
continue;
- if (r < 0)
+ }
+ if (r < 0) {
+ free(x);
return r;
+ }
/* Try to reuse the original flag set, but
* don't care for errors, in case of
@@ -4945,14 +4949,15 @@ int bind_remount_recursive(const char *prefix, bool ro) {
orig_flags &= ~MS_RDONLY;
if (mount(NULL, x, NULL, orig_flags|MS_BIND|MS_REMOUNT|(ro ? MS_RDONLY : 0), NULL) < 0) {
-
/* Deal with mount points that are
* obstructed by a later mount */
- if (errno != ENOENT)
+ if (errno != ENOENT) {
+ free(x);
return -errno;
+ }
}
-
+ free(x);
}
}
}
diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c
index 4dcf8f2e1c..8d17c5e1e3 100644
--- a/src/udev/udev-event.c
+++ b/src/udev/udev-event.c
@@ -631,9 +631,9 @@ static int spawn_wait(struct udev_event *event,
if (timeout_warn_usec > 0 && timeout_warn_usec < timeout_usec && age_usec < timeout_warn_usec) {
spawn.timeout_warn = timeout_warn_usec - age_usec;
- r = sd_event_add_time(e, NULL, clock_boottime_or_monotonic(),
- usec + spawn.timeout_warn, USEC_PER_SEC,
- on_spawn_timeout_warning, &spawn);
+ r = sd_event_add_time(e, NULL, clock_boottime_or_monotonic(),
+ usec + spawn.timeout_warn, USEC_PER_SEC,
+ on_spawn_timeout_warning, &spawn);
if (r < 0)
return r;
}
diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c
index 915371525f..7be9a2311a 100644
--- a/src/udev/udev-rules.c
+++ b/src/udev/udev-rules.c
@@ -1941,7 +1941,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules,
udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(event->dev)) {
const char *devlink;
- devlink = udev_list_entry_get_name(list_entry) + strlen("/dev/");
+ devlink = udev_list_entry_get_name(list_entry) + strlen("/dev/");
if (match_key(rules, cur, devlink) == 0) {
match = true;
break;
diff --git a/src/udev/udevadm-hwdb.c b/src/udev/udevadm-hwdb.c
index 00609e31b5..4c933de696 100644
--- a/src/udev/udevadm-hwdb.c
+++ b/src/udev/udevadm-hwdb.c
@@ -37,6 +37,7 @@
static const char * const conf_file_dirs[] = {
"/etc/udev/hwdb.d",
+ "/run/udev/hwdb.d",
UDEVLIBEXECDIR "/hwdb.d",
NULL
};
diff --git a/src/udev/udevd.c b/src/udev/udevd.c
index eb43091190..26aae89990 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
@@ -1638,7 +1638,7 @@ int main(int argc, char *argv[]) {
arg_children_max = 8;
if (sched_getaffinity(0, sizeof (cpu_set), &cpu_set) == 0) {
- arg_children_max += CPU_COUNT(&cpu_set) * 2;
+ arg_children_max += CPU_COUNT(&cpu_set) * 2;
}
log_debug("set children_max to %u", arg_children_max);