[CRIU] [PATCH v3 44/55] cr-restore: Add argument to criu_signals_setup()

Kirill Tkhai ktkhai at virtuozzo.com
Mon Apr 10 01:22:22 PDT 2017


v2: New

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 criu/cr-restore.c      |    6 +++---
 criu/include/restore.h |    3 +++
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/criu/cr-restore.c b/criu/cr-restore.c
index 4e3c808a2..36530290f 100644
--- a/criu/cr-restore.c
+++ b/criu/cr-restore.c
@@ -1153,7 +1153,7 @@ static void sigchld_handler(int signal, siginfo_t *siginfo, void *data)
 	futex_abort_and_wake(&task_entries->nr_in_progress);
 }
 
-static int criu_signals_setup(void)
+int criu_signals_setup(void (*handler)(int, siginfo_t *, void *))
 {
 	int ret;
 	struct sigaction act;
@@ -1166,7 +1166,7 @@ static int criu_signals_setup(void)
 	}
 
 	act.sa_flags |= SA_NOCLDSTOP | SA_SIGINFO | SA_RESTART;
-	act.sa_sigaction = sigchld_handler;
+	act.sa_sigaction = handler;
 	sigemptyset(&act.sa_mask);
 	sigaddset(&act.sa_mask, SIGCHLD);
 
@@ -2174,7 +2174,7 @@ int cr_restore_tasks(void)
 	if (crtools_prepare_shared() < 0)
 		goto err;
 
-	if (criu_signals_setup() < 0)
+	if (criu_signals_setup(sigchld_handler) < 0)
 		goto err;
 
 	if (prepare_lazy_pages_socket() < 0)
diff --git a/criu/include/restore.h b/criu/include/restore.h
index 7a1efcfc4..07e8fd8d7 100644
--- a/criu/include/restore.h
+++ b/criu/include/restore.h
@@ -2,4 +2,7 @@
 #define __CR_INC_RESTORE_H__
 #include "types.h"
 #include "asm/restore.h"
+
+extern int criu_signals_setup(void (*handler)(int, siginfo_t *, void *));
+
 #endif



More information about the CRIU mailing list