Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/checkpoint-restore/criu.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'test/others/rpc/setup_swrk.py')
-rw-r--r--test/others/rpc/setup_swrk.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/others/rpc/setup_swrk.py b/test/others/rpc/setup_swrk.py
new file mode 100644
index 000000000..c7f84f952
--- /dev/null
+++ b/test/others/rpc/setup_swrk.py
@@ -0,0 +1,16 @@
+import sys
+import socket
+import subprocess
+
+def setup_swrk():
+ print('Connecting to CRIU in swrk mode.')
+ s1, s2 = socket.socketpair(socket.AF_UNIX, socket.SOCK_SEQPACKET)
+
+ kwargs = {}
+ if sys.version_info.major == 3:
+ kwargs["pass_fds"] = [s1.fileno()]
+
+ swrk = subprocess.Popen(['./criu', "swrk", "%d" % s1.fileno()], **kwargs)
+ s1.close()
+ return swrk, s2
+