代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/iSulad 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 491baece02522128720b3bd992a76dc5148aa7b2 Mon Sep 17 00:00:00 2001
From: zhongtao <[email protected]>
Date: Mon, 8 Apr 2024 11:37:13 +0800
Subject: [PATCH 49/69] distinguish between runtime and runtime_cmd in
isulad-shim
Signed-off-by: zhongtao <[email protected]>
---
src/cmd/isulad-shim/process.c | 20 +++++++++----------
src/cmd/isulad-shim/process.h | 4 ++--
.../modules/runtime/isula/isula_rt_ops.c | 2 ++
3 files changed, 14 insertions(+), 12 deletions(-)
diff --git a/src/cmd/isulad-shim/process.c b/src/cmd/isulad-shim/process.c
index 8a4ca175..6b5f8f7f 100644
--- a/src/cmd/isulad-shim/process.c
+++ b/src/cmd/isulad-shim/process.c
@@ -1131,7 +1131,7 @@ static int init_root_path(process_t *p)
return SHIM_ERR;
}
- if (buffer->nappend(buffer, PATH_MAX, "%s/%s", state_path, p->runtime) < 0) {
+ if (buffer->nappend(buffer, PATH_MAX, "%s/%s", state_path, p->state->runtime) < 0) {
ERROR("Failed to append state_path\n");
isula_buffer_free(buffer);
return SHIM_ERR;
@@ -1146,7 +1146,7 @@ static int init_root_path(process_t *p)
return SHIM_OK;
}
-process_t *new_process(char *id, char *bundle, char *runtime)
+process_t *new_process(char *id, char *bundle, char *runtime_cmd)
{
shim_client_process_state *p_state;
process_t *p = NULL;
@@ -1174,7 +1174,7 @@ process_t *new_process(char *id, char *bundle, char *runtime)
p->id = id;
p->bundle = bundle;
- p->runtime = runtime;
+ p->runtime_cmd = runtime_cmd;
p->state = p_state;
p->console_sock_path = NULL;
p->exit_fd = -1;
@@ -1247,7 +1247,7 @@ static void set_common_params(process_t *p, const char *params[], int *index, co
{
int j;
- params[(*index)++] = p->runtime;
+ params[(*index)++] = p->runtime_cmd;
for (j = 0; j < p->state->runtime_args_len; j++) {
params[(*index)++] = p->state->runtime_args[j];
}
@@ -1261,7 +1261,7 @@ static void set_common_params(process_t *p, const char *params[], int *index, co
// In addition to kata, other commonly used oci runtimes (runc, crun, youki, gvisor)
// need to set the --root option
- if (strcasecmp(p->runtime, "kata-runtime") != 0) {
+ if (strcasecmp(p->state->runtime, "kata-runtime") != 0) {
params[(*index)++] = "--root";
params[(*index)++] = p->root_path;
}
@@ -1347,7 +1347,7 @@ static void process_kill_all(process_t *p)
params[i++] = p->id;
params[i++] = "SIGKILL";
- (void)cmd_combined_output(p->runtime, params, output, &output_len);
+ (void)cmd_combined_output(p->runtime_cmd, params, output, &output_len);
return;
}
@@ -1375,7 +1375,7 @@ static void process_delete(process_t *p)
params[i++] = "--force";
params[i++] = p->id;
- (void)cmd_combined_output(p->runtime, params, output, &output_len);
+ (void)cmd_combined_output(p->runtime_cmd, params, output, &output_len);
return;
}
@@ -1444,8 +1444,8 @@ static void exec_runtime_process(process_t *p, int exec_fd)
const char *params[MAX_RUNTIME_ARGS] = { 0 };
get_runtime_cmd(p, log_path, pid_path, process_desc, params);
- execvp(p->runtime, (char * const *)params);
- (void)dprintf(exec_fd, "run process: %s error: %s", p->runtime, strerror(errno));
+ execvp(p->runtime_cmd, (char * const *)params);
+ (void)dprintf(exec_fd, "run process: %s error: %s", p->runtime_cmd, strerror(errno));
_exit(EXIT_FAILURE);
}
@@ -1586,7 +1586,7 @@ static int waitpid_with_timeout(int ctr_pid, int *status, const uint64_t timeou
static int wait_container_process_with_timeout(process_t *p, const uint64_t timeout, int *status)
{
// currently, kata runtime does not support setting timeout during exec
- if (strcasecmp(p->runtime, "kata-runtime") != 0 && timeout > 0) {
+ if (strcasecmp(p->state->runtime, "kata-runtime") != 0 && timeout > 0) {
return waitpid_with_timeout(p->ctr_pid, status, timeout);
}
diff --git a/src/cmd/isulad-shim/process.h b/src/cmd/isulad-shim/process.h
index 32ba7366..05fd87b0 100644
--- a/src/cmd/isulad-shim/process.h
+++ b/src/cmd/isulad-shim/process.h
@@ -44,7 +44,7 @@ typedef struct {
typedef struct process {
char *id;
char *bundle;
- char *runtime;
+ char *runtime_cmd;
char *console_sock_path; // pty socket path
char *workdir;
char *root_path;
@@ -70,7 +70,7 @@ typedef struct {
int status;
} process_exit_t;
-process_t* new_process(char *id, char *bundle, char *runtime);
+process_t* new_process(char *id, char *bundle, char *runtime_cmd);
int prepare_attach_socket(process_t *p);
diff --git a/src/daemon/modules/runtime/isula/isula_rt_ops.c b/src/daemon/modules/runtime/isula/isula_rt_ops.c
index b9aba3e3..bc3c36c8 100644
--- a/src/daemon/modules/runtime/isula/isula_rt_ops.c
+++ b/src/daemon/modules/runtime/isula/isula_rt_ops.c
@@ -1154,6 +1154,7 @@ int rt_isula_create(const char *id, const char *runtime, const rt_create_params_
p.isulad_stdin = (char *)params->stdin;
p.isulad_stdout = (char *)params->stdout;
p.isulad_stderr = (char *)params->stderr;
+ p.runtime = (char *)runtime;
p.runtime_args = (char **)runtime_args;
p.runtime_args_len = runtime_args_len;
p.attach_socket = attach_socket;
@@ -1409,6 +1410,7 @@ static int preparation_exec(const char *id, const char *runtime, const char *wor
p.isulad_stdout = (char *)params->console_fifos[1];
p.isulad_stderr = (char *)params->console_fifos[2];
p.resize_fifo = resize_fifo_dir;
+ p.runtime = (char *)runtime;
p.runtime_args = (char **)runtime_args;
p.runtime_args_len = runtime_args_len;
copy_process(&p, process);
--
2.34.1
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。