1
0
mirror of https://github.com/systemd/systemd synced 2026-04-04 06:04:51 +02:00

Compare commits

..

No commits in common. "4b499063acd64c7d5249a110d8eb7dc23d7b3e2b" and "5ff3c71af8928544d05aafa28b28fad1c302050c" have entirely different histories.

12 changed files with 88 additions and 73 deletions

View File

@ -55,18 +55,9 @@
the filesystem should actually be checked based on the time since
last check, number of mounts, unclean unmount, etc.</para>
<para><filename>systemd-fsck-root.service</filename> will activate
<filename>reboot.target</filename> if <filename>/sbin/fsck</filename>
returns the "System should reboot" condition, or
<filename>emergency.target</filename> if <filename>/sbin/fsck</filename>
returns the "Filesystem errors left uncorrected" condition.</para>
<para><filename>systemd-fsck@.service</filename> will fail if
<filename>/sbin/fsck</filename> returns with either "System should reboot"
or "Filesystem errors left uncorrected" conditions. For filesystems
listed in <filename>/etc/fstab</filename> without <literal>nofail</literal>
or <literal>noauto</literal> options, <literal>local-fs.target</literal>
will then activate <filename>emergency.target</filename>.</para>
<para>If a file system check fails for a service without
<option>nofail</option>, emergency mode is activated, by isolating
to <filename>emergency.target</filename>.</para>
</refsect1>
<refsect1>

View File

@ -3,8 +3,7 @@
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
<refentry id="systemd.netdev" conditional='ENABLE_NETWORKD'
xmlns:xi="http://www.w3.org/2001/XInclude">
<refentry id="systemd.netdev" conditional='ENABLE_NETWORKD'>
<refentryinfo>
<title>systemd.network</title>
@ -198,16 +197,78 @@
<refsect1>
<title>[Match] Section Options</title>
<para>A virtual network device is only created if the [Match] section matches the current
environment, or if the section is empty. The following keys are accepted:</para>
<para>A virtual network device is only created if the
[Match] section matches the current
environment, or if the section is empty. The following keys are
accepted:</para>
<variablelist class='network-directives'>
<xi:include href="systemd.link.xml" xpointer="host" />
<xi:include href="systemd.link.xml" xpointer="virtualization" />
<xi:include href="systemd.link.xml" xpointer="kernel-command-line" />
<xi:include href="systemd.link.xml" xpointer="kernel-version" />
<xi:include href="systemd.link.xml" xpointer="architecture" />
<xi:include href="systemd.link.xml" xpointer="firmware" />
<varlistentry>
<term><varname>Host=</varname></term>
<listitem>
<para>Matches against the hostname or machine ID of the host. See
<literal>ConditionHost=</literal> in
<citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
for details. When prefixed with an exclamation mark (<literal>!</literal>), the result is negated.
If an empty string is assigned, then previously assigned value is cleared.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>Virtualization=</varname></term>
<listitem>
<para>Checks whether the system is executed in a virtualized environment and optionally test
whether it is a specific implementation. See <literal>ConditionVirtualization=</literal> in
<citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
for details. When prefixed with an exclamation mark (<literal>!</literal>), the result is negated.
If an empty string is assigned, then previously assigned value is cleared.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>KernelCommandLine=</varname></term>
<listitem>
<para>Checks whether a specific kernel command line option is set. See
<literal>ConditionKernelCommandLine=</literal> in
<citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
for details. When prefixed with an exclamation mark (<literal>!</literal>), the result is negated.
If an empty string is assigned, then previously assigned value is cleared.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>KernelVersion=</varname></term>
<listitem>
<para>Checks whether the kernel version (as reported by <command>uname -r</command>) matches a
certain expression. See <literal>ConditionKernelVersion=</literal> in
<citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
for details. When prefixed with an exclamation mark (<literal>!</literal>), the result is negated.
If an empty string is assigned, then previously assigned value is cleared.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>Architecture=</varname></term>
<listitem>
<para>Checks whether the system is running on a specific architecture. See
<literal>ConditionArchitecture=</literal> in
<citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
for details. When prefixed with an exclamation mark (<literal>!</literal>), the result is negated.
If an empty string is assigned, then previously assigned value is cleared.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>Firmware=</varname></term>
<listitem>
<para>Checks whether the system is running on a machine with the specified firmware. See
<literal>ConditionFirmware=</literal> in
<citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
for details. When prefixed with an exclamation mark (<literal>!</literal>), the result is negated.
If an empty string is assigned, then previously assigned value is cleared.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>

