Skip to content

Conversation

@004helix
Copy link

The copy_file_range() function appeared in FreeBSD 13.0.

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

@004helix 004helix requested a review from a team as a code owner November 22, 2025 18:05
@github-actions
Copy link

Thank you for submitting a Pull Request (PR) to the LLVM Project!

This PR will be automatically labeled and the relevant teams will be notified.

If you wish to, you can add reviewers by using the "Reviewers" section on this page.

If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using @ followed by their GitHub username.

If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers.

If you have further questions, they may be answered by the LLVM GitHub User Guide.

You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums.

@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Nov 22, 2025
@llvmbot
Copy link
Member

llvmbot commented Nov 22, 2025

@llvm/pr-subscribers-libcxx

Author: Raman Shishniou (004helix)

Changes

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

Copy link
Contributor

@philnik777 philnik777 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@emaste @DimitryAndric is FreeBSD 12 still supported?

@004helix
Copy link
Author

According to web-site, FreeBSD 12+

https://libcxx.llvm.org/

@DimitryAndric
Copy link
Collaborator

FreeBSD 12 is no longer supported, so the version check is not strictly necessary. Can't hurt to let it in, though.

@philnik777
Copy link
Contributor

I'm tempted to reject this, since I'm really not interested in accumulating tech debt for a platform that's already EOL and has been for quite a while AFAICT. This change has been in trunk for almost a year at this point, so there doesn't seem to be much demand for supporting FreeBSD 12 either.

I'm not exactly psyched about the general non-existence of a support policy for different libcs/platforms, especially glibc. Requiring the FreeBSD version to not be EOL seems like a rather obvious policy to me, especially for an OS that's literally free. (I'm aware it's not always easy to upgrade, but that has to be done at some point, and I don't see much of a reason to drag libc++ into it)

IMO the most sensible thing here is to update our documentation to reflect what we actually test and support, i.e. FreeBSD 13.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants