[systemd-commits] 6 commits - Makefile.am Makefile-man.am man/bootctl.xml shell-completion/zsh src/core src/journal src/shared
Zbigniew JÄdrzejewski-Szmek
zbyszek at kemper.freedesktop.org
Wed Nov 13 20:24:59 PST 2013
Makefile-man.am | 9 ++
Makefile.am | 4 +
man/bootctl.xml | 125 +++++++++++++++++++++++++++++++++++++++++
shell-completion/zsh/_bootctl | 25 ++++++++
src/core/job.c | 3
src/core/manager.c | 2
src/core/unit.c | 2
src/journal/journald-console.c | 34 ++++++++++-
src/shared/util.c | 10 +++
9 files changed, 209 insertions(+), 5 deletions(-)
New commits:
commit 5b1869eaa22e365ab6595924fe96549b279b5ebc
Author: Olivier Brunel <jjk at jjacky.com>
Date: Fri Sep 20 22:18:30 2013 +0200
Fix possible lack of status messages on shutdown/reboot
Since 31a7eb86 the output on console can be disabled to avoid colliding with
gettys. However, it could also lead to a lack of messages during
shutdown/reboot.
diff --git a/src/core/job.c b/src/core/job.c
index fc446fb..0dd161c 100644
--- a/src/core/job.c
+++ b/src/core/job.c
@@ -1097,6 +1097,9 @@ void job_shutdown_magic(Job *j) {
if (!unit_has_name(j->unit, SPECIAL_SHUTDOWN_TARGET))
return;
+ /* In case messages on console has been disabled on boot */
+ j->unit->manager->no_console_output = false;
+
if (detect_container(NULL) > 0)
return;
commit 2f38577f3040eedebfe1ace05d5b5a779a588af1
Author: Olivier Brunel <jjk at jjacky.com>
Date: Fri Sep 20 22:18:29 2013 +0200
Only disable output on console during boot if needed
If there are no more jobs on console, no need/we shouldn't disable output.
diff --git a/src/core/manager.c b/src/core/manager.c
index 07ca4c9..c99a022 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -1789,7 +1789,7 @@ static int process_event(Manager *m, struct epoll_event *ev) {
}
case WATCH_IDLE_PIPE: {
- m->no_console_output = true;
+ m->no_console_output = m->n_on_console > 0;
manager_unwatch_idle_pipe(m);
close_idle_pipe(m);
diff --git a/src/core/unit.c b/src/core/unit.c
index 201329f..15e0a82 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -1492,7 +1492,7 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns, bool reload_su
if (m->n_on_console == 0)
/* unset no_console_output flag, since the console is free */
- m->no_console_output = 0;
+ m->no_console_output = false;
} else
m->n_on_console ++;
}
commit 8aa5429a4a59abbcf567938fa6ef60bb2c8ae2f1
Author: Olivier Brunel <jjk at jjacky.com>
Date: Fri Sep 20 22:18:28 2013 +0200
Resolve /dev/console to the active tty instead of just "tty0"
When resolving /dev/console one would often get "tty0" meaning the active VT.
Resolving to the actual tty (e.g. "tty1") will notably help on boot when
determining whether or not PID1 can output to the console.
diff --git a/src/shared/util.c b/src/shared/util.c
index 838885a..b77d010 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -3700,6 +3700,16 @@ char *resolve_dev_console(char **active) {
else
tty = *active;
+ if (streq(tty, "tty0")) {
+ char *tmp;
+
+ /* Get the active VC (e.g. tty1) */
+ if (read_one_line_file("/sys/class/tty/tty0/active", &tmp) >= 0) {
+ free(*active);
+ tty = *active = tmp;
+ }
+ }
+
return tty;
}
commit 51d0f1c9f6a378f3bf11179e5794dc2c13b49644
Author: Marko Myllynen <myllynen at redhat.com>
Date: Wed Nov 13 23:02:23 2013 -0500
zsh-completion: add bootctl
diff --git a/Makefile.am b/Makefile.am
index 789ca02..558aa1b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1730,6 +1730,10 @@ bootctl_LDADD = \
bin_PROGRAMS += \
bootctl
+
+dist_zshcompletion_DATA += \
+ shell-completion/zsh/_bootctl
+
endif
# ------------------------------------------------------------------------------
diff --git a/shell-completion/zsh/_bootctl b/shell-completion/zsh/_bootctl
new file mode 100644
index 0000000..7d2453c
--- /dev/null
+++ b/shell-completion/zsh/_bootctl
@@ -0,0 +1,25 @@
+#compdef bootctl
+
+(( $+functions[_bootctl_command] )) || _bootctl_command()
+{
+ local -a _bootctl_cmds
+ _bootctl_cmds=(
+ "status:Show current firmware and boot settings"
+ )
+ if (( CURRENT == 1 )); then
+ _describe -t commands 'bootctl command' _bootctl_cmds || compadd "$@"
+ else
+ local curcontext="$curcontext"
+ cmd="${${_bootctl_cmds[(r)$words[1]:*]%%:*}}"
+ if (( $+functions[_bootctl_$cmd] )); then
+ _bootctl_$cmd
+ else
+ _message "no more options"
+ fi
+ fi
+}
+
+_arguments \
+ {-h,--help}'[Prints a short help text and exits.]' \
+ '--version[Prints a short version string and exits.]' \
+ '*::bootctl command:_bootctl_command'
commit 1bc64d77352010f6951e7cccf77be99301e9664c
Author: Marko Myllynen <myllynen at redhat.com>
Date: Wed Nov 13 11:06:13 2013 +0200
man: add bootctl(8)
https://bugzilla.redhat.com/show_bug.cgi?id=1014303
diff --git a/Makefile-man.am b/Makefile-man.am
index 1a24e6b..f2b6164 100644
--- a/Makefile-man.am
+++ b/Makefile-man.am
@@ -651,6 +651,15 @@ MANPAGES_ALIAS += \
endif
+if ENABLE_EFI
+MANPAGES += \
+ man/bootctl.1
+MANPAGES_ALIAS += \
+ #
+
+
+endif
+
if ENABLE_HOSTNAMED
MANPAGES += \
man/hostnamectl.1 \
diff --git a/man/bootctl.xml b/man/bootctl.xml
new file mode 100644
index 0000000..28f1b92
--- /dev/null
+++ b/man/bootctl.xml
@@ -0,0 +1,125 @@
+<?xml version='1.0'?> <!--*-nxml-*-->
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<!--
+ This file is part of systemd.
+
+ systemd is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ systemd is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with systemd; If not, see <http://www.gnu.org/licenses/>.
+-->
+
+<refentry id="bootctl" conditional='ENABLE_EFI'>
+
+ <refentryinfo>
+ <title>bootctl</title>
+ <productname>systemd</productname>
+
+ <authorgroup>
+ <author>
+ <contrib>Developer</contrib>
+ <firstname>Kay</firstname>
+ <surname>Sievers</surname>
+ <email>kay at vrfy.org</email>
+ </author>
+ </authorgroup>
+ </refentryinfo>
+
+ <refmeta>
+ <refentrytitle>bootctl</refentrytitle>
+ <manvolnum>1</manvolnum>
+ </refmeta>
+
+ <refnamediv>
+ <refname>bootctl</refname>
+ <refpurpose>Control the firmware and boot manager settings</refpurpose>
+ </refnamediv>
+
+ <refsynopsisdiv>
+ <cmdsynopsis>
+ <command>bootctl</command>
+ <arg choice="opt" rep="repeat">OPTIONS</arg>
+ <arg choice="req">COMMAND</arg>
+ </cmdsynopsis>
+ </refsynopsisdiv>
+
+ <refsect1>
+ <title>Description</title>
+
+ <para><command>bootctl</command> may be used to
+ query or (in the future) change the firmware and boot
+ manager settings.</para>
+
+ <para>Firmware information is available only on EFI
+ systems.</para>
+
+ <para>Currently, only the <citerefentry><refentrytitle>gummiboot</refentrytitle><manvolnum>8</manvolnum></citerefentry> boot
+ manager implements the required boot loader interface
+ to provide complete boot manager information.</para>
+ </refsect1>
+
+ <refsect1>
+ <title>Options</title>
+
+ <para>The following options are understood:</para>
+
+ <variablelist>
+ <varlistentry>
+ <term><option>-h</option></term>
+ <term><option>--help</option></term>
+
+ <listitem><para>Prints a short help
+ text and exits.</para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>--version</option></term>
+
+ <listitem><para>Prints a short version
+ string and exits.</para></listitem>
+ </varlistentry>
+ </variablelist>
+
+ <para>The following commands are understood:</para>
+
+ <variablelist>
+ <varlistentry>
+ <term><command>status</command></term>
+
+ <listitem><para>Show firmware and boot
+ manager information about the system,
+ including secure boot mode status and
+ selected firmware entry (where
+ available).</para></listitem>
+ </varlistentry>
+ </variablelist>
+
+ </refsect1>
+
+ <refsect1>
+ <title>Exit status</title>
+
+ <para>On success, 0 is returned, a non-zero failure
+ code otherwise.</para>
+ </refsect1>
+
+ <refsect1>
+ <title>See Also</title>
+ <para>
+ <ulink url="http://www.freedesktop.org/wiki/Software/systemd/BootLoaderInterface">Boot loader interface</ulink>,
+ <ulink url="http://www.freedesktop.org/wiki/Specifications/BootLoaderSpec">Boot loader specification</ulink>,
+ <ulink url="http://www.freedesktop.org/wiki/Software/gummiboot/">gummiboot</ulink>
+ </para>
+ </refsect1>
+
+</refentry>
commit ad79565d6b37bcc93cf773a39b975e5b85d122da
Author: Umut Tezduyar Lindskog <umut.tezduyar at axis.com>
Date: Wed Nov 13 15:27:19 2013 +0100
journal: timestamp support on console messages
journald mimics the kernel here: timestamps will be printed if
/sys/module/printk/parameters/time contains "Y".
diff --git a/src/journal/journald-console.c b/src/journal/journald-console.c
index be55f94..1ee3afe 100644
--- a/src/journal/journald-console.c
+++ b/src/journal/journald-console.c
@@ -19,13 +19,30 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
+#include <time.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/socket.h>
+#include "fileio.h"
#include "journald-server.h"
#include "journald-console.h"
+static bool prefix_timestamp(void) {
+
+ static int cached_printk_time = -1;
+
+ if (_unlikely_(cached_printk_time < 0)) {
+ _cleanup_free_ char *p = NULL;
+
+ cached_printk_time =
+ read_one_line_file("/sys/module/printk/parameters/time", &p) >= 0
+ && parse_boolean(p) > 0;
+ }
+
+ return cached_printk_time;
+}
+
void server_forward_console(
Server *s,
int priority,
@@ -33,8 +50,10 @@ void server_forward_console(
const char *message,
struct ucred *ucred) {
- struct iovec iovec[4];
+ struct iovec iovec[5];
char header_pid[16];
+ struct timespec ts;
+ char tbuf[4 + DECIMAL_STR_MAX(ts.tv_sec) + DECIMAL_STR_MAX(ts.tv_nsec)-3 + 1];
int n = 0, fd;
char *ident_buf = NULL;
const char *tty;
@@ -45,7 +64,16 @@ void server_forward_console(
if (LOG_PRI(priority) > s->max_level_console)
return;
- /* First: identifier and PID */
+ /* First: timestamp */
+ if (prefix_timestamp()) {
+ assert_se(clock_gettime(CLOCK_MONOTONIC, &ts) == 0);
+ snprintf(tbuf, sizeof(tbuf), "[%5llu.%06llu] ",
+ (unsigned long long) ts.tv_sec,
+ (unsigned long long) ts.tv_nsec / 1000);
+ IOVEC_SET_STRING(iovec[n++], tbuf);
+ }
+
+ /* Second: identifier and PID */
if (ucred) {
if (!identifier) {
get_process_comm(ucred->pid, &ident_buf);
@@ -64,7 +92,7 @@ void server_forward_console(
IOVEC_SET_STRING(iovec[n++], ": ");
}
- /* Third: message */
+ /* Fourth: message */
IOVEC_SET_STRING(iovec[n++], message);
IOVEC_SET_STRING(iovec[n++], "\n");
More information about the systemd-commits
mailing list