1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00

io: Remove copy_file_range emulation [BZ #24744]

The kernel is evolving this interface (e.g., removal of the
restriction on cross-device copies), and keeping up with that
is difficult.  Applications which need the function should
run kernels which support the system call instead of relying on
the imperfect glibc emulation.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
This commit is contained in:
Florian Weimer
2019-06-28 09:39:21 +02:00
parent 1626f499d1
commit 5a659ccc0e
14 changed files with 81 additions and 783 deletions

View File

@ -20,27 +20,16 @@
#include <sysdep-cancel.h>
#include <unistd.h>
/* Include the fallback implementation. */
#ifndef __ASSUME_COPY_FILE_RANGE
#define COPY_FILE_RANGE_DECL static
#define COPY_FILE_RANGE copy_file_range_compat
#include <io/copy_file_range-compat.c>
#endif
ssize_t
copy_file_range (int infd, __off64_t *pinoff,
int outfd, __off64_t *poutoff,
size_t length, unsigned int flags)
{
#ifdef __NR_copy_file_range
ssize_t ret = SYSCALL_CANCEL (copy_file_range, infd, pinoff, outfd, poutoff,
length, flags);
# ifndef __ASSUME_COPY_FILE_RANGE
if (ret == -1 && errno == ENOSYS)
ret = copy_file_range_compat (infd, pinoff, outfd, poutoff, length, flags);
# endif
return ret;
#else /* !__NR_copy_file_range */
return copy_file_range_compat (infd, pinoff, outfd, poutoff, length, flags);
return SYSCALL_CANCEL (copy_file_range, infd, pinoff, outfd, poutoff,
length, flags);
#else
__set_errno (ENOSYS);
return -1;
#endif
}