tsan: fix syscall test on aarch64

Add missing includes and use SYS_pipe2 instead of SYS_pipe
as it's not present on some arches.

Differential Revision: https://reviews.llvm.org/D102311
This commit is contained in:
Dmitry Vyukov 2021-05-12 08:54:34 +02:00
parent 382c505d9c
commit 1dc838717a
1 changed files with 3 additions and 1 deletions

View File

@ -1,4 +1,6 @@
#include <fcntl.h>
#include <sanitizer/linux_syscall_hooks.h>
#include <signal.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <unistd.h>
@ -16,7 +18,7 @@ int myfork() {
int mypipe(int pipefd[2]) {
__sanitizer_syscall_pre_pipe(pipefd);
int res = syscall(SYS_pipe, pipefd);
int res = syscall(SYS_pipe2, pipefd, 0);
__sanitizer_syscall_post_pipe(res, pipefd);
return res;
}