[CRIU] [PATCH v4 09/19] sfds: Populate pid proc

Kirill Tkhai ktkhai at virtuozzo.com
Wed Jan 10 17:01:51 MSK 2018


This patch populates/occupies PROC_FD_OFF fd number,
which is goint to be replaced atomically in next patches.

v4: New

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 criu/cr-restore.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/criu/cr-restore.c b/criu/cr-restore.c
index 49d367e4c..2534575a4 100644
--- a/criu/cr-restore.c
+++ b/criu/cr-restore.c
@@ -529,6 +529,15 @@ static int populate_root_fd_off(void)
 	return ret >= 0 ? 0 : -1;
 }
 
+static int populate_pid_proc(void)
+{
+	if (open_pid_proc(vpid(current)) < 0) {
+		pr_err("Can't open PROC_SELF\n");
+		return -1;
+	}
+	return 0;
+}
+
 static rt_sigaction_t sigchld_act;
 /*
  * If parent's sigaction has blocked SIGKILL (which is non-sence),
@@ -1912,6 +1921,9 @@ static int restore_task_with_children(void *_arg)
 
 	timing_stop(TIME_FORK);
 
+	if (populate_pid_proc())
+		goto err;
+
 	if (unmap_guard_pages(current))
 		goto err;
 



More information about the CRIU mailing list