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>
Fri, 22 Mar 2024 14:07:27 +0000 (15:07 +0100)
Journal seems to default to /dev/null even when not explicitly
specified, so there is no separate "dlog|journal|null".

Change-Id: I5682de7dce014f76f403406ef73c7bd5a9661d5e
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
src/core/exec-invoke.c
src/core/execute.c
src/core/execute.h

index 7ed8261..68af91a 100644 (file)
@@ -630,6 +630,16 @@ 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);
 
+#if HAVE_LIBDLOG_REDIRECT
+        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 */
+#endif
+
         case EXEC_OUTPUT_KMSG:
         case EXEC_OUTPUT_KMSG_AND_CONSOLE:
         case EXEC_OUTPUT_JOURNAL:
index 33b3aa0..e1d1fe7 100644 (file)
@@ -2680,6 +2680,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",
 #endif
 };
 
index b9b41df..e0f9d06 100644 (file)
@@ -71,6 +71,7 @@ typedef enum ExecOutput {
         EXEC_OUTPUT_DLOG,
         EXEC_OUTPUT_DLOG_OR_NULL,
         EXEC_OUTPUT_DLOG_OR_KMSG,
+        EXEC_OUTPUT_DLOG_OR_JOURNAL,
 #endif
         _EXEC_OUTPUT_MAX,
         _EXEC_OUTPUT_INVALID = -EINVAL,