Add "dlog|journal" output redirection option
authorMichal Bloch <m.bloch@samsung.com>
Wed, 7 Apr 2021 12:54:42 +0000 (14:54 +0200)
committerŁukasz Stelmach <l.stelmach@samsung.com>
Mon, 12 Feb 2024 15:37:49 +0000 (16:37 +0100)
Journal seems to default to /dev/null even when not explicitly
specified, so there is no separate "dlog|journal|null".

Change-Id: I5682de7dce014f76f403406ef73c7bd5a9661d5e

src/core/execute.c
src/core/execute.h

index 14a7d13..7eb9506 100644 (file)
@@ -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);
index 11a4054..ffdef52 100644 (file)
@@ -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;