[libc-commits] [libc] [libc] fix test build on platforms without `SYS_fork` (PR #94087)
via libc-commits
libc-commits at lists.llvm.org
Fri May 31 19:25:59 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libc
Author: Schrodinger ZHU Yifan (SchrodingerZhu)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/94087.diff
1 Files Affected:
- (modified) libc/test/src/__support/threads/linux/raw_mutex_test.cpp (+4)
``````````diff
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++;
``````````
</details>
https://github.com/llvm/llvm-project/pull/94087
More information about the libc-commits
mailing list