1 Star 0 Fork 50

庞庆/systemd_1

forked from src-anolis-os/systemd 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0583-busctl-add-a-timestamp-to-the-output-of-the-busctl-m.patch 1.58 KB
一键复制 编辑 原始数据 按行查看 历史
renbo02 提交于 2021-12-27 17:02 . update to systemd-239-51.el8
From 53673326ea78039b27e1dbd5328a8fe9a1a17445 Mon Sep 17 00:00:00 2001
From: d032747 <michael.trapp@sap.com>
Date: Tue, 15 Dec 2020 10:40:06 +0100
Subject: [PATCH] busctl: add a timestamp to the output of the busctl monitor
command
(cherry picked from commit 6fe2a70b9160e35fdeed9d37bd31727c2d46a8b2)
Resolves: #1909214
---
src/libsystemd/sd-bus/bus-dump.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/src/libsystemd/sd-bus/bus-dump.c b/src/libsystemd/sd-bus/bus-dump.c
index 2bd06053a6..36f592e0ba 100644
--- a/src/libsystemd/sd-bus/bus-dump.c
+++ b/src/libsystemd/sd-bus/bus-dump.c
@@ -55,6 +55,15 @@ int bus_message_dump(sd_bus_message *m, FILE *f, unsigned flags) {
f = stdout;
if (flags & BUS_MESSAGE_DUMP_WITH_HEADER) {
+ char buf[FORMAT_TIMESTAMP_MAX];
+ const char *p;
+ usec_t ts = m->realtime;
+
+ if (ts == 0)
+ ts = now(CLOCK_REALTIME);
+
+ p = format_timestamp_us_utc(buf, sizeof(buf), ts);
+
fprintf(f,
"%s%s%s Type=%s%s%s Endian=%c Flags=%u Version=%u Priority=%"PRIi64,
m->header->type == SD_BUS_MESSAGE_METHOD_ERROR ? ansi_highlight_red() :
@@ -82,6 +91,8 @@ int bus_message_dump(sd_bus_message *m, FILE *f, unsigned flags) {
if (m->reply_cookie != 0)
fprintf(f, " ReplyCookie=%" PRIu64, m->reply_cookie);
+ fprintf(f, " Timestamp=\"%s\"", strna(p));
+
fputs("\n", f);
if (m->sender)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/pang-qing/systemd_1.git
git@gitee.com:pang-qing/systemd_1.git
pang-qing
systemd_1
systemd_1
a8

搜索帮助