View File

@ -132,7 +132,6 @@
<xi:include href="systemd.link.xml" xpointer="kernel-command-line" />
<xi:include href="systemd.link.xml" xpointer="kernel-version" />
<xi:include href="systemd.link.xml" xpointer="architecture" />
<xi:include href="systemd.link.xml" xpointer="firmware" />
</variablelist>
</refsect1>

View File

@ -2273,7 +2273,7 @@ static int bus_unit_set_transient_property(
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Unit name '%s' is not a slice", s);
if (!UNIT_WRITE_FLAGS_NOOP(flags)) {
r = unit_set_slice(u, slice);
r = unit_set_slice(u, slice, UNIT_DEPENDENCY_FILE);
if (r < 0)
return r;

View File

@ -3793,7 +3793,7 @@ int config_parse_unit_slice(
return 0;
}
r = unit_set_slice(u, slice);
r = unit_set_slice(u, slice, UNIT_DEPENDENCY_FILE);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to assign slice %s to unit %s, ignoring: %m", slice->id, u->id);
return 0;

View File

@ -593,7 +593,6 @@ static void print_unit_dependency_mask(FILE *f, const char *kind, UnitDependency
{ UNIT_DEPENDENCY_MOUNTINFO_IMPLICIT, "mountinfo-implicit" },
{ UNIT_DEPENDENCY_MOUNTINFO_DEFAULT, "mountinfo-default" },
{ UNIT_DEPENDENCY_PROC_SWAP, "proc-swap" },
{ UNIT_DEPENDENCY_SLICE_PROPERTY, "slice-property" },
};
assert(f);

View File

@ -3285,7 +3285,7 @@ reset:
return r;
}
int unit_set_slice(Unit *u, Unit *slice) {
int unit_set_slice(Unit *u, Unit *slice, UnitDependencyMask mask) {
int r;
assert(u);
@ -3318,11 +3318,7 @@ int unit_set_slice(Unit *u, Unit *slice) {
if (UNIT_GET_SLICE(u) && u->cgroup_realized)
return -EBUSY;
/* Remove any slices assigned prior; we should only have one UNIT_IN_SLICE dependency */
if (UNIT_GET_SLICE(u))
unit_remove_dependencies(u, UNIT_DEPENDENCY_SLICE_PROPERTY);
r = unit_add_dependency(u, UNIT_IN_SLICE, slice, true, UNIT_DEPENDENCY_SLICE_PROPERTY);
r = unit_add_dependency(u, UNIT_IN_SLICE, slice, true, mask);
if (r < 0)
return r;
@ -3378,7 +3374,7 @@ int unit_set_default_slice(Unit *u) {
if (r < 0)
return r;
return unit_set_slice(u, slice);
return unit_set_slice(u, slice, UNIT_DEPENDENCY_FILE);
}
const char *unit_slice_name(Unit *u) {

View File

@ -89,10 +89,7 @@ typedef enum UnitDependencyMask {
/* A dependency created because of data read from /proc/swaps and no other configuration source */
UNIT_DEPENDENCY_PROC_SWAP = 1 << 7,
/* A dependency for units in slices assigned by directly setting Slice= */
UNIT_DEPENDENCY_SLICE_PROPERTY = 1 << 8,
_UNIT_DEPENDENCY_MASK_FULL = (1 << 9) - 1,
_UNIT_DEPENDENCY_MASK_FULL = (1 << 8) - 1,
} UnitDependencyMask;
/* The Unit's dependencies[] hashmaps use this structure as value. It has the same size as a void pointer, and thus can
@ -785,7 +782,7 @@ Unit *unit_follow_merge(Unit *u) _pure_;
int unit_load_fragment_and_dropin(Unit *u, bool fragment_required);
int unit_load(Unit *unit);
int unit_set_slice(Unit *u, Unit *slice);
int unit_set_slice(Unit *u, Unit *slice, UnitDependencyMask mask);
int unit_set_default_slice(Unit *u);
const char *unit_description(Unit *u) _pure_;

View File

@ -52,7 +52,7 @@ static void start_target(const char *target, const char *mode) {
return;
}
log_info("Running request %s/start/%s", target, mode);
log_info("Running request %s/start/replace", target);
/* Start these units only if we can replace base.target with it */
r = sd_bus_call_method(bus,
@ -412,7 +412,10 @@ static int run(int argc, char *argv[]) {
/* System should be rebooted. */
start_target(SPECIAL_REBOOT_TARGET, "replace-irreversibly");
return -EINVAL;
} else if (!(exit_status & (FSCK_SYSTEM_SHOULD_REBOOT | FSCK_ERRORS_LEFT_UNCORRECTED)))
} else if (exit_status & (FSCK_SYSTEM_SHOULD_REBOOT | FSCK_ERRORS_LEFT_UNCORRECTED))
/* Some other problem */
start_target(SPECIAL_EMERGENCY_TARGET, "replace");
else
log_warning("Ignoring error.");
}

View File

@ -113,7 +113,7 @@ static int cake_fill_message(Link *link, QDisc *qdisc, sd_netlink_message *req)
}
if (c->split_gso >= 0) {
r = sd_netlink_message_append_u32(req, TCA_CAKE_SPLIT_GSO, c->split_gso);
r = sd_netlink_message_append_u32(req, TCA_CAKE_SPLIT_GSO, c->wash);
if (r < 0)
return log_link_error_errno(link, r, "Could not append TCA_CAKE_SPLIT_GSO attribute: %m");
}

View File

@ -8,7 +8,6 @@
#include "manager-dump.h"
#include "rm-rf.h"
#include "service.h"
#include "slice.h"
#include "special.h"
#include "strv.h"
#include "tests.h"
@ -76,8 +75,7 @@ int main(int argc, char *argv[]) {
_cleanup_(sd_bus_error_free) sd_bus_error err = SD_BUS_ERROR_NULL;
_cleanup_(manager_freep) Manager *m = NULL;
Unit *a = NULL, *b = NULL, *c = NULL, *d = NULL, *e = NULL, *g = NULL,
*h = NULL, *i = NULL, *a_conj = NULL, *unit_with_multiple_dashes = NULL, *stub = NULL,
*tomato = NULL, *sauce = NULL, *fruit = NULL, *zupa = NULL;
*h = NULL, *i = NULL, *a_conj = NULL, *unit_with_multiple_dashes = NULL, *stub = NULL;
Job *j;
int r;
@ -262,32 +260,5 @@ int main(int argc, char *argv[]) {
verify_dependency_atoms();
/* Test adding multiple Slice= dependencies; only the last should remain */
assert_se(unit_new_for_name(m, sizeof(Service), "tomato.service", &tomato) >= 0);
assert_se(unit_new_for_name(m, sizeof(Slice), "sauce.slice", &sauce) >= 0);
assert_se(unit_new_for_name(m, sizeof(Slice), "fruit.slice", &fruit) >= 0);
assert_se(unit_new_for_name(m, sizeof(Slice), "zupa.slice", &zupa) >= 0);
unit_set_slice(tomato, sauce);
unit_set_slice(tomato, fruit);
unit_set_slice(tomato, zupa);
assert_se(UNIT_GET_SLICE(tomato) == zupa);
assert_se(!unit_has_dependency(tomato, UNIT_ATOM_IN_SLICE, sauce));
assert_se(!unit_has_dependency(tomato, UNIT_ATOM_IN_SLICE, fruit));
assert_se(unit_has_dependency(tomato, UNIT_ATOM_IN_SLICE, zupa));
assert_se(!unit_has_dependency(tomato, UNIT_ATOM_REFERENCES, sauce));
assert_se(!unit_has_dependency(tomato, UNIT_ATOM_REFERENCES, fruit));
assert_se(unit_has_dependency(tomato, UNIT_ATOM_REFERENCES, zupa));
assert_se(!unit_has_dependency(sauce, UNIT_ATOM_SLICE_OF, tomato));
assert_se(!unit_has_dependency(fruit, UNIT_ATOM_SLICE_OF, tomato));
assert_se(unit_has_dependency(zupa, UNIT_ATOM_SLICE_OF, tomato));
assert_se(!unit_has_dependency(sauce, UNIT_ATOM_REFERENCED_BY, tomato));
assert_se(!unit_has_dependency(fruit, UNIT_ATOM_REFERENCED_BY, tomato));
assert_se(unit_has_dependency(zupa, UNIT_ATOM_REFERENCED_BY, tomato));
return 0;
}

View File

@ -14,8 +14,6 @@ DefaultDependencies=no
Conflicts=shutdown.target
Before=local-fs.target shutdown.target
ConditionPathIsReadWrite=!/
OnFailure=emergency.target
OnFailureJobMode=replace-irreversibly
[Service]
Type=oneshot