Compare commits

...

8 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek 2b2919a5ff
Merge pull request #17109 from fbuihuu/udev-opts-tweaks
Udev opts tweaks
2020-09-22 18:54:48 +02:00
Lennart Poettering 36f8cf0163
Merge pull request #17086 from keszybz/developer-mode-default
Update dbus docs, make developer mode default
2020-09-22 16:29:28 +02:00
Franck Bui 027f96c851 udevadm: rename option '--log-priority' into '--log-level'
Let's be consistent with systemctl(1).

'--log-priority' i still kept only for backward compatibility.
2020-09-22 09:05:57 +02:00
Franck Bui 64a3494c3d udev: rename kernel option 'log_priority' into 'log_level'
Let's be consistent with the rest of the project.

'log_priority' is still supported for backward compatibility.
2020-09-22 09:05:57 +02:00
Zbigniew Jędrzejewski-Szmek 198fda4f48 update-dbus-docs: skip test if python is too old 2020-09-20 13:15:44 +02:00
Zbigniew Jędrzejewski-Szmek 8aaf611b9a update-dbus-docs: skip test lxml is not available 2020-09-18 18:51:42 +02:00
Zbigniew Jędrzejewski-Szmek 4c8e5f442b meson: make "developer" mode the default
This means that the dbus doc consistency checks will be enabled by default,
including in the CI. I think that will work better than current state where
people do not enable them and them follow-up patches for the docs like the
parent commit must be had.
2020-09-17 09:02:29 +02:00
Zbigniew Jędrzejewski-Szmek 1f6b4144f5 man: update autogenerated dbus docs
Follow-up for 9df2cdd8ec.
2020-09-17 09:02:29 +02:00
11 changed files with 72 additions and 24 deletions

View File

@ -99,6 +99,13 @@ And after that, head over to your repo on GitHub and click "Compare & pull reque
Happy hacking! Happy hacking!
## Developer and release modes
In the default meson configuration (`-Dmode=developer`), certain checks are
enabled that are suitable when hacking on systemd (such as internal
documentation consistency checks). Those are not useful when compiling for code
for distribution and can be disabled by setting `-Dmode=release`.
## Fuzzers ## Fuzzers
systemd includes fuzzers in `src/fuzz/` that use libFuzzer and are automatically systemd includes fuzzers in `src/fuzz/` that use libFuzzer and are automatically

View File

@ -263,8 +263,8 @@
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><varname>udev.log_priority=</varname></term> <term><varname>udev.log_level=</varname></term>
<term><varname>rd.udev.log_priority=</varname></term> <term><varname>rd.udev.log_level=</varname></term>
<term><varname>udev.children_max=</varname></term> <term><varname>udev.children_max=</varname></term>
<term><varname>rd.udev.children_max=</varname></term> <term><varname>rd.udev.children_max=</varname></term>
<term><varname>udev.exec_delay=</varname></term> <term><varname>udev.exec_delay=</varname></term>

View File

