tsan: fix syscall test on aarch64
authorDmitry Vyukov <dvyukov@google.com>
Wed, 12 May 2021 06:54:34 +0000 (08:54 +0200)
committerDmitry Vyukov <dvyukov@google.com>
Wed, 12 May 2021 07:00:51 +0000 (09:00 +0200)
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

compiler-rt/test/tsan/Linux/syscall.h

index ccbc0d4..2d0a854 100644 (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;
 }