Commit a016bc84 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

zdtm: pthread00 -- Use exit_group where appropriate

Reported-by: 's avatarAndrew Vagin <avagin@parallels.com>
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 88ec6bc4
......@@ -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@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);
......@@ -80,13 +82,15 @@ static void *thread_func_1(void *map)
memcpy(tls_data, __tls_data, sizeof(tls_data));
if (pthread_create(&th, NULL, &thread_subfunc_1, map))
perror("Cant create thread");
if (pthread_create(&th, NULL, &thread_subfunc_1, map)) {
fail("Can't pthread_create");
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);
......@@ -112,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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment