aboutsummaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
authorSchrodinger ZHU Yifan <yifanzhu@rochester.edu>2024-05-31 20:09:55 -0700
committerGitHub <noreply@github.com>2024-05-31 20:09:55 -0700
commit8057756190afb8a8e5d550788fcc63914e920d0f (patch)
treef0ca93870904bce325feeeb1f1e831d6713565cc /libc
parent85fd1688b2bbbbfc73ba97d95e621cfbfe9a3fff (diff)
downloadllvm-8057756190afb8a8e5d550788fcc63914e920d0f.zip
llvm-8057756190afb8a8e5d550788fcc63914e920d0f.tar.gz
llvm-8057756190afb8a8e5d550788fcc63914e920d0f.tar.bz2
[libc] fix test build on platforms without `SYS_fork` (#94087)
Diffstat (limited to 'libc')
-rw-r--r--libc/test/src/__support/threads/linux/raw_mutex_test.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/libc/test/src/__support/threads/linux/raw_mutex_test.cpp b/libc/test/src/__support/threads/linux/raw_mutex_test.cpp
index 814f6f1..aff6c8b 100644
--- a/libc/test/src/__support/threads/linux/raw_mutex_test.cpp
+++ b/libc/test/src/__support/threads/linux/raw_mutex_test.cpp
@@ -63,7 +63,11 @@ TEST(LlvmLibcSupportThreadsRawMutexTest, PSharedLock) {
shared->data = 0;
LIBC_NAMESPACE::RawMutex::init(&shared->mutex);
// Avoid pull in our own implementation of pthread_t.
+#ifdef SYS_fork
long pid = LIBC_NAMESPACE::syscall_impl<long>(SYS_fork);
+#elif defined(SYS_clone)
+ long pid = LIBC_NAMESPACE::syscall_impl<long>(SYS_clone, SIGCHLD, 0);
+#endif
for (int i = 0; i < 10000; ++i) {
shared->mutex.lock(LIBC_NAMESPACE::cpp::nullopt, true);
shared->data++;