[v4,30/41] cr-restore: Add argument to criu_signals_setup()

Submitted by Kirill Tkhai on May 4, 2017, 4:10 p.m.

Details

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

Commit Message

Kirill Tkhai May 4, 2017, 4:10 p.m.
This will be used in next patches to set specific
handler, not only currently hardcoded sigchld_handler().

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 8c8878463..4c4ca37d7 100644
--- a/criu/cr-restore.c
+++ b/criu/cr-restore.c
@@ -1295,7 +1295,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;
@@ -1308,7 +1308,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);
 
@@ -2244,7 +2244,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