1
0
mirror of https://github.com/systemd/systemd synced 2026-04-23 15:34:50 +02:00

Compare commits

..

No commits in common. "60f53dd5cccce4d775fcce9456c95ddd03eb3dfc" and "00b29ca14328b2a4faaaf0278fbcf5928df63cb3" have entirely different histories.

12 changed files with 87 additions and 99 deletions

19
NEWS
View File

@ -23,6 +23,14 @@ CHANGES WITH 251 in spe:
and backward compatibility broken instead on the assumption that
nobody can be affected given the current state of this interface.
* Service monitor environment variables will only be passed to
OnFailure=/OnSuccess= handlers if exactly one unit lists the handler
unit as OnFailure=/OnSuccess=. In addition, $MONITOR_METADATA is no
longer used, and instead separate variables are set:
$MONITOR_SERVICE_RESULT, $MONITOR_EXIT_CODE, $MONITOR_EXIT_STATUS,
$MONITOR_INVOCATION_ID and $MONITOR_UNIT. For cases when a single
handler needs to watch multiple units, use a templated handler.
* All kernels supported by systemd mix RDRAND (or similar) into the
entropy pool at early boot. This means that on those systems, even if
/dev/urandom is not yet initialized, it still returns bytes that that
@ -39,7 +47,7 @@ CHANGES WITH 251 in spe:
* sd-boot will now measure the kernel command line into TPM PCR 12
rather than PCR 8. This improves usefulness of the measurements on
systems where sd-boot is chainloaded from Grub. Grub measures all
sytems where sd-boot is chainloaded from Grub. Grub measures all
commands its executes into PCR 8, which makes it very hard to use
reasonably, hence separate ourselves from that and use PCR 12
instead, which is what certain Ubuntu editions already do. To retain
@ -166,13 +174,6 @@ CHANGES WITH 251 in spe:
they were installed earlier or later than the appropriate version of
the library.
* A new set of service monitor environment variables will be passed to
OnFailure=/OnSuccess= handlers, but only if exactly one unit lists the
handler unit as OnFailure=/OnSuccess=. The variables are:
$MONITOR_SERVICE_RESULT, $MONITOR_EXIT_CODE, $MONITOR_EXIT_STATUS,
$MONITOR_INVOCATION_ID and $MONITOR_UNIT. For cases when a single
handler needs to watch multiple units, use a templated handler.
* A new ExtensionDirectories= setting allows system extensions to be
loaded from a directory. (It is similar to ExtensionImages=, but
takes a path to a directory, instead of an image.)
@ -192,7 +193,7 @@ CHANGES WITH 251 in spe:
* A new unit systemd-networkd-wait-online@<interface>.service can be
used to wait for a specific interface to be up.
* systemd-resolved is started earlier (in sysinit.target), so it
* systemd-resolved is started ealier (in sysinit.target), so it
available earlier and will also be started in the initrd if installed
there.

View File

@ -233,7 +233,8 @@ endif
update_man_rules = custom_target(
'update-man-rules',
output : 'update-man-rules',
command : [update_man_rules_py,
'@0@/man/*.xml'.format(project_source_root),
'@0@/rules/meson.build'.format(meson.current_source_dir())],
command : [sh, '-c',
'cd @0@ && '.format(project_build_root) +
'python3 @0@/tools/update-man-rules.py $(find @0@ -wholename "*/man/*.xml") >t && '.format(project_source_root) +
'mv t @0@/rules/meson.build'.format(meson.current_source_dir())],
depends : custom_entities_ent)

View File

