diff options
author | Michal Bloch <m.bloch@samsung.com> | 2021-04-07 14:54:42 +0200 |
---|---|---|
committer | Michal Bloch <m.bloch@samsung.com> | 2021-04-07 19:53:09 +0200 |
commit | b380b23989013c4c230f746447446455165cb5c7 (patch) | |
tree | 99efd323c6f64b1359be6dbeade9d4d08a2c21bd | |
parent | 2f75e3c6bc10d67b9c69533d608029d6717b68d1 (diff) | |
download | systemd-b380b23989013c4c230f746447446455165cb5c7.tar.gz systemd-b380b23989013c4c230f746447446455165cb5c7.tar.bz2 systemd-b380b23989013c4c230f746447446455165cb5c7.zip |
Add "dlog|journal" output redirection option
Journal seems to default to /dev/null even when not explicitly
specified, so there is no separate "dlog|journal|null".
Change-Id: I5682de7dce014f76f403406ef73c7bd5a9661d5e
-rw-r--r-- | src/core/execute.c | 9 | ||||
-rw-r--r-- | src/core/execute.h | 1 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/core/execute.c b/src/core/execute.c index 14a7d1399b..7eb9506e8c 100644 --- a/src/core/execute.c +++ b/src/core/execute.c @@ -684,6 +684,14 @@ static int setup_output( /* We don't reset the terminal if this is just about output */ return open_terminal_as(exec_context_tty_path(context), O_WRONLY, fileno); + case EXEC_OUTPUT_DLOG_OR_JOURNAL: + r = wire_up_dlog(fileno, ident); + if (r >= 0) + return fileno; + + o = EXEC_OUTPUT_JOURNAL; // used inside `connect_logger_as`, but let's not involve dlog there + /* fallthrough */ + case EXEC_OUTPUT_SYSLOG: case EXEC_OUTPUT_SYSLOG_AND_CONSOLE: case EXEC_OUTPUT_KMSG: @@ -5680,6 +5688,7 @@ static const char* const exec_output_table[_EXEC_OUTPUT_MAX] = { [EXEC_OUTPUT_DLOG] = "dlog", [EXEC_OUTPUT_DLOG_OR_NULL] = "dlog|null", [EXEC_OUTPUT_DLOG_OR_KMSG] = "dlog|kmsg", + [EXEC_OUTPUT_DLOG_OR_JOURNAL] = "dlog|journal", }; DEFINE_STRING_TABLE_LOOKUP(exec_output, ExecOutput); diff --git a/src/core/execute.h b/src/core/execute.h index 11a4054712..ffdef52a43 100644 --- a/src/core/execute.h +++ b/src/core/execute.h @@ -63,6 +63,7 @@ typedef enum ExecOutput { EXEC_OUTPUT_DLOG, EXEC_OUTPUT_DLOG_OR_NULL, EXEC_OUTPUT_DLOG_OR_KMSG, + EXEC_OUTPUT_DLOG_OR_JOURNAL, _EXEC_OUTPUT_MAX, _EXEC_OUTPUT_INVALID = -1 } ExecOutput; |