From: Yu Watanabe Date: Tue, 22 Aug 2023 13:54:43 +0000 (+0900) Subject: bsod: several cleanups X-Git-Tag: v255-rc1~666^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F28926%2Fhead;p=thirdparty%2Fsystemd.git 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'. --- diff --git a/man/rules/meson.build b/man/rules/meson.build index ca1a2cc1eb6..eaaf4adb1bd 100644 --- a/man/rules/meson.build +++ b/man/rules/meson.build @@ -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', [], ''], diff --git a/man/systemd-bsod.xml b/man/systemd-bsod.service.xml similarity index 59% rename from man/systemd-bsod.xml rename to man/systemd-bsod.service.xml index 86efb29db08..8530468d1dc 100644 --- a/man/systemd-bsod.xml +++ b/man/systemd-bsod.service.xml @@ -3,7 +3,7 @@ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> - + systemd-bsod @@ -11,16 +11,18 @@ - systemd-bsod + systemd-bsod.service 8 + systemd-bsod.service systemd-bsod - Displays boot-time emergency log message full-screen. + Displays boot-time emergency log message in full screen. + systemd-bsod.service systemd-bsod OPTIONS @@ -30,27 +32,27 @@ Description - systemd-bsod 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. + systemd-bsod.service 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. Options - The following options are understood: + The following options are understood by systemd-bsod: - + - Used to make systemd-bsod wait continuously for changes in the - journal's status if doesn't find any emergency messages on initial attempt. - + When specified, systemd-bsod waits continuously for changes in the + journal if it doesn't find any emergency messages on the initial attempt. + diff --git a/src/journal/bsod.c b/src/journal/bsod.c index 76907d2e5cb..4e7090cda93 100644 --- a/src/journal/bsod.c +++ b/src/journal/bsod.c @@ -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.", diff --git a/src/journal/meson.build b/src/journal/meson.build index 32d73cca828..9b0dc2cf584 100644 --- a/src/journal/meson.build +++ b/src/journal/meson.build @@ -74,6 +74,7 @@ executables += [ }, libexec_template + { 'name' : 'systemd-bsod', + 'public' : true, 'conditions' : ['HAVE_QRENCODE'], 'sources' : files('bsod.c'), 'link_with' : libshared, diff --git a/units/meson.build b/units/meson.build index cb1be835996..2e649d6e5f0 100644 --- a/units/meson.build +++ b/units/meson.build @@ -62,7 +62,7 @@ units = [ }, { 'file' : 'systemd-bsod.service.in', - 'conditions' : ['HAVE_QRENCODE','ENABLE_INITRD'], + 'conditions' : ['HAVE_QRENCODE', 'ENABLE_INITRD'], 'symlinks' : ['initrd.target.wants/'], }, { diff --git a/units/systemd-bsod.service.in b/units/systemd-bsod.service.in index 306d4a66239..2d2f988fbfc 100644 --- a/units/systemd-bsod.service.in +++ b/units/systemd-bsod.service.in @@ -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