代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/lxcfs 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
diff --git a/src/proc_fuse.c b/src/proc_fuse.c
index 334f6ea..3ceba73 100644
--- a/src/proc_fuse.c
+++ b/src/proc_fuse.c
@@ -51,6 +51,26 @@
#include "proc_cpuview.h"
#include "utils.h"
+static pthread_mutex_t container_dev_mutex = PTHREAD_MUTEX_INITIALIZER;
+
+static void lock_mutex(pthread_mutex_t *l)
+{
+ int ret;
+
+ ret = pthread_mutex_lock(l);
+ if (ret)
+ log_exit("%s - returned %d\n", strerror(ret), ret);
+}
+
+static void unlock_mutex(pthread_mutex_t *l)
+{
+ int ret;
+
+ ret = pthread_mutex_unlock(l);
+ if (ret)
+ log_exit("%s - returned %d\n", strerror(ret), ret);
+}
+
struct memory_stat {
uint64_t hierarchical_memory_limit;
uint64_t hierarchical_memsw_limit;
@@ -418,6 +438,16 @@ struct devinfo* container_dev_read(pid_t pid) {
return head;
}
if (child_pid == 0) {
+ /* Disallow signal reception in child process */
+ sigset_t oldset;
+ sigset_t newset;
+ sigemptyset(&newset);
+ sigaddset(&newset, SIGTERM);
+ sigaddset(&newset, SIGINT);
+ sigaddset(&newset, SIGHUP);
+ sigaddset(&newset, SIGQUIT);
+ sigprocmask(SIG_BLOCK,&newset,&oldset);
+
close(mypipe[0]);
stream = fdopen(mypipe[1], "w");
if (stream == NULL) {
@@ -464,6 +494,8 @@ child_out:
lxcfs_error("Error opening pipe for reading: %s\n", strerror(errno));
goto err;
}
+ wait_for_pid(child_pid);
+ child_pid = 0;
while (fscanf(stream, "%100s%d", dev_name, &dev_num) == 2) {
if (dev_num == 0) {
break;
@@ -590,7 +622,9 @@ static int proc_diskstats_read(char *buf, size_t size, off_t offset,
if (!f)
return 0;
+ lock_mutex(&container_dev_mutex);
container_devinfo = container_dev_read(initpid);
+ unlock_mutex(&container_dev_mutex);
while (getline(&line, &linelen, f) != -1) {
ssize_t l;
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。