Skip to content

[libc++] fix largefile handling in fs::copy_file #121855

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 7, 2025

Conversation

Jannik2099
Copy link
Contributor

fix for #109211

@Jannik2099 Jannik2099 requested a review from a team as a code owner January 6, 2025 23:33
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Jan 6, 2025
@llvmbot
Copy link
Member

llvmbot commented Jan 6, 2025

@llvm/pr-subscribers-libcxx

Author: Jannik Glückert (Jannik2099)

Changes

fix for #109211


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

1 Files Affected:

  • (modified) libcxx/src/filesystem/operations.cpp (+6)
diff --git a/libcxx/src/filesystem/operations.cpp b/libcxx/src/filesystem/operations.cpp
index bd37c5af86f6c3..208a55723d8838 100644
--- a/libcxx/src/filesystem/operations.cpp
+++ b/libcxx/src/filesystem/operations.cpp
@@ -238,8 +238,14 @@ bool copy_file_impl_copy_file_range(FileDescriptor& read_fd, FileDescriptor& wri
     return false;
   }
   // do not modify the fd positions as copy_file_impl_sendfile may be called after a partial copy
+#  if defined(__linux__)
+  loff_t off_in  = 0;
+  loff_t off_out = 0;
+#  else
   off_t off_in  = 0;
   off_t off_out = 0;
+#  endif
+
   do {
     ssize_t res;
 

Copy link
Collaborator

@vitalybuka vitalybuka left a comment

Choose a reason for hiding this comment

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

Thanks, this fixed our build.

@ldionne ldionne merged commit faa3f75 into llvm:main Jan 7, 2025
63 of 66 checks passed
@thesamesam
Copy link
Member

The change is correct, but to add context in case anybody wonders in future: see https://inbox.sourceware.org/libc-alpha/[email protected]/ onwards.

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.

6 participants