[libc-commits] [libc] [libc] fix test build on platforms without `SYS_fork` (PR #94087)
Schrodinger ZHU Yifan via libc-commits
libc-commits at lists.llvm.org
Fri May 31 19:25:26 PDT 2024
https://github.com/SchrodingerZhu created https://github.com/llvm/llvm-project/pull/94087
None
>From 70b20bea1005cb1b00fc4479b821e2221d9bb455 Mon Sep 17 00:00:00 2001
From: Yifan Zhu <yifzhu at nvidia.com>
Date: Fri, 31 May 2024 19:24:59 -0700
Subject: [PATCH] [libc] fix test build on platforms without SYS-fork
---
libc/test/src/__support/threads/linux/raw_mutex_test.cpp | 4 ++++
1 file changed, 4 insertions(+)
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 814f6f14c87b9..aff6c8be0cb1b 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++;
More information about the libc-commits
mailing list