Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/libraries/Native/Unix/System.Native/pal_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -1173,6 +1173,15 @@ int32_t SystemNative_CopyFile(intptr_t sourceFd, intptr_t destinationFd, int64_t
copied = ret == 0;
}
#endif

#if HAVE_FALLOCATE // Linux
if (sourceLength > 81920) // BufferSize used by CopyFile_ReadWrite (would require more than 1 sys-call)
Comment thread
adamsitnik marked this conversation as resolved.
Outdated
{
// try to pre-allocate disk space for large destination files
while ((ret = fallocate(outFd, FALLOC_FL_KEEP_SIZE, (off_t)0, (off_t)sourceLength)) == -1 && errno == EINTR);
}
#endif

#if HAVE_SENDFILE_4
// Try copying the data using sendfile.
if (!copied && sourceLength != 0)
Expand Down