Signed-off-by: Rostislav Skudnov <rostislav@tuxera.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <eguan@redhat.com>
tid[i] = (uint64_t)t[i];
printf("INFO: thread %d created\n", i);
} else {
tid[i] = (uint64_t)t[i];
printf("INFO: thread %d created\n", i);
} else {
/*
* Flush stdout before fork, otherwise some lines get
* duplicated... ?!?!?
*/
fflush(stdout);
/*
* Flush stdout before fork, otherwise some lines get
* duplicated... ?!?!?
*/
fflush(stdout);
- tid[i] = fork();
- if (tid[i] < 0) {
+ pid = fork();
+ if (pid < 0) {
int j;
perror("fork");
for (j = 0; j < i; j++)
waitpid(tid[j], NULL, 0);
exit(21);
int j;
perror("fork");
for (j = 0; j < i; j++)
waitpid(tid[j], NULL, 0);
exit(21);
- }
- /* Child? */
- if (!tid[i]) {
+ } else if (!pid) {
+ /* Child? */
void *ret;
if (use_wr[i])
void *ret;
if (use_wr[i])
ret = pt_page_marker(&targs[i]);
exit(ret ? 1 : 0);
}
ret = pt_page_marker(&targs[i]);
exit(ret ? 1 : 0);
}
printf("INFO: process %d created\n", i);
}
}
printf("INFO: process %d created\n", i);
}
}