[CRIU] [RESEND v2 3/5] zdtm: add reset_pid() function

Adrian Reber adrian at lisas.de
Tue May 23 02:42:13 PDT 2017


From: Adrian Reber <areber at redhat.com>

In preparation for the zdtm option '--check-only' a new helper function
reset_pid() is added which writes to ns_last_pid to avoid PID collisions
during check-only restore and the real restore.

Signed-off-by: Adrian Reber <areber at redhat.com>
---
 test/zdtm.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/test/zdtm.py b/test/zdtm.py
index 26b8939..19fbec2 100755
--- a/test/zdtm.py
+++ b/test/zdtm.py
@@ -336,6 +336,13 @@ def wait_pid_die(pid, who, tmo = 30):
 def test_flag(tdesc, flag):
 	return flag in tdesc.get('flags', '').split()
 
+
+def reset_pid(pid = 1):
+	fd = open('/proc/sys/kernel/ns_last_pid', 'w')
+	fd.write('%s' % pid)
+	fd.close()
+
+
 #
 # Exception thrown when something inside the test goes wrong,
 # e.g. test doesn't start, criu returns with non zero code or
-- 
1.8.3.1



More information about the CRIU mailing list