1 Star 0 Fork 98

温志伟/systemd

forked from src-openEuler/systemd 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
activation-service-must-be-restarted-when-reactivated.patch 1.67 KB
一键复制 编辑 原始数据 按行查看 历史
From 4acc8a3168e5f11b5308cf8558d68bf2a0503444 Mon Sep 17 00:00:00 2001
From: huangkaibin <huangkaibin@huawei.com>
Date: Mon, 7 Aug 2017 17:06:30 +0800
Subject: [PATCH] systemd: Activation service must be restarted when it is already started and re-actived
by dbus
When dbus-daemon service is killed, every activation service must be restarted
to reestblished dbus connection between dbus-daemon and the service.
Otherwise, there will be problem on the dbus connection. This patch fix this
problem by set JobType to JOB_RESTART when it is re-actived in signal_activation_request function.
---
src/core/dbus.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/core/dbus.c b/src/core/dbus.c
index 29524d4..38940ef 100644
--- a/src/core/dbus.c
+++ b/src/core/dbus.c
@@ -152,6 +152,8 @@ static int signal_activation_request(sd_bus_message *message, void *userdata, sd
const char *name;
Unit *u;
int r;
+ int jobtype;
+ Service *s = NULL;
assert(message);
assert(m);
@@ -177,7 +179,13 @@ static int signal_activation_request(sd_bus_message *message, void *userdata, sd
goto failed;
}
- r = manager_add_job(m, JOB_START, u, JOB_REPLACE, NULL, &error, NULL);
+ jobtype = JOB_START;
+ s = SERVICE(u);
+ if(s && s->state != SERVICE_DEAD) {
+ jobtype = JOB_RESTART;
+ log_unit_info(u, "Service '%s' will be restarted to activate the service. The current service state is %d.", u->id, s->state);
+ }
+ r = manager_add_job(m, jobtype, u, JOB_REPLACE, NULL, &error, NULL);
if (r < 0)
goto failed;
--
1.8.3.1
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wenzhiwei11/systemd.git
git@gitee.com:wenzhiwei11/systemd.git
wenzhiwei11
systemd
systemd
master

搜索帮助