[v2,47/57] cr-restore: Add argument to criu_signals_setup()

Submitted by Kirill Tkhai on March 28, 2017, 3:41 p.m.

Details

Message ID 149071566735.12770.16325705650052106497.stgit@localhost.localdomain
State New
Series "Nested pid namespaces support"
Headers show

Commit Message

Kirill Tkhai March 28, 2017, 3:41 p.m.
v2: New

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

Patch hide | download patch | download mbox

diff --git a/criu/cr-restore.c b/criu/cr-restore.c
index 84e4171b..ab3d80a6 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 7a1efcfc..07e8fd8d 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