[PATCH] zdtm: pthread00 -- Use exit_group where appropriate
Cyrill Gorcunov
gorcunov at openvz.org
Fri Nov 23 09:53:18 EST 2012
Reported-by: Andrew Vagin <avagin at parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
test/zdtm/live/static/pthread00.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/test/zdtm/live/static/pthread00.c b/test/zdtm/live/static/pthread00.c
index 3d494f1..2b248b2 100644
--- a/test/zdtm/live/static/pthread00.c
+++ b/test/zdtm/live/static/pthread00.c
@@ -14,10 +14,12 @@
#include <sys/mman.h>
#include <fcntl.h>
#include <pthread.h>
+#include <syscall.h>
#include "zdtmtst.h"
-#define gettid() pthread_self()
+#define exit_group(code) \
+ syscall(__NR_exit_group, code)
const char *test_doc = "Create a few pthreads/forks and compare TLS and mmap data on restore\n";
const char *test_author = "Cyrill Gorcunov <gorcunov at openvz.org";
@@ -57,7 +59,7 @@ static void *thread_subfunc_1(void *map)
pid = test_fork();
if (pid < 0) {
- exit(1);
+ exit_group(1);
} else if (pid == 0) {
passage(0);
exit(0);
@@ -82,13 +84,13 @@ static void *thread_func_1(void *map)
if (pthread_create(&th, NULL, &thread_subfunc_1, map)) {
fail("Can't pthread_create");
- exit(1);
+ exit_group(1);
}
pid = test_fork();
if (pid < 0) {
fail("Failed to test_fork()\n");
- exit(1);
+ exit_group(1);
} else if (pid == 0) {
passage(2);
exit(0);
@@ -114,7 +116,7 @@ static void *thread_func_2(void *map)
pid = test_fork();
if (pid < 0) {
fail("Failed to test_fork()\n");
- exit(1);
+ exit_group(1);
} else if (pid == 0) {
passage(4);
exit(0);
--
1.7.7.6
--1yeeQ81UyVL57Vl7--
More information about the CRIU
mailing list