@ -2629,10 +2629,10 @@ Token=prefixstable:2002:da8:1::</programlisting></para>
<term><varname>BootServerAddress=</varname></term>
<listitem>
<para>Takes an IPv4 address of the boot server used by e.g. PXE boot systems. When specified, this
address is sent in the <option>siaddr</option> field of the DHCP message header. See <ulink
url="https://www.rfc-editor.org/rfc/rfc2131.html">RFC 2131</ulink> for more details. Defaults to
unset.</para>
<para>Takes an IPv4 address of the boot server used by e.g. PXE boot systems. When specified,
the address is set to the <literal>siaddr</literal> field of the DHCP message header. See
<ulink url="https://www.rfc-editor.org/rfc/rfc2131.html">RFC 2131</ulink> for more details.
Defaults to unset.</para>
</listitem>
</varlistentry>
@ -2640,13 +2640,13 @@ Token=prefixstable:2002:da8:1::</programlisting></para>
<term><varname>BootServerName=</varname></term>
<listitem>
<para>Takes a name of the boot server used by e.g. PXE boot systems. When specified, this name is
sent in the DHCP option 66 ("TFTP server name"). See <ulink
url="https://www.rfc-editor.org/rfc/rfc2132.html">RFC 2132</ulink> for more details. Defaults to
unset.</para>
<para>Note that typically setting one of <varname>BootServerName=</varname> or
<varname>BootServerAddress=</varname> is sufficient, but both can be set too, if desired.</para>
<para>Takes a name of the boot server used by e.g. PXE boot systems. When specified, the
server name is set to the DHCP option 66. See
<ulink url="https://www.rfc-editor.org/rfc/rfc2132.html">RFC 2132</ulink> for more details.
Defaults to unset.</para>
<para>Note that typically one of
<varname>BootServerName=</varname>/<varname>BootServerAddress=</varname> is sufficient to be
set, but both can be set too, if desired.</para>
</listitem>
</varlistentry>
@ -2654,10 +2654,10 @@ Token=prefixstable:2002:da8:1::</programlisting></para>
<term><varname>BootFilename=</varname></term>
<listitem>
<para>Takes a path or URL to a file loaded by e.g. a PXE boot loader. When specified, this path is
sent in the DHCP option 67 ("Bootfile name"). See <ulink
url="https://www.rfc-editor.org/rfc/rfc2132.html">RFC 2132</ulink> for more details. Defaults to
unset.</para>
<para>Takes a path or URL to a file loaded by e.g. a PXE boot loader. The specified path is
set to the DHCP option 67. See
<ulink url="https://www.rfc-editor.org/rfc/rfc2132.html">RFC 2132</ulink> for more details.
Defaults to unset.</para>
</listitem>
</varlistentry>

View File

@ -1803,7 +1803,6 @@ make_directive_index_py = find_program('tools/make-directive-index.py')
make_man_index_py = find_program('tools/make-man-index.py')
meson_render_jinja2 = find_program('tools/meson-render-jinja2.py')
update_dbus_docs_py = find_program('tools/update-dbus-docs.py')
update_man_rules_py = find_program('tools/update-man-rules.py')
update_hwdb_sh = find_program('tools/update-hwdb.sh')
update_hwdb_autosuspend_sh = find_program('tools/update-hwdb-autosuspend.sh')
update_syscall_tables_sh = find_program('tools/update-syscall-tables.sh')

View File

