bsod: several cleanups

- add reference to the service unit in the man page,
- fix several indentation and typos,
- replace '(uint64_t) -1' with 'UINT64_MAX',
- drop unnecessary 'continue'.
This commit is contained in:
Yu Watanabe 2023-08-22 22:54:43 +09:00
parent cf5d2df986
commit c3c885a771
6 changed files with 28 additions and 26 deletions

View file

@ -902,7 +902,7 @@ manpages = [
''],
['systemd-boot-random-seed.service', '8', [], 'ENABLE_BOOTLOADER'],
['systemd-boot', '7', ['sd-boot'], 'ENABLE_BOOTLOADER'],
['systemd-bsod', '8', [], 'HAVE_QRENCODE'],
['systemd-bsod.service', '8', ['systemd-bsod'], 'HAVE_QRENCODE'],
['systemd-cat', '1', [], ''],
['systemd-cgls', '1', [], ''],
['systemd-cgtop', '1', [], ''],

View file

@ -3,7 +3,7 @@
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
<refentry id="systemd-bsod" conditional='HAVE_QRENCODE' xmlns:xi="http://www.w3.org/2001/XInclude">
<refentry id="systemd-bsod.service" conditional='HAVE_QRENCODE' xmlns:xi="http://www.w3.org/2001/XInclude">
<refentryinfo>
<title>systemd-bsod</title>
@ -11,16 +11,18 @@
</refentryinfo>
<refmeta>
<refentrytitle>systemd-bsod</refentrytitle>
<refentrytitle>systemd-bsod.service</refentrytitle>
<manvolnum>8</manvolnum>
</refmeta>
<refnamediv>
<refname>systemd-bsod.service</refname>
<refname>systemd-bsod</refname>
<refpurpose>Displays boot-time emergency log message full-screen.</refpurpose>
<refpurpose>Displays boot-time emergency log message in full screen.</refpurpose>
</refnamediv>
<refsynopsisdiv>
<para><filename>systemd-bsod.service</filename></para>
<cmdsynopsis>
<command>systemd-bsod</command>
<arg choice="opt" rep="repeat">OPTIONS</arg>
@ -30,27 +32,27 @@
<refsect1>
<title>Description</title>
<para><command>systemd-bsod</command> is used to display a blue screen which contains a message relating to
a boot failure, including a QR code which users can scan with their phones to get helpful information
about the cause of their boot failure.</para>
<para><filename>systemd-bsod.service</filename> is used to display a blue screen which contains a message
relating to a boot failure, including a QR code which can be scanned to get helpful information about the
failure.</para>
</refsect1>
<refsect1>
<title>Options</title>
<para>The following options are understood:</para>
<para>The following options are understood by <command>systemd-bsod</command>:</para>
<variablelist>
<xi:include href="standard-options.xml" xpointer="help" />
<xi:include href="standard-options.xml" xpointer="version" />
<varlistentry>
<varlistentry>
<term><option>-c</option></term>
<term><option>--continuous</option></term>
<listitem><para> Used to make systemd-bsod wait continuously for changes in the
journal's status if doesn't find any emergency messages on initial attempt.</para></listitem>
</varlistentry>
<listitem><para>When specified, <command>systemd-bsod</command> waits continuously for changes in the
journal if it doesn't find any emergency messages on the initial attempt.</para></listitem>
</varlistentry>
</variablelist>
</refsect1>

View file

@ -39,7 +39,7 @@ static int help(void) {
" -h --help Show this help\n"
" --version Show package version\n"
" -c --continuous Make systemd-bsod wait continuously\n"
"for changes in the journal\n"
" for changes in the journal\n"
"\nSee the %s for details.\n",
program_invocation_short_name,
ansi_highlight(),
@ -77,9 +77,9 @@ static int acquire_first_emergency_log_message(char **ret) {
r = sd_journal_seek_head(j);
if (r < 0)
return log_error_errno(r, "Failed to seek to start of jornal: %m");
return log_error_errno(r, "Failed to seek to start of journal: %m");
for(;;) {
for (;;) {
r = sd_journal_next(j);
if (r < 0)
return log_error_errno(r, "Failed to read next journal entry: %m");
@ -92,11 +92,9 @@ static int acquire_first_emergency_log_message(char **ret) {
return 0;
}
r = sd_journal_wait(j, (uint64_t) -1);
r = sd_journal_wait(j, UINT64_MAX);
if (r < 0)
return log_error_errno(r, "Failed to wait for changes: %m");
continue;
}
r = sd_journal_get_data(j, "MESSAGE", &d, &l);
@ -223,9 +221,9 @@ static int parse_argv(int argc, char * argv[]) {
};
static const struct option options[] = {
{ "help", no_argument, NULL, 'h' },
{ "version", no_argument, NULL, ARG_VERSION },
{ "continuous", no_argument, NULL, 'c' },
{ "help", no_argument, NULL, 'h' },
{ "version", no_argument, NULL, ARG_VERSION },
{ "continuous", no_argument, NULL, 'c' },
{}
};
@ -254,6 +252,7 @@ static int parse_argv(int argc, char * argv[]) {
default:
assert_not_reached();
}
if (optind < argc)
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
"%s takes no argument.",

View file

@ -74,6 +74,7 @@ executables += [
},
libexec_template + {
'name' : 'systemd-bsod',
'public' : true,
'conditions' : ['HAVE_QRENCODE'],
'sources' : files('bsod.c'),
'link_with' : libshared,

View file

@ -62,7 +62,7 @@ units = [
},
{
'file' : 'systemd-bsod.service.in',
'conditions' : ['HAVE_QRENCODE','ENABLE_INITRD'],
'conditions' : ['HAVE_QRENCODE', 'ENABLE_INITRD'],
'symlinks' : ['initrd.target.wants/'],
},
{

View file

@ -8,13 +8,13 @@
# (at your option) any later version.
[Unit]
Description=Displays emergency message full screen.
Documentation=man:systemd-bsod(8)
Description=Displays emergency message in full screen.
Documentation=man:systemd-bsod.service(8)
ConditionVirtualization=no
DefaultDependencies=no
Conflicts=shutdown.target
Before=shutdown.target
After=systemd-battery-check.service
Before=shutdown.target
Conflicts=shutdown.target
[Service]
RemainAfterExit=yes