summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-08-11 22:48:58 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-08-12 00:38:03 -0400
commit10752e829b5751d332c0cfb95d69754bc4875ee9 (patch)
tree57f8a40bca6da93c55a60df52ed0947bd53c38c1
parent1aaa68f535a4cb5908917031610bb7473baa30c7 (diff)
sd-journal: allow SYSTEM and CURRENT_USER flags with sd_j_open_directory[_fd]
There is no reason not to. This makes journalctl -D ... --system work, useful for example when viewing files from a deactivated container.
-rw-r--r--man/sd_journal_open.xml11
-rw-r--r--src/journal/sd-journal.c6
2 files changed, 11 insertions, 6 deletions
diff --git a/man/sd_journal_open.xml b/man/sd_journal_open.xml
index 153af2387f..74e67023b5 100644
--- a/man/sd_journal_open.xml
+++ b/man/sd_journal_open.xml
@@ -129,10 +129,13 @@
<para><function>sd_journal_open_directory()</function> is similar to <function>sd_journal_open()</function> but
takes an absolute directory path as argument. All journal files in this directory will be opened and interleaved
- automatically. This call also takes a flags argument. The only flags parameter accepted by this call is
- <constant>SD_JOURNAL_OS_ROOT</constant>. If specified, the journal files are searched below the usual
- <filename>/var/log/journal</filename> and <filename>/run/log/journal</filename> relative to the specified path,
- instead of directly beneath it.</para>
+ automatically. This call also takes a flags argument. The flags parameters accepted by this call are
+ <constant>SD_JOURNAL_OS_ROOT</constant>, <constant>SD_JOURNAL_SYSTEM</constant>, and
+ <constant>SD_JOURNAL_CURRENT_USER</constant>. If <constant>SD_JOURNAL_OS_ROOT</constant> is specified, journal
+ files are searched for below the usual <filename>/var/log/journal</filename> and
+ <filename>/run/log/journal</filename> relative to the specified path, instead of directly beneath it.
+ The other two flags limit which files are opened, the same as for <function>sd_journal_open()</function>.
+ </para>
<para><function>sd_journal_open_directory_fd()</function> is similar to
<function>sd_journal_open_directory()</function>, but takes a file descriptor referencing a directory in the file
diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c
index a9e90c159a..082d2dd178 100644
--- a/src/journal/sd-journal.c
+++ b/src/journal/sd-journal.c
@@ -1815,7 +1815,8 @@ fail:
}
#define OPEN_DIRECTORY_ALLOWED_FLAGS \
- SD_JOURNAL_OS_ROOT
+ (SD_JOURNAL_OS_ROOT | \
+ SD_JOURNAL_SYSTEM | SD_JOURNAL_CURRENT_USER )
_public_ int sd_journal_open_directory(sd_journal **ret, const char *path, int flags) {
sd_journal *j;
@@ -1873,7 +1874,8 @@ fail:
}
#define OPEN_DIRECTORY_FD_ALLOWED_FLAGS \
- SD_JOURNAL_OS_ROOT
+ (SD_JOURNAL_OS_ROOT | \
+ SD_JOURNAL_SYSTEM | SD_JOURNAL_CURRENT_USER )
_public_ int sd_journal_open_directory_fd(sd_journal **ret, int fd, int flags) {
sd_journal *j;