代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/iSulad 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 3942bcc4c3a755d33e709046edd358f9af264d11 Mon Sep 17 00:00:00 2001
From: holyfei <[email protected]>
Date: Wed, 21 Oct 2020 10:00:15 +0800
Subject: [PATCH 03/28] isulad: rt_isula_start should read the isulad-shim
pidinfo
reason: the ppid of init pid should be isulad-shim, read isulad-shim pidinfo and set the start time for init pidinfo
Signed-off-by: yangfeiyu <[email protected]>
---
.../modules/runtime/isula/isula_rt_ops.c | 38 ++++++++++++++++++-
1 file changed, 36 insertions(+), 2 deletions(-)
diff --git a/src/daemon/modules/runtime/isula/isula_rt_ops.c b/src/daemon/modules/runtime/isula/isula_rt_ops.c
index 6e4512f..82d7aec 100644
--- a/src/daemon/modules/runtime/isula/isula_rt_ops.c
+++ b/src/daemon/modules/runtime/isula/isula_rt_ops.c
@@ -851,8 +851,13 @@ out:
int rt_isula_start(const char *id, const char *runtime, const rt_start_params_t *params, pid_ppid_info_t *pid_info)
{
char workdir[PATH_MAX] = { 0 };
+ char shim_pid_file_name[PATH_MAX] = { 0 };
pid_t pid = 0;
+ pid_t shim_pid = -1;
int ret = 0;
+ int splice_ret = 0;
+ proc_t *proc = NULL;
+ proc_t *p_proc = NULL;
if (id == NULL || runtime == NULL || params == NULL || pid_info == NULL) {
ERROR("nullptr arguments not allowed");
@@ -863,6 +868,12 @@ int rt_isula_start(const char *id, const char *runtime, const rt_start_params_t
return -1;
}
+ splice_ret = snprintf(shim_pid_file_name, sizeof(shim_pid_file_name), "%s/shim-pid", workdir);
+ if (splice_ret < 0 || splice_ret >= sizeof(shim_pid_file_name)) {
+ ERROR("%s: wrong shim workdir", id);
+ return -1;
+ }
+
pid = get_container_process_pid(workdir);
if (pid < 0) {
ret = -1;
@@ -870,12 +881,32 @@ int rt_isula_start(const char *id, const char *runtime, const rt_start_params_t
goto out;
}
- if (util_read_pid_ppid_info(pid, pid_info) != 0) {
+ file_read_int(shim_pid_file_name, &shim_pid);
+ if (shim_pid < 0) {
+ ret = -1;
+ ERROR("%s: failed to read isulad shim pid", id);
+ goto out;
+ }
+
+ proc = util_get_process_proc_info(pid);
+ if (proc == NULL) {
ret = -1;
- ERROR("%s: failed read pid info", id);
+ ERROR("%s: failed to read pidinfo", id);
goto out;
}
+ p_proc = util_get_process_proc_info(shim_pid);
+ if (p_proc == NULL) {
+ ret = -1;
+ ERROR("%s: failed to read isulad shim pidinfo", id);
+ goto out;
+ }
+
+ pid_info->pid = proc->pid;
+ pid_info->start_time = proc->start_time;
+ pid_info->ppid = shim_pid;
+ pid_info->pstart_time = p_proc->start_time;
+
if (runtime_call_simple(workdir, runtime, "start", NULL, 0, id) != 0) {
ERROR("call runtime start id failed");
ret = -1;
@@ -888,6 +919,9 @@ out:
shim_kill_force(workdir);
}
+ free(proc);
+ free(p_proc);
+
return ret;
}
--
2.20.1
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。