tsan: fix fork syscall test

Arm64 builders failed with:
error: use of undeclared identifier 'SYS_fork'
https://lab.llvm.org/buildbot/#/builders/7/builds/2575

Indeed, not all arches have fork syscall.
Implement fork via clone on these arches.

Differential Revision: https://reviews.llvm.org/D101603
This commit is contained in:
Dmitry Vyukov 2021-04-30 10:20:01 +02:00
parent 97ed1b6036
commit b6df852901
1 changed files with 4 additions and 0 deletions

View File

@ -16,7 +16,11 @@ static void *incrementer(void *p) {
int myfork() {
__sanitizer_syscall_pre_fork();
#ifdef SYS_fork
int res = syscall(SYS_fork);
#else
int res = syscall(SYS_clone, SIGCHLD, 0);
#endif
__sanitizer_syscall_post_fork(res);
return res;
}