chiark / gitweb /
logs-show.c: show all messages for a slice
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 30 Sep 2013 21:58:44 +0000 (23:58 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 30 Sep 2013 22:02:08 +0000 (00:02 +0200)
TODO
src/shared/logs-show.c

diff --git a/TODO b/TODO
index df4813c..c1f6e5a 100644 (file)
--- a/TODO
+++ b/TODO
@@ -60,9 +60,6 @@ Features:
 
 * libdsystemd-bus should expose utf8 validation calls
 
-* When using "systemd status" on a slice unit also show all messages
-  matching _SYSTEMD_SLICE= not just _SYSTEMD_UNIT=
-
 * After coming back from hibernation reset hibernation swap partition
 
 * If we try to find a unit via a dangling symlink generate a clean
index 2dd5025..7bb19b4 100644 (file)
@@ -1048,6 +1048,16 @@ int add_matches_for_unit(sd_journal *j, const char *unit) {
             (r = sd_journal_add_match(j, m4, 0))
         );
 
+        if (r == 0 && endswith(unit, ".slice")) {
+                char *m5 = strappend("_SYSTEMD_SLICE=", unit);
+
+                /* Show all messages belonging to a slice */
+                (void)(
+                        (r = sd_journal_add_disjunction(j)) ||
+                        (r = sd_journal_add_match(j, m5, 0))
+                        );
+        }
+
         return r;
 }
 
@@ -1087,6 +1097,18 @@ int add_matches_for_user_unit(sd_journal *j, const char *unit, uid_t uid) {
                 (r = sd_journal_add_match(j, muid, 0)) ||
                 (r = sd_journal_add_match(j, "_UID=0", 0))
         );
+
+        if (r == 0 && endswith(unit, ".slice")) {
+                char *m5 = strappend("_SYSTEMD_SLICE=", unit);
+
+                /* Show all messages belonging to a slice */
+                (void)(
+                        (r = sd_journal_add_disjunction(j)) ||
+                        (r = sd_journal_add_match(j, m5, 0)) ||
+                        (r = sd_journal_add_match(j, muid, 0))
+                        );
+        }
+
         return r;
 }