代码拉取完成,页面将自动刷新
From cfd3dd6c91e98be04067e691700888add42cce6f Mon Sep 17 00:00:00 2001
From: Ruidong Tian <[email protected]>
Date: Mon, 16 Dec 2024 10:51:09 +0800
Subject: [PATCH 81/85] rasdaemon: signal: add json reporter
Signed-off-by: Ruidong Tian <[email protected]>
---
ras-report-json.c | 20 +++++++++++++++++++-
ras-report.h | 1 +
ras-signal-handler.c | 4 ++++
3 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/ras-report-json.c b/ras-report-json.c
index 1c3b571..8dbcd90 100644
--- a/ras-report-json.c
+++ b/ras-report-json.c
@@ -175,7 +175,7 @@ void report_mf_event_json(struct trace_seq *s, struct ras_mf_event *ev)
trace_seq_printf(s,
"\n{ \"%s\": \"mf_event\", \"timestamp\": \"%s\", " \
- "\"pfn\": %s, \"page_type\": \"%s\", " \
+ "\"pfn\": \"%s\", \"page_type\": \"%s\", " \
"\"action_result\": \"%s\" }",
JSON_REPORT_KEY,
(*ev->timestamp) ? ev->timestamp : NONE,
@@ -184,6 +184,24 @@ void report_mf_event_json(struct trace_seq *s, struct ras_mf_event *ev)
(ev->action_result) ? ev->action_result : NONE);
}
+void report_signal_event_json(struct trace_seq *s, struct ras_signal_event *ev)
+{
+ if (!s || !ev || !json_report)
+ return;
+
+ trace_seq_printf(s,
+ "\n{ \"%s\": \"signal_event\", \"timestamp\": \"%s\", " \
+ "\"signo\": %d, \"sigerr\": %d, " \
+ "\"sigcode\": %d, \"comm\": \"%s\", " \
+ "\"pid\": %d, \"group\": %d, " \
+ "\"result\": %d }",
+ JSON_REPORT_KEY,
+ (*ev->timestamp) ? ev->timestamp : NONE,
+ ev->sig, ev->error_no, ev->code,
+ (ev->comm) ? ev->comm : NONE,
+ ev->pid, ev->group, ev->result);
+}
+
void report_mce_event_json(struct trace_seq *s, struct mce_event *ev)
{
if (!s || !ev || !json_report)
diff --git a/ras-report.h b/ras-report.h
index de9bd7a..98c4542 100644
--- a/ras-report.h
+++ b/ras-report.h
@@ -68,6 +68,7 @@ void report_arm_event_json(struct trace_seq *s, struct ras_arm_event *ev);
void report_mf_event_json(struct trace_seq *s, struct ras_mf_event *ev);
void report_mce_event_json(struct trace_seq *s, struct mce_event *ev);
void report_kmsg_event_json(struct kmsg_tracer_info *kmsg_tracer, const char *msg);
+void report_signal_event_json(struct trace_seq *s, struct ras_signal_event *ev);
#endif
#endif
diff --git a/ras-signal-handler.c b/ras-signal-handler.c
index 3640bec..271f2c9 100644
--- a/ras-signal-handler.c
+++ b/ras-signal-handler.c
@@ -118,5 +118,9 @@ int ras_signal_event_handler(struct trace_seq *s,
report_ras_signal_event(s, &ev);
+#ifdef HAVE_JSON_REPORT
+ report_signal_event_json(s, &ev);
+#endif
+
return 0;
}
--
2.33.1
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。