diff mbox series

[pseudo,20/34] pseudo_util: Store PSEUDO_SEVERITY as severity names

Message ID 1794370862-30908-21-git-send-email-mark.hatle@kernel.crashing.org
State New
Headers show
Series Various fixes | expand

Commit Message

Mark Hatle Nov. 11, 2026, 4:20 a.m. UTC
From: Mark Hatle <mark.hatle@amd.com>

Store the flags as a comma-separated list of severity names.

pseudo_severity_flags_finalize() stored the severity flags in
PSEUDO_SEVERITY using pseudo_flags_finalize(), which writes debug type
letters.  The default "info,warn,error" became "foP", which
pseudo_severity_flags_in() doesn't understand, so every process started
under pseudo, including a server started by a client, ran with no
severity flags: pseudo_info() and pseudo_warning() messages were
silently dropped.

AI-Generated: Uses GitHub Copilot
Signed-off-by: Mark Hatle <mark.hatle@amd.com>
---
 pseudo_util.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/pseudo_util.c b/pseudo_util.c
index 351cd09..631c3e9 100644
--- a/pseudo_util.c
+++ b/pseudo_util.c
@@ -443,7 +443,18 @@  pseudo_evlog_flags_finalize(void) {
 
 void
 pseudo_severity_flags_finalize(void) {
-	pseudo_flags_finalize(pseudo_util_severity_flags, "PSEUDO_SEVERITY");
+	/* PSEUDO_SEVERITY holds severity names, not debug type letters */
+	char buf[128] = "";
+	size_t len = 0;
+
+	for (int i = SEVERITY_NONE + 1; i < SEVERITY_MAX; ++i) {
+		if (pseudo_util_severity_flags & (1UL << i)) {
+			snprintf(buf + len, sizeof(buf) - len, "%s%s",
+				len ? "," : "", pseudo_sev_name(i));
+			len = strlen(buf);
+		}
+	}
+	pseudo_set_value("PSEUDO_SEVERITY", buf);
 }
 
 static unsigned long