代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/etmem 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 104406ad127feeafbf5c8d618c608285ff23cd78 Mon Sep 17 00:00:00 2001
From: Kemeng Shi <shikemeng@huawei.com>
Date: Tue, 11 May 2021 16:08:39 +0800
Subject: [PATCH 27/50] add ign_host to ignore host access when scan vm
Signed-off-by: Kemeng Shi <shikemeng@huawei.com>
---
src/etmemd_src/etmemd_cslide.c | 25 ++++++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)
diff --git a/src/etmemd_src/etmemd_cslide.c b/src/etmemd_src/etmemd_cslide.c
index 47a3608..9a2ab04 100644
--- a/src/etmemd_src/etmemd_cslide.c
+++ b/src/etmemd_src/etmemd_cslide.c
@@ -98,6 +98,7 @@ struct cslide_task_params {
char **vmflags_array;
int vmflags_num;
};
+ int scan_flags;
};
struct vma_pf {
@@ -1285,13 +1286,14 @@ static int cslide_scan_vmas(struct cslide_pid_params *params)
struct walk_address walk_address;
uint64_t i;
int fd;
+ struct cslide_task_params *task_params = params->task_params;
if (snprintf_s(pid, PID_STR_MAX_LEN, PID_STR_MAX_LEN - 1, "%u", params->pid) <= 0) {
etmemd_log(ETMEMD_LOG_ERR, "snpintf pid %u fail\n", params->pid);
return -1;
}
- scan_fp = etmemd_get_proc_file(pid, IDLE_SCAN_FILE, SCAN_AS_HUGE, "r");
+ scan_fp = etmemd_get_proc_file(pid, IDLE_SCAN_FILE, task_params->scan_flags, "r");
if (scan_fp == NULL) {
etmemd_log(ETMEMD_LOG_ERR, "open %s file for pid %u fail\n", IDLE_SCAN_FILE, params->pid);
return -1;
@@ -1922,9 +1924,30 @@ static int fill_task_vm_flags(void *obj, void *val)
return 0;
}
+static int fill_task_scan_flags(void *obj, void *val)
+{
+ struct cslide_task_params *params = (struct cslide_task_params *)obj;
+ char *ign_host = (char *)val;
+ int ret = 0;
+
+ params->scan_flags |= SCAN_AS_HUGE;
+
+ if (strcmp(ign_host, "yes") == 0) {
+ params->scan_flags |= SCAN_IGN_HOST;
+ } else if (strcmp(ign_host, "no") != 0) {
+ etmemd_log(ETMEMD_LOG_ERR, "ign_host : not support %s\n", ign_host);
+ etmemd_log(ETMEMD_LOG_ERR, "ign_host : only support yes/no\n");
+ return -1;
+ }
+
+ free(val);
+ return ret;
+}
+
static struct config_item g_cslide_task_config_items[] = {
{"vm_flags", STR_VAL, fill_task_vm_flags, false},
{"anon_only", STR_VAL, fill_task_anon_only, false},
+ {"ign_host", STR_VAL, fill_task_scan_flags, false},
};
static int cslide_fill_task(GKeyFile *config, struct task *tk)
--
2.27.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。