@ -3,7 +3,7 @@
BEGIN{
print "static const char* const errno_names[] = { "
}
!/(EDEADLOCK|EWOULDBLOCK|ENOTSUP)/ {
!/EDEADLOCK/ && !/EWOULDBLOCK/ && !/ENOTSUP/ {
printf " [%s] = \"%s\",\n", $1, $1
}
END{

View File

@ -1086,25 +1086,17 @@ int open_mkdir_at(int dirfd, const char *path, int flags, mode_t mode) {
int openat_report_new(int dirfd, const char *pathname, int flags, mode_t mode, bool *ret_newly_created) {
unsigned attempts = 7;
int fd;
/* Just like openat(), but adds one thing: optionally returns whether we created the file anew or if
* it already existed before. This is only relevant if O_CREAT is set without O_EXCL, and thus will
* it already existed before. This is only relevant of O_CREAT is set without O_EXCL, and thus will
* shortcut to openat() otherwise */
if (!ret_newly_created)
if (!FLAGS_SET(flags, O_CREAT) || FLAGS_SET(flags, O_EXCL) || !ret_newly_created)
return RET_NERRNO(openat(dirfd, pathname, flags, mode));
if (!FLAGS_SET(flags, O_CREAT) || FLAGS_SET(flags, O_EXCL)) {
fd = openat(dirfd, pathname, flags, mode);
if (fd < 0)
return -errno;
*ret_newly_created = FLAGS_SET(flags, O_CREAT);
return fd;
}
for (;;) {
int fd;
/* First, attempt to open without O_CREAT/O_EXCL, i.e. open existing file */
fd = openat(dirfd, pathname, flags & ~(O_CREAT | O_EXCL), mode);
if (fd >= 0) {
@ -1124,7 +1116,7 @@ int openat_report_new(int dirfd, const char *pathname, int flags, mode_t mode, b
return -errno;
/* Hmm, so now we got EEXIST? So it apparently exists now? If so, let's try to open again
* without the two flags. But let's not spin forever, hence put a limit on things */
* without the two flags. But let's not spin forever, hnce put a limit on things */
if (--attempts == 0) /* Give up eventually, somebody is playing with us */
return -EEXIST;

View File

@ -53,7 +53,7 @@ typedef struct {
CHAR16 *id; /* The unique identifier for this entry (typically the filename of the file defining the entry) */
CHAR16 *title_show; /* The string to actually display (this is made unique before showing) */
CHAR16 *title; /* The raw (human readable) title string of the entry (not necessarily unique) */
CHAR16 *sort_key; /* The string to use as primary sort key, usually ID= from os-release, possibly suffixed */
CHAR16 *sort_key; /* The string to use as primary sory key, usually ID= from os-release, possibly suffixed */
CHAR16 *version; /* The raw (human readable) version string of the entry */
CHAR16 *machine_id;
EFI_HANDLE *device;

View File

@ -1163,12 +1163,12 @@ static int lock_image_fd(int image_fd, const char *ip) {
if (flock(image_fd, LOCK_EX|LOCK_NB) < 0) {
if (errno == EAGAIN)
if (errno == EWOULDBLOCK)
log_error_errno(errno, "Image file '%s' already locked, can't use.", ip);
else
log_error_errno(errno, "Failed to lock image file '%s': %m", ip);
return errno != EAGAIN ? -errno : -EADDRINUSE; /* Make error recognizable */
return errno != EWOULDBLOCK ? -errno : -EADDRINUSE; /* Make error recognizable */
}
log_info("Successfully locked image file '%s'.", ip);

View File

@ -217,26 +217,28 @@ static int get_child_nodes(
const char *prefix,
struct node *n,
unsigned flags,
OrderedSet **ret,
OrderedSet **_s,
sd_bus_error *error) {
_cleanup_ordered_set_free_free_ OrderedSet *s = NULL;
OrderedSet *s = NULL;
int r;
assert(bus);
assert(prefix);
assert(n);
assert(ret);
assert(_s);
s = ordered_set_new(&string_hash_ops);
if (!s)
return -ENOMEM;
r = add_subtree_to_set(bus, prefix, n, flags, s, error);
if (r < 0)
if (r < 0) {
ordered_set_free_free(s);
return r;
}
*ret = TAKE_PTR(s);
*_s = s;
return 0;
}
@ -1497,7 +1499,8 @@ static struct node* bus_node_allocate(sd_bus *bus, const char *path) {
if (streq(path, "/"))
parent = NULL;
else {
assert_se(e = strrchr(path, '/'));
e = strrchr(path, '/');
assert(e);
p = strndupa_safe(path, MAX(1, e - path));

View File

@ -1018,24 +1018,6 @@ TEST(openat_report_new) {
assert_se(fd >= 0);
fd = safe_close(fd);
assert_se(!b);
fd = openat_report_new(AT_FDCWD, j, O_RDWR, 0666, &b);
assert_se(fd >= 0);
fd = safe_close(fd);
assert_se(!b);
fd = openat_report_new(AT_FDCWD, j, O_RDWR|O_CREAT|O_EXCL, 0666, &b);
assert_se(fd == -EEXIST);
assert_se(unlink(j) >= 0);
fd = openat_report_new(AT_FDCWD, j, O_RDWR, 0666, &b);
assert_se(fd == -ENOENT);
fd = openat_report_new(AT_FDCWD, j, O_RDWR|O_CREAT|O_EXCL, 0666, &b);
assert_se(fd >= 0);
fd = safe_close(fd);
assert_se(b);
}
static int intro(void) {

View File

@ -4,39 +4,58 @@ from argparse import ArgumentParser
from pathlib import Path
from subprocess import run, PIPE
def extract_interfaces_xml(output_dir, executable):
proc = run(
list_interfaces_process = run(
args=[executable.absolute(), '--bus-introspect', 'list'],
stdout=PIPE,
check=True,
universal_newlines=True)
universal_newlines=True,
)
interface_names = (x.split()[1] for x in proc.stdout.splitlines())
interfaces_lines = list_interfaces_process.stdout.splitlines()
interface_names = [x.split()[1] for x in interfaces_lines]
for interface_name in interface_names:
proc = run(
interface_introspection_run = run(
args=[executable.absolute(), '--bus-introspect', interface_name],
stdout=PIPE,
check=True,
universal_newlines=True)
universal_newlines=True,
)
interface_file_name = output_dir / (interface_name + '.xml')
interface_file_name.write_text(proc.stdout)
with open(interface_file_name, mode='w') as f:
f.write(interface_introspection_run.stdout)
interface_file_name.chmod(0o644)
def iterate_executables(output_dir, executables):
output_dir.mkdir(mode=0o755, exist_ok=True)
for exe in executables:
extract_interfaces_xml(output_dir, exe)
def main():
parser = ArgumentParser()
parser.add_argument('output',
type=Path)
parser.add_argument('executables',
parser.add_argument(
'output',
type=Path,
)
parser.add_argument(
'executables',
type=Path,
nargs='+',
type=Path)
)
args = parser.parse_args()
args.output.mkdir(exist_ok=True)
for exe in args.executables:
extract_interfaces_xml(args.output, exe)
iterate_executables(args.output, args.executables)
if __name__ == '__main__':
main()

View File

@ -3,10 +3,9 @@
from __future__ import print_function
import collections
import glob
import sys
from pathlib import Path
import pprint
from os.path import basename
from xml_helper import xml_parse
def man(page, number):
@ -57,8 +56,7 @@ manpages = ['''
MESON_FOOTER = '''\
]
# Really, do not edit.
'''
# Really, do not edit.'''
def make_mesonfile(rules, dist_files):
# reformat rules as
@ -78,20 +76,13 @@ def make_mesonfile(rules, dist_files):
return '\n'.join((MESON_HEADER, pprint.pformat(lines)[1:-1], MESON_FOOTER))
if __name__ == '__main__':
source_glob = sys.argv[1]
target = Path(sys.argv[2])
pages = glob.glob(source_glob)
pages = sys.argv[1:]
pages = (p for p in pages
if Path(p).name not in {
if basename(p) not in {
'systemd.directives.xml',
'systemd.index.xml',
'directives-template.xml'})
rules = create_rules(pages)
dist_files = (Path(p).name for p in pages)
text = make_mesonfile(rules, dist_files)
tmp = target.with_suffix('.tmp')
tmp.write_text(text)
tmp.rename(target)
dist_files = (basename(p) for p in pages)
print(make_mesonfile(rules, dist_files))