[CRIU] [PATCH] test: write_read10 -- Wait for children to create

Cyrill Gorcunov gorcunov at gmail.com
Mon Dec 21 13:10:52 PST 2015


On Mon, Dec 21, 2015 at 10:21:29PM +0300, Cyrill Gorcunov wrote:
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>

Pick the attached please: we should wait child to close the
descriptor as well.
-------------- next part --------------
>From 102883d7b45c6c4f37f9d3a00dbd4d13afcf6351 Mon Sep 17 00:00:00 2001
From: Cyrill Gorcunov <gorcunov at openvz.org>
Date: Mon, 21 Dec 2015 21:54:51 +0300
Subject: [PATCH] test: write_read10 -- Wait for children to create

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 test/zdtm/live/static/write_read10.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/test/zdtm/live/static/write_read10.c b/test/zdtm/live/static/write_read10.c
index 363384ad7844..bf5e6062b0b3 100644
--- a/test/zdtm/live/static/write_read10.c
+++ b/test/zdtm/live/static/write_read10.c
@@ -22,6 +22,7 @@ int main(int argc, char ** argv)
 	pid_t pid;
 	uint32_t crc;
 	uint8_t buf[1000000];
+	task_waiter_t t;
 
 	test_init(argc, argv);
 
@@ -42,6 +43,8 @@ int main(int argc, char ** argv)
 		exit(1);
 	}
 
+	task_waiter_init(&t);
+
 	pid = fork();
 	if (pid < 0) {
 		pr_perror("can't fork");
@@ -50,6 +53,7 @@ int main(int argc, char ** argv)
 
 	if (pid == 0) {	/* child writes to the unlinked file and returns */
 		close(fd);
+		task_waiter_complete_current(&t);
 		test_waitsig();
 
 		crc = ~0;
@@ -59,7 +63,8 @@ int main(int argc, char ** argv)
 
 		close(child_fd);
 		_exit(0);
-	}
+	} else
+		task_waiter_wait4(&t, pid);
 
 	close(child_fd);
 
-- 
2.5.0



More information about the CRIU mailing list