[systemd-commits] 8 commits - TODO man/systemd-analyze.xml man/systemd.exec.xml src/analyze src/core src/journal src/shared
Lennart Poettering
lennart at kemper.freedesktop.org
Mon Apr 8 11:38:11 PDT 2013
TODO | 7 +++
man/systemd-analyze.xml | 56 +++++++++++++++++++++++++---
man/systemd.exec.xml | 7 ++-
src/analyze/systemd-analyze.c | 82 +++++++++++++++++++++++++++++++++++++-----
src/core/execute.c | 3 -
src/journal/coredump.c | 2 +
src/journal/journald-native.c | 6 ++-
src/shared/cgroup-util.c | 8 +++-
8 files changed, 149 insertions(+), 22 deletions(-)
New commits:
commit c4aa09b06f835c91cea9e021df4c3605cff2318d
Author: Lennart Poettering <lennart at poettering.net>
Date: Mon Apr 8 20:32:03 2013 +0200
journald: bring max coredump size in sync with max entry size
diff --git a/src/journal/coredump.c b/src/journal/coredump.c
index c56d283..2dfb04a 100644
--- a/src/journal/coredump.c
+++ b/src/journal/coredump.c
@@ -37,6 +37,8 @@
#include "special.h"
#include "cgroup-util.h"
+/* Make sure to not make this larger than the maximum journal entry
+ * size. See ENTRY_SIZE_MAX in journald-native.c. */
#define COREDUMP_MAX (768*1024*1024)
enum {
diff --git a/src/journal/journald-native.c b/src/journal/journald-native.c
index 0691147..9d1f39f 100644
--- a/src/journal/journald-native.c
+++ b/src/journal/journald-native.c
@@ -31,8 +31,10 @@
#include "journald-console.h"
#include "journald-syslog.h"
-#define ENTRY_SIZE_MAX (1024*1024*64)
-#define DATA_SIZE_MAX (1024*1024*64)
+/* Make sure not to make this smaller than the maximum coredump
+ * size. See COREDUMP_MAX in coredump.c */
+#define ENTRY_SIZE_MAX (1024*1024*768)
+#define DATA_SIZE_MAX (1024*1024*768)
static bool valid_user_field(const char *p, size_t l) {
const char *a;
commit 3df82d5a8cdc510f518fd5e234ccb3233b748719
Author: Lennart Poettering <lennart at poettering.net>
Date: Mon Apr 8 20:29:52 2013 +0200
update TODO
diff --git a/TODO b/TODO
index def7b20..421f0ea 100644
--- a/TODO
+++ b/TODO
@@ -23,6 +23,8 @@ Bugfixes:
Fedora 19:
+* fix match logic to add another level of disjunction/conjunction
+
* make anaconda write timeout=0 for encrypted devices
* external: maybe it is time to patch procps so that "ps" links to
@@ -45,6 +47,11 @@ Fedora 19:
http://lists.freedesktop.org/archives/systemd-devel/2013-February/009021.html
Features:
+
+* make the coredump collector tool move itself into the user's cgroup
+ so that the coredump is properly written to the user's own journal
+ file.
+
* move /usr/lib/modules/$(uname -r)/modules.devname parsing from udevd to
kmod static-nodes
call kmod as an early service, and drop CAP_MKNOD from udevd.service
commit 2d76d14ea3682c1c144001449654eb0c6bbda08d
Author: Lennart Poettering <lennart at poettering.net>
Date: Mon Apr 8 19:42:58 2013 +0200
cgroup: clean-ups
diff --git a/src/core/execute.c b/src/core/execute.c
index dddef14..5083af9 100644
--- a/src/core/execute.c
+++ b/src/core/execute.c
@@ -1547,8 +1547,7 @@ int exec_spawn(ExecCommand *command,
* outside of the cgroup) and in the parent (so that we can be
* sure that when we kill the cgroup the process will be
* killed too). */
- if (cgroup_bondings)
- cgroup_bonding_install_list(cgroup_bondings, pid, cgroup_suffix);
+ cgroup_bonding_install_list(cgroup_bondings, pid, cgroup_suffix);
exec_status_start(&command->exec_status, pid);
diff --git a/src/shared/cgroup-util.c b/src/shared/cgroup-util.c
index 3738ca8..c17e1d4 100644
--- a/src/shared/cgroup-util.c
+++ b/src/shared/cgroup-util.c
@@ -697,7 +697,13 @@ int cg_attach(const char *controller, const char *path, pid_t pid) {
return write_string_file(fs, c);
}
-int cg_set_group_access(const char *controller, const char *path, mode_t mode, uid_t uid, gid_t gid) {
+int cg_set_group_access(
+ const char *controller,
+ const char *path,
+ mode_t mode,
+ uid_t uid,
+ gid_t gid) {
+
_cleanup_free_ char *fs = NULL;
int r;
commit 816f25e86ab690da6e408bc8d5b03dae9cc1b219
Author: Lennart Poettering <lennart at poettering.net>
Date: Mon Apr 8 19:42:48 2013 +0200
analyze: various cleanups
diff --git a/man/systemd-analyze.xml b/man/systemd-analyze.xml
index c8d0b47..9f313d7 100644
--- a/man/systemd-analyze.xml
+++ b/man/systemd-analyze.xml
@@ -93,20 +93,21 @@
been started at what time, highlighting the time they
spent on initialization.</para>
- <para><command>systemd-analyze dot</command>
- Generate textual dependency graph description in dot
- format for further processing with the GraphViz
+ <para><command>systemd-analyze dot</command> Generate
+ textual dependency graph description in dot format for
+ further processing with the GraphViz
<citerefentry><refentrytitle>dot</refentrytitle><manvolnum>1</manvolnum></citerefentry>
tool. Use a command line like <command>systemd-analyze
- dot | dot -Tsvg > systemd.svg</command> to generate
- a graphical dependency tree. Unless
+ dot | dot -Tsvg > systemd.svg</command> to generate a
+ graphical dependency tree. Unless
<option>--order</option> or <option>--require</option>
is passed the generated graph will show both ordering
- and requirement dependencies.</para>
-
- <para>Optional patterns may be given at the end. The
- relationship is printed if any of these matches either
- lefthand or righthand node.</para>
+ and requirement dependencies. Optional pattern
+ globbing style specifications
+ (e.g. <filename>*.target</filename>) may be given at
+ the end. A unit dependency is included in the graph if
+ any of these patterns match either the origin or
+ destination node.</para>
<para>If no command is passed <command>systemd-analyze
time</command> is implied.</para>
@@ -192,6 +193,23 @@
</refsect1>
<refsect1>
+ <title>Examples</title>
+
+ <para>This plots all dependencies of any unit whose
+ name starts with "<literal>avahi-daemon.</literal>":</para>
+
+ <programlisting>$ systemd-analyze dot 'avahi-daemon.*' | dot -Tsvg > avahi.svg
+$ eog avahi.svg</programlisting>
+
+ <para>This plots the dependencies between all known target units:</para>
+
+ <programlisting>systemd-analyze dot --to-pattern='*.target' --from-patter='*.target' | dot -Tsvg > targets.svg
+$ eog targets.svg</programlisting>
+
+
+ </refsect1>
+
+ <refsect1>
<title>See Also</title>
<para>
<citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
diff --git a/src/analyze/systemd-analyze.c b/src/analyze/systemd-analyze.c
index ec57928..e648a44 100644
--- a/src/analyze/systemd-analyze.c
+++ b/src/analyze/systemd-analyze.c
@@ -626,40 +626,48 @@ static int graph_one_property(const char *name, const char *prop, DBusMessageIte
dbus_message_iter_next(&sub)) {
const char *s;
char **p;
- bool match_found = true;
+ bool match_found;
assert(dbus_message_iter_get_arg_type(&sub) == DBUS_TYPE_STRING);
dbus_message_iter_get_basic(&sub, &s);
- STRV_FOREACH(p, arg_dot_from_patterns) {
+ if (!strv_isempty(arg_dot_from_patterns)) {
match_found = false;
- if (fnmatch(*p, name, 0) == 0) {
- match_found = true;
- break;
- }
+
+ STRV_FOREACH(p, arg_dot_from_patterns)
+ if (fnmatch(*p, name, 0) == 0) {
+ match_found = true;
+ break;
+ }
+
+ if (!match_found)
+ continue;
}
- if (!match_found)
- continue;
- STRV_FOREACH(p, arg_dot_to_patterns) {
+ if (!strv_isempty(arg_dot_to_patterns)) {
match_found = false;
- if (fnmatch(*p, s, 0) == 0) {
- match_found = true;
- break;
- }
+
+ STRV_FOREACH(p, arg_dot_to_patterns)
+ if (fnmatch(*p, s, 0) == 0) {
+ match_found = true;
+ break;
+ }
+
+ if (!match_found)
+ continue;
}
- if (!match_found)
- continue;
- STRV_FOREACH(p, patterns) {
+ if (!strv_isempty(patterns)) {
match_found = false;
- if (fnmatch(*p, name, 0) == 0 || fnmatch(*p, s, 0) == 0) {
- match_found = true;
- break;
- }
+
+ STRV_FOREACH(p, patterns)
+ if (fnmatch(*p, name, 0) == 0 || fnmatch(*p, s, 0) == 0) {
+ match_found = true;
+ break;
+ }
+ if (!match_found)
+ continue;
}
- if (!match_found)
- continue;
printf("\t\"%s\"->\"%s\" %s;\n", name, s, c);
}
commit 903a0b07e003c1ad976dc30e98b69a70778007ad
Author: Lennart Poettering <lennart at poettering.net>
Date: Mon Apr 8 19:42:29 2013 +0200
analyze: fix OOM handling + fix memory leak
diff --git a/src/analyze/systemd-analyze.c b/src/analyze/systemd-analyze.c
index 55f7c42..ec57928 100644
--- a/src/analyze/systemd-analyze.c
+++ b/src/analyze/systemd-analyze.c
@@ -851,11 +851,15 @@ static int parse_argv(int argc, char *argv[])
break;
case ARG_DOT_FROM_PATTERN:
- arg_dot_from_patterns = strv_append(arg_dot_from_patterns, optarg);
+ if (strv_extend(&arg_dot_from_patterns, optarg) < 0)
+ return log_oom();
+
break;
case ARG_DOT_TO_PATTERN:
- arg_dot_to_patterns = strv_append(arg_dot_to_patterns, optarg);
+ if (strv_extend(&arg_dot_to_patterns, optarg) < 0)
+ return log_oom();
+
break;
case -1:
commit f5b7a3fb53bc37e4d2cd042094a4be0d6bb1348a
Author: Lennart Poettering <lennart at poettering.net>
Date: Mon Apr 8 19:42:02 2013 +0200
analyze: add missing --help text entries
diff --git a/src/analyze/systemd-analyze.c b/src/analyze/systemd-analyze.c
index 375eaed..55f7c42 100644
--- a/src/analyze/systemd-analyze.c
+++ b/src/analyze/systemd-analyze.c
@@ -784,7 +784,10 @@ static void analyze_help(void)
" --system Connect to system manager\n"
" --user Connect to user service manager\n"
" --order When generating a dependency graph, show only order\n"
- " --require When generating a dependency graph, show only requirement\n\n"
+ " --require When generating a dependency graph, show only requirement\n"
+ " --from-pattern=GLOB, --to-pattern=GLOB\n"
+ " When generating a dependency graph, filter only origins\n"
+ " or destinations, respectively\n\n"
"Commands:\n"
" time Print time spent in the kernel before reaching userspace\n"
" blame Print list of running units ordered by time to init\n"
commit fbc15b7663730fd8c8c5cfcd54878a2e764c46ea
Author: Lennart Poettering <lennart at poettering.net>
Date: Mon Apr 8 19:11:05 2013 +0200
man: be clearer that it's not OK to manipulate systemd's own cgroup hirearchy
diff --git a/man/systemd.exec.xml b/man/systemd.exec.xml
index 69ee4fc..c25d96e 100644
--- a/man/systemd.exec.xml
+++ b/man/systemd.exec.xml
@@ -825,8 +825,11 @@
in specific paths in specific kernel
controller hierarchies. It is not
recommended to manipulate the service
- control group path in the systemd
- named hierarchy. For details about
+ control group path in the private
+ systemd named hierarchy
+ (i.e. <literal>name=systemd</literal>),
+ and doing this might result in
+ undefined behaviour. For details about
control groups see <ulink
url="http://www.kernel.org/doc/Documentation/cgroups/cgroups.txt">cgroups.txt</ulink>.</para>
commit e55933db18d1037876e7a0962bcf6ef6c0bbbd68
Author: Åukasz Stelmach <stlman at poczta.fm>
Date: Sat Apr 6 15:40:56 2013 +0200
systemd-analyze: filter dot output
Make "systemd-analyze dot" output only lines with units matching
given glob(7) patterns. Add --from-pattern and --to-pattern options.
Without any patterns all relationships are printed as before.
A relationship must match the follwing expression:
(isempty(from) || from[0] || from[1] || .. || from[n]) &&
(isempty(to) || to[0] || to[1] || .. || to[n]) &&
(isempty(P) || P[0] || P[1] || ... || P[n])
where from[] and to[] are lists of patterns provided with subsequent
--from-pattern and --to-pattern respectively. P[] is a list of additional
patterns provided after the "dot" subcommand.
diff --git a/man/systemd-analyze.xml b/man/systemd-analyze.xml
index 533bc42..c8d0b47 100644
--- a/man/systemd-analyze.xml
+++ b/man/systemd-analyze.xml
@@ -58,7 +58,7 @@
<command>systemd-analyze <arg choice="opt" rep="repeat">OPTIONS</arg> plot <arg choice="opt">> file.svg</arg></command>
</cmdsynopsis>
<cmdsynopsis>
- <command>systemd-analyze <arg choice="opt" rep="repeat">OPTIONS</arg> dot </command>
+ <command>systemd-analyze <arg choice="opt" rep="repeat">OPTIONS</arg> dot <arg choice="opt">pattern...</arg> </command>
</cmdsynopsis>
</refsynopsisdiv>
@@ -104,6 +104,10 @@
is passed the generated graph will show both ordering
and requirement dependencies.</para>
+ <para>Optional patterns may be given at the end. The
+ relationship is printed if any of these matches either
+ lefthand or righthand node.</para>
+
<para>If no command is passed <command>systemd-analyze
time</command> is implied.</para>
@@ -156,6 +160,26 @@
dependencies of all these
types.</para></listitem>
</varlistentry>
+
+ <varlistentry>
+ <term><option>--from-pattern=</option></term>
+ <term><option>--to-pattern=</option></term>
+
+ <listitem><para>When used in
+ conjunction with the
+ <command>dot</command> command (see
+ above), selects which relationships
+ are shown in the dependency graph.
+ They both require
+ <citerefentry><refentrytitle>glob</refentrytitle><manvolnum>7</manvolnum></citerefentry>
+ patterns as arguments, which are
+ matched against lefthand and
+ righthand, respectively, nodes of a
+ relationship. Each of these can be
+ used more than once which means a
+ unit name must match one of given
+ values.</para></listitem>
+ </varlistentry>
</variablelist>
</refsect1>
diff --git a/src/analyze/systemd-analyze.c b/src/analyze/systemd-analyze.c
index 029ce9c..375eaed 100644
--- a/src/analyze/systemd-analyze.c
+++ b/src/analyze/systemd-analyze.c
@@ -25,6 +25,7 @@
#include <getopt.h>
#include <locale.h>
#include <sys/utsname.h>
+#include <fnmatch.h>
#include "install.h"
#include "log.h"
@@ -33,6 +34,7 @@
#include "util.h"
#include "strxcpyx.h"
#include "fileio.h"
+#include "strv.h"
#define SCALE_X (0.1 / 1000.0) /* pixels per us */
#define SCALE_Y 20.0
@@ -60,6 +62,8 @@ static enum dot {
DEP_ORDER,
DEP_REQUIRE
} arg_dot = DEP_ALL;
+static char** arg_dot_from_patterns = NULL;
+static char** arg_dot_to_patterns = NULL;
struct boot_times {
usec_t firmware_time;
@@ -578,7 +582,7 @@ static int analyze_time(DBusConnection *bus) {
return 0;
}
-static int graph_one_property(const char *name, const char *prop, DBusMessageIter *iter) {
+static int graph_one_property(const char *name, const char *prop, DBusMessageIter *iter, char* patterns[]) {
static const char * const colors[] = {
"Requires", "[color=\"black\"]",
@@ -621,9 +625,42 @@ static int graph_one_property(const char *name, const char *prop, DBusMessageIte
dbus_message_iter_get_arg_type(&sub) != DBUS_TYPE_INVALID;
dbus_message_iter_next(&sub)) {
const char *s;
+ char **p;
+ bool match_found = true;
assert(dbus_message_iter_get_arg_type(&sub) == DBUS_TYPE_STRING);
dbus_message_iter_get_basic(&sub, &s);
+
+ STRV_FOREACH(p, arg_dot_from_patterns) {
+ match_found = false;
+ if (fnmatch(*p, name, 0) == 0) {
+ match_found = true;
+ break;
+ }
+ }
+ if (!match_found)
+ continue;
+
+ STRV_FOREACH(p, arg_dot_to_patterns) {
+ match_found = false;
+ if (fnmatch(*p, s, 0) == 0) {
+ match_found = true;
+ break;
+ }
+ }
+ if (!match_found)
+ continue;
+
+ STRV_FOREACH(p, patterns) {
+ match_found = false;
+ if (fnmatch(*p, name, 0) == 0 || fnmatch(*p, s, 0) == 0) {
+ match_found = true;
+ break;
+ }
+ }
+ if (!match_found)
+ continue;
+
printf("\t\"%s\"->\"%s\" %s;\n", name, s, c);
}
}
@@ -631,7 +668,7 @@ static int graph_one_property(const char *name, const char *prop, DBusMessageIte
return 0;
}
-static int graph_one(DBusConnection *bus, const struct unit_info *u) {
+static int graph_one(DBusConnection *bus, const struct unit_info *u, char *patterns[]) {
_cleanup_dbus_message_unref_ DBusMessage *reply = NULL;
const char *interface = "org.freedesktop.systemd1.Unit";
int r;
@@ -675,7 +712,7 @@ static int graph_one(DBusConnection *bus, const struct unit_info *u) {
}
dbus_message_iter_recurse(&sub2, &sub3);
- r = graph_one_property(u->id, prop, &sub3);
+ r = graph_one_property(u->id, prop, &sub3, patterns);
if (r < 0)
return r;
}
@@ -683,7 +720,7 @@ static int graph_one(DBusConnection *bus, const struct unit_info *u) {
return 0;
}
-static int dot(DBusConnection *bus) {
+static int dot(DBusConnection *bus, char* patterns[]) {
_cleanup_dbus_message_unref_ DBusMessage *reply = NULL;
DBusMessageIter iter, sub;
int r;
@@ -718,7 +755,7 @@ static int dot(DBusConnection *bus) {
if (r < 0)
return -EIO;
- r = graph_one(bus, &u);
+ r = graph_one(bus, &u, patterns);
if (r < 0)
return r;
}
@@ -763,7 +800,9 @@ static int parse_argv(int argc, char *argv[])
ARG_ORDER,
ARG_REQUIRE,
ARG_USER,
- ARG_SYSTEM
+ ARG_SYSTEM,
+ ARG_DOT_FROM_PATTERN,
+ ARG_DOT_TO_PATTERN
};
static const struct option options[] = {
@@ -773,6 +812,8 @@ static int parse_argv(int argc, char *argv[])
{ "require", no_argument, NULL, ARG_REQUIRE },
{ "user", no_argument, NULL, ARG_USER },
{ "system", no_argument, NULL, ARG_SYSTEM },
+ { "from-pattern", required_argument, NULL, ARG_DOT_FROM_PATTERN},
+ { "to-pattern", required_argument, NULL, ARG_DOT_TO_PATTERN },
{ NULL, 0, NULL, 0 }
};
@@ -806,6 +847,14 @@ static int parse_argv(int argc, char *argv[])
arg_dot = DEP_REQUIRE;
break;
+ case ARG_DOT_FROM_PATTERN:
+ arg_dot_from_patterns = strv_append(arg_dot_from_patterns, optarg);
+ break;
+
+ case ARG_DOT_TO_PATTERN:
+ arg_dot_to_patterns = strv_append(arg_dot_to_patterns, optarg);
+ break;
+
case -1:
return 1;
@@ -844,10 +893,12 @@ int main(int argc, char *argv[]) {
else if (streq(argv[optind], "plot"))
r = analyze_plot(bus);
else if (streq(argv[optind], "dot"))
- r = dot(bus);
+ r = dot(bus, argv+optind+1);
else
log_error("Unknown operation '%s'.", argv[optind]);
+ strv_free(arg_dot_from_patterns);
+ strv_free(arg_dot_to_patterns);
dbus_connection_unref(bus);
return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
More information about the systemd-commits
mailing list