[CRIU] [PATCH 6/8] sig: Block signals once before forking children
Pavel Emelyanov
xemul at parallels.com
Wed Aug 6 05:25:25 PDT 2014
We already have a signals setup helper for this.
Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
---
cr-restore.c | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/cr-restore.c b/cr-restore.c
index 5757130..afdafd8 100644
--- a/cr-restore.c
+++ b/cr-restore.c
@@ -1067,6 +1067,7 @@ static int criu_signals_setup(void)
{
int ret;
struct sigaction act;
+ sigset_t blockmask;
ret = sigaction(SIGCHLD, NULL, &act);
if (ret < 0) {
@@ -1097,6 +1098,19 @@ static int criu_signals_setup(void)
return -1;
}
+ /*
+ * The block mask will be restored in sigreturn.
+ *
+ * TODO: This code should be removed, when a freezer will be added.
+ */
+ sigfillset(&blockmask);
+ sigdelset(&blockmask, SIGCHLD);
+ ret = sigprocmask(SIG_BLOCK, &blockmask, NULL);
+ if (ret < 0) {
+ pr_perror("Can't block signals");
+ return -1;
+ }
+
return 0;
}
@@ -1248,7 +1262,6 @@ static int restore_task_with_children(void *_arg)
struct cr_clone_arg *ca = _arg;
pid_t pid;
int ret;
- sigset_t blockmask;
current = ca->item;
@@ -1315,19 +1328,6 @@ static int restore_task_with_children(void *_arg)
goto err;
}
- /*
- * The block mask will be restored in sigreturn.
- *
- * TODO: This code should be removed, when a freezer will be added.
- */
- sigfillset(&blockmask);
- sigdelset(&blockmask, SIGCHLD);
- ret = sigprocmask(SIG_BLOCK, &blockmask, NULL);
- if (ret) {
- pr_perror("%d: Can't block signals", current->pid.virt);
- goto err;
- }
-
if (prepare_mappings(pid))
goto err;
--
1.8.4.2
More information about the CRIU
mailing list