[libcxx-commits] [libcxx] [libc++][FreeBSD] use copy_file_range() in FreeBSD >= 13.0 (PR #169179)

via libcxx-commits libcxx-commits at lists.llvm.org
Sat Nov 22 10:06:23 PST 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libcxx

Author: Raman Shishniou (004helix)

<details>
<summary>Changes</summary>

The copy_file_range() function appeared in FreeBSD 13.0.

https://man.freebsd.org/cgi/man.cgi?copy_file_range

---
Full diff: https://github.com/llvm/llvm-project/pull/169179.diff


1 Files Affected:

- (modified) libcxx/src/filesystem/operations.cpp (+4-1) 


``````````diff
diff --git a/libcxx/src/filesystem/operations.cpp b/libcxx/src/filesystem/operations.cpp
index b71f94a89d6df..e58486bf5cbbd 100644
--- a/libcxx/src/filesystem/operations.cpp
+++ b/libcxx/src/filesystem/operations.cpp
@@ -50,7 +50,10 @@
 #    define _LIBCPP_FILESYSTEM_USE_COPY_FILE_RANGE
 #  endif
 #elif defined(__FreeBSD__)
-#  define _LIBCPP_FILESYSTEM_USE_COPY_FILE_RANGE
+#  include <sys/param.h>
+#  if __FreeBSD_version >= 1300000
+#    define _LIBCPP_FILESYSTEM_USE_COPY_FILE_RANGE
+#  endif
 #endif
 #if __has_include(<sys/sendfile.h>)
 #  include <sys/sendfile.h>

``````````

</details>


https://github.com/llvm/llvm-project/pull/169179


More information about the libcxx-commits mailing list