[libc-commits] [libc] 8057756 - [libc] fix test build on platforms without `SYS_fork` (#94087)

via libc-commits libc-commits at lists.llvm.org
Fri May 31 20:09:58 PDT 2024


Author: Schrodinger ZHU Yifan
Date: 2024-05-31T20:09:55-07:00
New Revision: 8057756190afb8a8e5d550788fcc63914e920d0f

URL: https://github.com/llvm/llvm-project/commit/8057756190afb8a8e5d550788fcc63914e920d0f
DIFF: https://github.com/llvm/llvm-project/commit/8057756190afb8a8e5d550788fcc63914e920d0f.diff

LOG: [libc] fix test build on platforms without `SYS_fork` (#94087)

Added: 
    

Modified: 
    libc/test/src/__support/threads/linux/raw_mutex_test.cpp

Removed: 
    


################################################################################
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