[systemd-commits] 6 commits - man/sd_journal_open.xml man/systemd-analyze.xml man/systemd.journal-fields.xml man/systemd.special.xml src/analyze src/journal
Zbigniew JÄdrzejewski-Szmek
zbyszek at kemper.freedesktop.org
Fri Jun 14 13:26:59 PDT 2013
man/sd_journal_open.xml | 5 +-
man/systemd-analyze.xml | 29 ++++++++++----
man/systemd.journal-fields.xml | 84 +++++++++++++++++++++++++++++++++--------
man/systemd.special.xml | 2
src/analyze/systemd-analyze.c | 18 +++++---
src/journal/journal-send.c | 26 +++++-------
src/journal/journald-server.c | 39 +++++++++++--------
7 files changed, 141 insertions(+), 62 deletions(-)
New commits:
commit fa3868c6d317b88715c55422b898f9070afe6575
Author: Zbigniew JÄdrzejewski-Szmek <zbyszek at in.waw.pl>
Date: Fri Jun 14 08:53:15 2013 -0400
man: update systemd-analyze invocation
diff --git a/man/systemd-analyze.xml b/man/systemd-analyze.xml
index ae45bfc..ae7a337 100644
--- a/man/systemd-analyze.xml
+++ b/man/systemd-analyze.xml
@@ -55,19 +55,32 @@
<refsynopsisdiv>
<cmdsynopsis>
- <command>systemd-analyze <arg choice="opt" rep="repeat">OPTIONS</arg> time</command>
+ <command>systemd-analyze</command>
+ <arg choice="opt" rep="repeat">OPTIONS</arg>
+ <arg>time</arg>
</cmdsynopsis>
<cmdsynopsis>
- <command>systemd-analyze <arg choice="opt" rep="repeat">OPTIONS</arg> blame </command>
+ <command>systemd-analyze</command>
+ <arg choice="opt" rep="repeat">OPTIONS</arg>
+ <arg choice="plain">blame</arg>
</cmdsynopsis>
<cmdsynopsis>
- <command>systemd-analyze <arg choice="opt" rep="repeat">OPTIONS</arg> critical-chain </command>
+ <command>systemd-analyze</command>
+ <arg choice="opt" rep="repeat">OPTIONS</arg>
+ <arg choice="plain">critical-chain</arg>
+ <arg choice="opt" rep="repeat"><replaceable>UNIT</replaceable></arg>
</cmdsynopsis>
<cmdsynopsis>
- <command>systemd-analyze <arg choice="opt" rep="repeat">OPTIONS</arg> plot <arg choice="opt">> file.svg</arg></command>
+ <command>systemd-analyze</command>
+ <arg choice="opt" rep="repeat">OPTIONS</arg>
+ <arg choice="plain">plot</arg>
+ <arg choice="opt">> file.svg</arg>
</cmdsynopsis>
<cmdsynopsis>
- <command>systemd-analyze <arg choice="opt" rep="repeat">OPTIONS</arg> dot <arg choice="opt">pattern...</arg> </command>
+ <command>systemd-analyze</command>
+ <arg choice="opt" rep="repeat">OPTIONS</arg>
+ <arg choice="plain">dot</arg>
+ <arg choice="opt" rep="repeat"><replaceable>PATTERN</replaceable></arg>
</cmdsynopsis>
</refsynopsisdiv>
@@ -97,8 +110,10 @@
be slow simply because it waits for the initialization
of another service to complete.</para>
- <para><command>systemd-analyze critical-chain</command>
- prints a tree of the time critical chain of units.
+ <para><command>systemd-analyze critical-chain [<replaceable>UNIT...</replaceable>]</command>
+ prints a tree of the time critical chain of units
+ (for each of the specified <replaceable>UNIT</replaceable>s
+ or for the default target otherwise).
The time after the unit is active or started is printed
after the "@" character. The time the unit takes to
start is printed after the "+" character.
commit 805bf39ce79f352f98eb3d144840c8ad6497d3e9
Author: Gabriel de Perthuis <g2p.code at gmail.com>
Date: Tue Jun 11 22:29:32 2013 +0200
systemd-analyze: Show critical chains for listed units
diff --git a/src/analyze/systemd-analyze.c b/src/analyze/systemd-analyze.c
index fe1abdc..ffdcd14 100644
--- a/src/analyze/systemd-analyze.c
+++ b/src/analyze/systemd-analyze.c
@@ -826,7 +826,7 @@ static int list_dependencies_one(DBusConnection *bus, const char *name, unsigned
return 0;
}
-static int list_dependencies(DBusConnection *bus) {
+static int list_dependencies(DBusConnection *bus, const char *name) {
_cleanup_strv_free_ char **units = NULL;
char ts[FORMAT_TIMESPAN_MAX];
struct unit_times *times;
@@ -841,7 +841,7 @@ static int list_dependencies(DBusConnection *bus) {
assert(bus);
- path = unit_dbus_path_from_name(SPECIAL_DEFAULT_TARGET);
+ path = unit_dbus_path_from_name(name);
if (path == NULL)
return -EINVAL;
@@ -890,10 +890,10 @@ static int list_dependencies(DBusConnection *bus) {
printf("%s\n", id);
}
- return list_dependencies_one(bus, SPECIAL_DEFAULT_TARGET, 0, &units, 0);
+ return list_dependencies_one(bus, name, 0, &units, 0);
}
-static int analyze_critical_chain(DBusConnection *bus) {
+static int analyze_critical_chain(DBusConnection *bus, char *names[]) {
struct unit_times *times;
int n, r;
unsigned int i;
@@ -917,7 +917,13 @@ static int analyze_critical_chain(DBusConnection *bus) {
puts("The time after the unit is active or started is printed after the \"@\" character.\n"
"The time the unit takes to start is printed after the \"+\" character.\n");
- list_dependencies(bus);
+ if (!strv_isempty(names)) {
+ char **name;
+ STRV_FOREACH(name, names)
+ list_dependencies(bus, *name);
+ } else {
+ list_dependencies(bus, SPECIAL_DEFAULT_TARGET);
+ }
hashmap_free(h);
free_unit_times(times, (unsigned) n);
@@ -1301,7 +1307,7 @@ int main(int argc, char *argv[]) {
else if (streq(argv[optind], "blame"))
r = analyze_blame(bus);
else if (streq(argv[optind], "critical-chain"))
- r = analyze_critical_chain(bus);
+ r = analyze_critical_chain(bus, argv+optind+1);
else if (streq(argv[optind], "plot"))
r = analyze_plot(bus);
else if (streq(argv[optind], "dot"))
commit 3ae83f9896bff49679c8a60e6ff9520557df8b16
Author: Jason St. John <jstjohn at purdue.edu>
Date: Wed Jun 12 19:45:14 2013 +0200
man: improve readability of "_TRANSPORT=" section in systemd.journal-fields(7)
The list and descriptions of valid transports was difficult to read, so
break the long sentence up into discrete man page list items to improve
readability.
diff --git a/man/systemd.journal-fields.xml b/man/systemd.journal-fields.xml
index a0f1bfd..beb2fd6 100644
--- a/man/systemd.journal-fields.xml
+++ b/man/systemd.journal-fields.xml
@@ -286,23 +286,75 @@
<listitem>
<para>How the entry was
received by the journal
- service. One of
- <literal>driver</literal>,
- <literal>syslog</literal>,
- <literal>journal</literal>,
- <literal>stdout</literal>,
- <literal>kernel</literal> for
- internally generated messages,
- for those received via the
- local syslog socket with the
- syslog protocol, for those
- received via the native
- journal protocol, for the
- those read from a services'
- standard output or error
- output, or for those read
- from the kernel, respectively.
+ service. Valid transports are:
</para>
+ <variablelist>
+ <varlistentry>
+ <term>
+ <option>driver</option>
+ </term>
+ <listitem>
+ <para>for
+ internally
+ generated
+ messages
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>
+ <option>syslog</option>
+ </term>
+ <listitem>
+ <para>for those
+ received via the
+ local syslog
+ socket with the
+ syslog protocol
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>
+ <option>journal</option>
+ </term>
+ <listitem>
+ <para>for those
+ received via the
+ native journal
+ protocol
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>
+ <option>stdout</option>
+ </term>
+ <listitem>
+ <para>for those
+ read from a
+ service's
+ standard output
+ or error output
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>
+ <option>kernel</option>
+ </term>
+ <listitem>
+ <para>for those
+ read from the
+ kernel
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
</listitem>
</varlistentry>
</variablelist>
commit 5e9dfd2ef99bad1000a6246a160c096c4dbd2158
Author: Zbigniew JÄdrzejewski-Szmek <zbyszek at in.waw.pl>
Date: Thu Jun 13 23:32:15 2013 -0400
man: add sd_j_open_files to return values section
diff --git a/man/sd_journal_open.xml b/man/sd_journal_open.xml
index 182840e..0f41782 100644
--- a/man/sd_journal_open.xml
+++ b/man/sd_journal_open.xml
@@ -175,8 +175,9 @@
<refsect1>
<title>Return Value</title>
- <para>The <function>sd_journal_open()</function> and
- <function>sd_journal_open_directory()</function> calls
+ <para>The <function>sd_journal_open()</function>,
+ <function>sd_journal_open_directory()</function>, and
+ <function>sd_journal_open_files()</function> calls
return 0 on success or a negative errno-style error
code. <function>sd_journal_close()</function> returns
nothing.</para>
diff --git a/man/systemd.special.xml b/man/systemd.special.xml
index 7164b1e..4588f58 100644
--- a/man/systemd.special.xml
+++ b/man/systemd.special.xml
@@ -314,7 +314,7 @@
dependencies of type
<varname>Before=</varname> to
<filename>sysroot-usr.mount</filename>
- and all mount points fround in
+ and all mount points found in
<filename>/etc/fstab</filename>
that have the
<option>auto</option> and
commit e40ec7aec5e64cd0cfa5fc556d6a9747229b5794
Author: Zbigniew JÄdrzejewski-Szmek <zbyszek at in.waw.pl>
Date: Thu Jun 13 23:32:14 2013 -0400
journald: do not calculate free space too early
Since the system journal wasn't open yet, available_space() returned 0.
Before:
systemd-journal[22170]: Allowing system journal files to grow to 4.0G.
systemd-journal[22170]: Journal size currently limited to 0B due to SystemKeepFree.
After:
systemd-journal[22178]: Allowing system journal files to grow to 4.0G.
systemd-journal[22178]: Journal size currently limited to 3.0G due to SystemKeepFree.
Also, when failing to write a message, show how much space was needed:
"Failed to write entry (26 items, 260123456 bytes) despite vacuuming, ignoring: ...".
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
index a2b5ac7..de96040 100644
--- a/src/journal/journald-server.c
+++ b/src/journal/journald-server.c
@@ -465,7 +465,12 @@ static void write_to_journal(Server *s, uid_t uid, struct iovec *iovec, unsigned
}
if (vacuumed || !shall_try_append_again(f, r)) {
- log_error("Failed to write entry, ignoring: %s", strerror(-r));
+ size_t size = 0;
+ unsigned i;
+ for (i = 0; i < n; i++)
+ size += iovec[i].iov_len;
+
+ log_error("Failed to write entry (%d items, %zu bytes), ignoring: %s", n, size, strerror(-r));
return;
}
@@ -478,8 +483,14 @@ static void write_to_journal(Server *s, uid_t uid, struct iovec *iovec, unsigned
log_debug("Retrying write.");
r = journal_file_append_entry(f, NULL, iovec, n, &s->seqnum, NULL, NULL);
- if (r < 0)
- log_error("Failed to write entry, ignoring: %s", strerror(-r));
+ if (r < 0) {
+ size_t size = 0;
+ unsigned i;
+ for (i = 0; i < n; i++)
+ size += iovec[i].iov_len;
+
+ log_error("Failed to write entry (%d items, %zu bytes) despite vacuuming, ignoring: %s", n, size, strerror(-r));
+ }
}
static void dispatch_message_real(
@@ -767,9 +778,6 @@ static int system_journal_open(Server *s) {
char *fn;
sd_id128_t machine;
char ids[33];
- uint64_t avail;
-
- avail = available_space(s);
r = sd_id128_get_machine(&machine);
if (r < 0)
@@ -790,27 +798,23 @@ static int system_journal_open(Server *s) {
if (s->storage == STORAGE_PERSISTENT)
(void) mkdir("/var/log/journal/", 0755);
- fn = strappend("/var/log/journal/", ids);
- if (!fn)
- return -ENOMEM;
-
+ fn = strappenda("/var/log/journal/", ids);
(void) mkdir(fn, 0755);
- free(fn);
-
- fn = strjoin("/var/log/journal/", ids, "/system.journal", NULL);
- if (!fn)
- return -ENOMEM;
+ fn = strappenda(fn, "/system.journal");
r = journal_file_open_reliably(fn, O_RDWR|O_CREAT, 0640, s->compress, s->seal, &s->system_metrics, s->mmap, NULL, &s->system_journal);
- free(fn);
if (r >= 0) {
char fb[FORMAT_BYTES_MAX];
+ uint64_t avail;
server_fix_perms(s, s->system_journal, 0);
+
server_driver_message(s, SD_ID128_NULL, "Allowing system journal files to grow to %s.",
format_bytes(fb, sizeof(fb), s->system_metrics.max_use));
+ avail = available_space(s);
+
if (s->system_metrics.max_use > avail)
server_driver_message(s, SD_ID128_NULL, "Journal size currently limited to %s due to SystemKeepFree.",
format_bytes(fb, sizeof(fb), avail));
@@ -864,11 +868,14 @@ static int system_journal_open(Server *s) {
if (s->runtime_journal) {
char fb[FORMAT_BYTES_MAX];
+ uint64_t avail;
server_fix_perms(s, s->runtime_journal, 0);
server_driver_message(s, SD_ID128_NULL, "Allowing runtime journal files to grow to %s.",
format_bytes(fb, sizeof(fb), s->runtime_metrics.max_use));
+ avail = available_space(s);
+
if (s->system_metrics.max_use > avail)
server_driver_message(s, SD_ID128_NULL, "Journal size currently limited to %s due to RuntimeKeepFree.",
format_bytes(fb, sizeof(fb), avail));
commit 6e5abe1564070a760196b97031eca9cf5e95e8a2
Author: Zbigniew JÄdrzejewski-Szmek <zbyszek at in.waw.pl>
Date: Thu Jun 13 23:32:14 2013 -0400
journal: use initialization instead of zeroing
diff --git a/src/journal/journal-send.c b/src/journal/journal-send.c
index 14c437d..da1f892 100644
--- a/src/journal/journal-send.c
+++ b/src/journal/journal-send.c
@@ -204,8 +204,14 @@ _public_ int sd_journal_sendv(const struct iovec *iov, int n) {
struct iovec *w;
uint64_t *l;
int i, j = 0;
- struct msghdr mh;
- struct sockaddr_un sa;
+ struct sockaddr_un sa = {
+ .sun_family = AF_UNIX,
+ .sun_path = "/run/systemd/journal/socket",
+ };
+ struct msghdr mh = {
+ .msg_name = &sa,
+ .msg_namelen = offsetof(struct sockaddr_un, sun_path) + strlen(sa.sun_path),
+ };
ssize_t k;
union {
struct cmsghdr cmsghdr;
@@ -292,13 +298,6 @@ _public_ int sd_journal_sendv(const struct iovec *iov, int n) {
if (_unlikely_(fd < 0))
return fd;
- zero(sa);
- sa.sun_family = AF_UNIX;
- strncpy(sa.sun_path, "/run/systemd/journal/socket", sizeof(sa.sun_path));
-
- zero(mh);
- mh.msg_name = &sa;
- mh.msg_namelen = offsetof(struct sockaddr_un, sun_path) + strlen(sa.sun_path);
mh.msg_iov = w;
mh.msg_iovlen = j;
@@ -402,7 +401,10 @@ _public_ int sd_journal_perror(const char *message) {
}
_public_ int sd_journal_stream_fd(const char *identifier, int priority, int level_prefix) {
- union sockaddr_union sa;
+ union sockaddr_union sa = {
+ .un.sun_family = AF_UNIX,
+ .un.sun_path = "/run/systemd/journal/stdout",
+ };
int fd;
char *header;
size_t l;
@@ -415,10 +417,6 @@ _public_ int sd_journal_stream_fd(const char *identifier, int priority, int leve
if (fd < 0)
return -errno;
- zero(sa);
- sa.un.sun_family = AF_UNIX;
- strncpy(sa.un.sun_path, "/run/systemd/journal/stdout", sizeof(sa.un.sun_path));
-
r = connect(fd, &sa.sa, offsetof(union sockaddr_union, un.sun_path) + strlen(sa.un.sun_path));
if (r < 0) {
close_nointr_nofail(fd);
More information about the systemd-commits
mailing list