8 Star 1 Fork 7

src-anolis-os/rasdaemon

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
1081-rasdaemon-signal-add-json-reporter.patch 2.58 KB
一键复制 编辑 原始数据 按行查看 历史
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
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-anolis-os/rasdaemon.git
[email protected]:src-anolis-os/rasdaemon.git
src-anolis-os
rasdaemon
rasdaemon
a8

搜索帮助