@ -2655,6 +2655,8 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2eservice {
@org.freedesktop.DBus.Property.EmitsChangedSignal("const") @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly i SystemCallErrorNumber = ...; readonly i SystemCallErrorNumber = ...;
@org.freedesktop.DBus.Property.EmitsChangedSignal("const") @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly (bas) SystemCallLog = ...;
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly s Personality = '...'; readonly s Personality = '...';
@org.freedesktop.DBus.Property.EmitsChangedSignal("const") @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly b LockPersonality = ...; readonly b LockPersonality = ...;
@ -3156,6 +3158,8 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2eservice {
<!--property SystemCallErrorNumber is not documented!--> <!--property SystemCallErrorNumber is not documented!-->
<!--property SystemCallLog is not documented!-->
<!--property Personality is not documented!--> <!--property Personality is not documented!-->
<!--property LockPersonality is not documented!--> <!--property LockPersonality is not documented!-->
@ -3714,6 +3718,8 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2eservice {
<variablelist class="dbus-property" generated="True" extra-ref="SystemCallErrorNumber"/> <variablelist class="dbus-property" generated="True" extra-ref="SystemCallErrorNumber"/>
<variablelist class="dbus-property" generated="True" extra-ref="SystemCallLog"/>
<variablelist class="dbus-property" generated="True" extra-ref="Personality"/> <variablelist class="dbus-property" generated="True" extra-ref="Personality"/>
<variablelist class="dbus-property" generated="True" extra-ref="LockPersonality"/> <variablelist class="dbus-property" generated="True" extra-ref="LockPersonality"/>
@ -4356,6 +4362,8 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2esocket {
@org.freedesktop.DBus.Property.EmitsChangedSignal("const") @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly i SystemCallErrorNumber = ...; readonly i SystemCallErrorNumber = ...;
@org.freedesktop.DBus.Property.EmitsChangedSignal("const") @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly (bas) SystemCallLog = ...;
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly s Personality = '...'; readonly s Personality = '...';
@org.freedesktop.DBus.Property.EmitsChangedSignal("const") @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly b LockPersonality = ...; readonly b LockPersonality = ...;
@ -4883,6 +4891,8 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2esocket {
<!--property SystemCallErrorNumber is not documented!--> <!--property SystemCallErrorNumber is not documented!-->
<!--property SystemCallLog is not documented!-->
<!--property Personality is not documented!--> <!--property Personality is not documented!-->
<!--property LockPersonality is not documented!--> <!--property LockPersonality is not documented!-->
@ -5441,6 +5451,8 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2esocket {
<variablelist class="dbus-property" generated="True" extra-ref="SystemCallErrorNumber"/> <variablelist class="dbus-property" generated="True" extra-ref="SystemCallErrorNumber"/>
<variablelist class="dbus-property" generated="True" extra-ref="SystemCallLog"/>
<variablelist class="dbus-property" generated="True" extra-ref="Personality"/> <variablelist class="dbus-property" generated="True" extra-ref="Personality"/>
<variablelist class="dbus-property" generated="True" extra-ref="LockPersonality"/> <variablelist class="dbus-property" generated="True" extra-ref="LockPersonality"/>
@ -6009,6 +6021,8 @@ node /org/freedesktop/systemd1/unit/home_2emount {
@org.freedesktop.DBus.Property.EmitsChangedSignal("const") @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly i SystemCallErrorNumber = ...; readonly i SystemCallErrorNumber = ...;
@org.freedesktop.DBus.Property.EmitsChangedSignal("const") @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly (bas) SystemCallLog = ...;
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly s Personality = '...'; readonly s Personality = '...';
@org.freedesktop.DBus.Property.EmitsChangedSignal("const") @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly b LockPersonality = ...; readonly b LockPersonality = ...;
@ -6466,6 +6480,8 @@ node /org/freedesktop/systemd1/unit/home_2emount {
<!--property SystemCallErrorNumber is not documented!--> <!--property SystemCallErrorNumber is not documented!-->
<!--property SystemCallLog is not documented!-->
<!--property Personality is not documented!--> <!--property Personality is not documented!-->
<!--property LockPersonality is not documented!--> <!--property LockPersonality is not documented!-->
@ -6944,6 +6960,8 @@ node /org/freedesktop/systemd1/unit/home_2emount {
<variablelist class="dbus-property" generated="True" extra-ref="SystemCallErrorNumber"/> <variablelist class="dbus-property" generated="True" extra-ref="SystemCallErrorNumber"/>
<variablelist class="dbus-property" generated="True" extra-ref="SystemCallLog"/>
<variablelist class="dbus-property" generated="True" extra-ref="Personality"/> <variablelist class="dbus-property" generated="True" extra-ref="Personality"/>
<variablelist class="dbus-property" generated="True" extra-ref="LockPersonality"/> <variablelist class="dbus-property" generated="True" extra-ref="LockPersonality"/>
@ -7627,6 +7645,8 @@ node /org/freedesktop/systemd1/unit/dev_2dsda3_2eswap {
@org.freedesktop.DBus.Property.EmitsChangedSignal("const") @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly i SystemCallErrorNumber = ...; readonly i SystemCallErrorNumber = ...;
@org.freedesktop.DBus.Property.EmitsChangedSignal("const") @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly (bas) SystemCallLog = ...;
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly s Personality = '...'; readonly s Personality = '...';
@org.freedesktop.DBus.Property.EmitsChangedSignal("const") @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly b LockPersonality = ...; readonly b LockPersonality = ...;
@ -8070,6 +8090,8 @@ node /org/freedesktop/systemd1/unit/dev_2dsda3_2eswap {
<!--property SystemCallErrorNumber is not documented!--> <!--property SystemCallErrorNumber is not documented!-->
<!--property SystemCallLog is not documented!-->
<!--property Personality is not documented!--> <!--property Personality is not documented!-->
<!--property LockPersonality is not documented!--> <!--property LockPersonality is not documented!-->
@ -8534,6 +8556,8 @@ node /org/freedesktop/systemd1/unit/dev_2dsda3_2eswap {
<variablelist class="dbus-property" generated="True" extra-ref="SystemCallErrorNumber"/> <variablelist class="dbus-property" generated="True" extra-ref="SystemCallErrorNumber"/>
<variablelist class="dbus-property" generated="True" extra-ref="SystemCallLog"/>
<variablelist class="dbus-property" generated="True" extra-ref="Personality"/> <variablelist class="dbus-property" generated="True" extra-ref="Personality"/>
<variablelist class="dbus-property" generated="True" extra-ref="LockPersonality"/> <variablelist class="dbus-property" generated="True" extra-ref="LockPersonality"/>

View File

@ -143,8 +143,8 @@
<para>Parameters prefixed with "rd." will be read when <command>systemd-udevd</command> is used in an <para>Parameters prefixed with "rd." will be read when <command>systemd-udevd</command> is used in an
initrd, those without will be processed both in the initrd and on the host.</para> initrd, those without will be processed both in the initrd and on the host.</para>
<varlistentry> <varlistentry>
<term><varname>udev.log_priority=</varname></term> <term><varname>udev.log_level=</varname></term>
<term><varname>rd.udev.log_priority=</varname></term> <term><varname>rd.udev.log_level=</varname></term>
<listitem> <listitem>
<para>Set the log level.</para> <para>Set the log level.</para>
</listitem> </listitem>

View File

@ -398,7 +398,7 @@
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><option>-l</option></term> <term><option>-l</option></term>
<term><option>--log-priority=<replaceable>value</replaceable></option></term> <term><option>--log-level=<replaceable>value</replaceable></option></term>
<listitem> <listitem>
<para>Set the internal log level of <para>Set the internal log level of
<filename>systemd-udevd</filename>. Valid values are the <filename>systemd-udevd</filename>. Valid values are the

View File

@ -3513,6 +3513,7 @@ watchdog_opt = service_watchdog == '' ? 'disabled' : service_watchdog
status = [ status = [
'@0@ @1@'.format(meson.project_name(), meson.project_version()), '@0@ @1@'.format(meson.project_name(), meson.project_version()),
'build mode: @0@'.format(get_option('mode')),
'split /usr: @0@'.format(split_usr), 'split /usr: @0@'.format(split_usr),
'split bin-sbin: @0@'.format(split_bin), 'split bin-sbin: @0@'.format(split_bin),
'prefix directory: @0@'.format(prefixdir), 'prefix directory: @0@'.format(prefixdir),

View File

@ -4,7 +4,7 @@
option('version-tag', type : 'string', option('version-tag', type : 'string',
description : 'override the git version string') description : 'override the git version string')
option('mode', type : 'combo', choices : ['default', 'developer'], option('mode', type : 'combo', choices : ['developer', 'release'],
description : 'enable additional checks suitable for systemd development') description : 'enable additional checks suitable for systemd development')
option('split-usr', type : 'combo', choices : ['auto', 'true', 'false'], option('split-usr', type : 'combo', choices : ['auto', 'true', 'false'],

View File

@ -34,7 +34,7 @@ static int help(void) {
" -h --help Show this help\n" " -h --help Show this help\n"
" -V --version Show package version\n" " -V --version Show package version\n"
" -e --exit Instruct the daemon to cleanup and exit\n" " -e --exit Instruct the daemon to cleanup and exit\n"
" -l --log-priority=LEVEL Set the udev log level for the daemon\n" " -l --log-level=LEVEL Set the udev log level for the daemon\n"
" -s --stop-exec-queue Do not execute events, queue only\n" " -s --stop-exec-queue Do not execute events, queue only\n"
" -S --start-exec-queue Execute events, flush queue\n" " -S --start-exec-queue Execute events, flush queue\n"
" -R --reload Reload rules and databases\n" " -R --reload Reload rules and databases\n"
@ -58,7 +58,8 @@ int control_main(int argc, char *argv[], void *userdata) {
static const struct option options[] = { static const struct option options[] = {
{ "exit", no_argument, NULL, 'e' }, { "exit", no_argument, NULL, 'e' },
{ "log-priority", required_argument, NULL, 'l' }, { "log-level", required_argument, NULL, 'l' },
{ "log-priority", required_argument, NULL, 'l' }, /* for backward compatibility */
{ "stop-exec-queue", no_argument, NULL, 's' }, { "stop-exec-queue", no_argument, NULL, 's' },
{ "start-exec-queue", no_argument, NULL, 'S' }, { "start-exec-queue", no_argument, NULL, 'S' },
{ "reload", no_argument, NULL, 'R' }, { "reload", no_argument, NULL, 'R' },
@ -98,11 +99,11 @@ int control_main(int argc, char *argv[], void *userdata) {
case 'l': case 'l':
r = log_level_from_string(optarg); r = log_level_from_string(optarg);
if (r < 0) if (r < 0)
return log_error_errno(r, "Failed to parse log priority '%s': %m", optarg); return log_error_errno(r, "Failed to parse log level '%s': %m", optarg);
r = udev_ctrl_send_set_log_level(uctrl, r); r = udev_ctrl_send_set_log_level(uctrl, r);
if (r == -ENOANO) if (r == -ENOANO)
log_warning("Cannot specify --log-priority after --exit, ignoring."); log_warning("Cannot specify --log-level after --exit, ignoring.");
else if (r < 0) else if (r < 0)
return log_error_errno(r, "Failed to send request to set log level: %m"); return log_error_errno(r, "Failed to send request to set log level: %m");
break; break;

View File

@ -1050,7 +1050,7 @@ static int on_ctrl_msg(struct udev_ctrl *uctrl, enum udev_ctrl_msg_type type, co
switch (type) { switch (type) {
case UDEV_CTRL_SET_LOG_LEVEL: case UDEV_CTRL_SET_LOG_LEVEL:
log_debug("Received udev control message (SET_LOG_LEVEL), setting log_priority=%i", value->intval); log_debug("Received udev control message (SET_LOG_LEVEL), setting log_level=%i", value->intval);
log_set_max_level_realm(LOG_REALM_UDEV, value->intval); log_set_max_level_realm(LOG_REALM_UDEV, value->intval);
log_set_max_level_realm(LOG_REALM_SYSTEMD, value->intval); log_set_max_level_realm(LOG_REALM_SYSTEMD, value->intval);
manager_kill_workers(manager); manager_kill_workers(manager);
@ -1467,7 +1467,7 @@ static int listen_fds(int *ret_ctrl, int *ret_netlink) {
/* /*
* read the kernel command line, in case we need to get into debug mode * read the kernel command line, in case we need to get into debug mode
* udev.log_priority=<level> syslog priority * udev.log_level=<level> syslog priority
* udev.children_max=<number of workers> events are fully serialized if set to 1 * udev.children_max=<number of workers> events are fully serialized if set to 1
* udev.exec_delay=<number of seconds> delay execution of every executed program * udev.exec_delay=<number of seconds> delay execution of every executed program
* udev.event_timeout=<number of seconds> seconds to wait before terminating an event * udev.event_timeout=<number of seconds> seconds to wait before terminating an event
@ -1478,7 +1478,8 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat
assert(key); assert(key);
if (proc_cmdline_key_streq(key, "udev.log_priority")) { if (proc_cmdline_key_streq(key, "udev.log_level") ||
proc_cmdline_key_streq(key, "udev.log_priority")) { /* kept for backward compatibility */
if (proc_cmdline_value_missing(key, value)) if (proc_cmdline_value_missing(key, value))
return 0; return 0;

View File

@ -297,7 +297,7 @@ rd.systemd.verity=
rd.udev.children_max= rd.udev.children_max=
rd.udev.event_timeout= rd.udev.event_timeout=
rd.udev.exec_delay= rd.udev.exec_delay=
rd.udev.log_priority= rd.udev.log_level=
resume= resume=
resumeflags= resumeflags=
root= root=
@ -331,7 +331,7 @@ systemd.watchdog_device=
udev.children_max= udev.children_max=
udev.event_timeout= udev.event_timeout=
udev.exec_delay= udev.exec_delay=
udev.log_priority= udev.log_level=
vconsole.font= vconsole.font=
vconsole.font_map= vconsole.font_map=
vconsole.font_unimap= vconsole.font_unimap=

View File

@ -5,15 +5,18 @@ import argparse
import collections import collections
import sys import sys
import os import os
import shlex
import subprocess import subprocess
import io import io
from lxml import etree
PARSER = etree.XMLParser(no_network=True, try:
remove_comments=False, from lxml import etree
strip_cdata=False, except ModuleNotFoundError as e:
resolve_entities=False) etree = e
try:
from shlex import join as shlex_join
except ImportError as e:
shlex_join = e
class NoCommand(Exception): class NoCommand(Exception):
pass pass
@ -24,6 +27,12 @@ BORING_INTERFACES = [
'org.freedesktop.DBus.Properties', 'org.freedesktop.DBus.Properties',
] ]
def xml_parser():
return etree.XMLParser(no_network=True,
remove_comments=False,
strip_cdata=False,
resolve_entities=False)
def print_method(declarations, elem, *, prefix, file, is_signal=False): def print_method(declarations, elem, *, prefix, file, is_signal=False):
name = elem.get('name') name = elem.get('name')
klass = 'signal' if is_signal else 'method' klass = 'signal' if is_signal else 'method'
@ -178,7 +187,7 @@ def subst_output(document, programlisting, stats):
interface = programlisting.get('interface') interface = programlisting.get('interface')
argv = [f'{opts.build_dir}/{executable}', f'--bus-introspect={interface}'] argv = [f'{opts.build_dir}/{executable}', f'--bus-introspect={interface}']
print(f'COMMAND: {shlex.join(argv)}') print(f'COMMAND: {shlex_join(argv)}')
try: try:
out = subprocess.check_output(argv, text=True) out = subprocess.check_output(argv, text=True)
@ -186,7 +195,7 @@ def subst_output(document, programlisting, stats):
print(f'{executable} not found, ignoring', file=sys.stderr) print(f'{executable} not found, ignoring', file=sys.stderr)
return return
xml = etree.fromstring(out, parser=PARSER) xml = etree.fromstring(out, parser=xml_parser())
new_text, declarations, interfaces = xml_to_text(node, xml, only_interface=interface) new_text, declarations, interfaces = xml_to_text(node, xml, only_interface=interface)
programlisting.text = '\n' + new_text + ' ' programlisting.text = '\n' + new_text + ' '
@ -250,7 +259,7 @@ def subst_output(document, programlisting, stats):
def process(page): def process(page):
src = open(page).read() src = open(page).read()
xml = etree.fromstring(src, parser=PARSER) xml = etree.fromstring(src, parser=xml_parser())
# print('parsing {}'.format(name), file=sys.stderr) # print('parsing {}'.format(name), file=sys.stderr)
if xml.tag != 'refentry': if xml.tag != 'refentry':
@ -288,6 +297,11 @@ def parse_args():
if __name__ == '__main__': if __name__ == '__main__':
opts = parse_args() opts = parse_args()
for item in (etree, shlex_join):
if isinstance(item, Exception):
print(item, file=sys.stderr)
exit(77 if opts.test else 1)
if not os.path.exists(f'{opts.build_dir}/systemd'): if not os.path.exists(f'{opts.build_dir}/systemd'):
exit(f"{opts.build_dir}/systemd doesn't exist. Use --build-dir=.") exit(f"{opts.build_dir}/systemd doesn't exist. Use --build-dir=.")