1 Star 0 Fork 101

fly_fzc/systemd

forked from src-openEuler/systemd 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-core-Log-in-more-scenarios-about-which-process-initi.patch 3.07 KB
一键复制 编辑 原始数据 按行查看 历史
w30023233 提交于 2024-12-24 16:16 +08:00 . sync patches from systemd community
From 4389fea50bbb0810ed9193522c487257ca0b5d2d Mon Sep 17 00:00:00 2001
From: Daan De Meyer <daan.j.demeyer@gmail.com>
Date: Tue, 8 Oct 2024 16:28:25 +0200
Subject: [PATCH] core: Log in more scenarios about which process initiated an
operation
Exit/Reboot/Poweroff and similar operations are invasive enough that
logging about who initiated them is very useful to debug issues.
(cherry picked from commit acb0f501f4291efce82bcf89d4ad92b6a895f4fa)
(cherry picked from commit 814be7116dda14074749253d94b83387ceff0ff1)
(cherry picked from commit 4ce745446386bae450114c6fc2278577a7cf46f4)
Conflict:the current code does not have the method_soft_reboot function, so the related code is not combined
Reference:https://github.com/systemd/systemd/commit/acb0f501f4291efce82bcf89d4ad92b6a895f4fa
---
src/core/dbus-manager.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c
index 90c1daf995..856dd3b5dc 100644
--- a/src/core/dbus-manager.c
+++ b/src/core/dbus-manager.c
@@ -1706,6 +1706,8 @@ static int method_exit(sd_bus_message *message, void *userdata, sd_bus_error *er
if (r < 0)
return r;
+ log_caller(message, m, "Exit");
+
/* Exit() (in contrast to SetExitCode()) is actually allowed even if
* we are running on the host. It will fall back on reboot() in
* systemd-shutdown if it cannot do the exit() because it isn't a
@@ -1730,6 +1732,8 @@ static int method_reboot(sd_bus_message *message, void *userdata, sd_bus_error *
return sd_bus_error_setf(error, SD_BUS_ERROR_NOT_SUPPORTED,
"Reboot is only supported for system managers.");
+ log_caller(message, m, "Reboot");
+
m->objective = MANAGER_REBOOT;
return sd_bus_reply_method_return(message, NULL);
@@ -1792,6 +1798,8 @@ static int method_poweroff(sd_bus_message *message, void *userdata, sd_bus_error
return sd_bus_error_setf(error, SD_BUS_ERROR_NOT_SUPPORTED,
"Powering off is only supported for system managers.");
+ log_caller(message, m, "Poweroff");
+
m->objective = MANAGER_POWEROFF;
return sd_bus_reply_method_return(message, NULL);
@@ -1811,6 +1819,8 @@ static int method_halt(sd_bus_message *message, void *userdata, sd_bus_error *er
return sd_bus_error_setf(error, SD_BUS_ERROR_NOT_SUPPORTED,
"Halt is only supported for system managers.");
+ log_caller(message, m, "Halt");
+
m->objective = MANAGER_HALT;
return sd_bus_reply_method_return(message, NULL);
@@ -1830,6 +1840,8 @@ static int method_kexec(sd_bus_message *message, void *userdata, sd_bus_error *e
return sd_bus_error_setf(error, SD_BUS_ERROR_NOT_SUPPORTED,
"KExec is only supported for system managers.");
+ log_caller(message, m, "Kexec");
+
m->objective = MANAGER_KEXEC;
return sd_bus_reply_method_return(message, NULL);
--
2.33.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/fly_fzc/systemd.git
git@gitee.com:fly_fzc/systemd.git
fly_fzc
systemd
systemd
master

搜索帮助

371d5123 14472233 46e8bd33 14472233