diff options
author | Jannik Glückert <jannik.glueckert@gmail.com> | 2023-03-08 19:37:43 +0100 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2023-06-06 12:31:57 +0100 |
commit | d87caacf8e2df563afda85f3a5b7b852e08b6b2c (patch) | |
tree | 4191571e0d3db7dd3bc34d442c8737f4a40633b0 /libstdc++-v3/configure | |
parent | f80a8b42296265bb868a48592a2bd1fdaa2a3d8a (diff) | |
download | gcc-d87caacf8e2df563afda85f3a5b7b852e08b6b2c.zip gcc-d87caacf8e2df563afda85f3a5b7b852e08b6b2c.tar.gz gcc-d87caacf8e2df563afda85f3a5b7b852e08b6b2c.tar.bz2 |
libstdc++: Use copy_file_range for filesystem::copy_file
copy_file_range is a recent-ish syscall for copying files. It is similar
to sendfile but allows filesystem-specific optimizations. Common are:
Reflinks: BTRFS, XFS, ZFS (does not implement the syscall yet)
Server-side copy: NFS, SMB, Ceph
If copy_file_range is not available for the given files, fall back to
sendfile / userspace copy.
libstdc++-v3/ChangeLog:
* acinclude.m4 (_GLIBCXX_USE_COPY_FILE_RANGE): Define.
* config.h.in: Regenerate.
* configure: Regenerate.
* src/filesystem/ops-common.h (copy_file_copy_file_range):
Define new function.
(do_copy_file): Use it.
Signed-off-by: Jannik Glückert <jannik.glueckert@gmail.com>
Diffstat (limited to 'libstdc++-v3/configure')
-rwxr-xr-x | libstdc++-v3/configure | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure index 50a7c30..47db64f 100755 --- a/libstdc++-v3/configure +++ b/libstdc++-v3/configure @@ -71280,6 +71280,68 @@ $as_echo "$glibcxx_cv_truncate" >&6; } $as_echo "#define HAVE_TRUNCATE 1" >>confdefs.h fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for copy_file_range that can copy files" >&5 +$as_echo_n "checking for copy_file_range that can copy files... " >&6; } +if ${glibcxx_cv_copy_file_range+:} false; then : + $as_echo_n "(cached) " >&6 +else + case "${target_os}" in + linux*) + if test x$gcc_no_link = xyes; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <unistd.h> +int +main () +{ +copy_file_range(1, nullptr, 2, nullptr, 1, 0); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + glibcxx_cv_copy_file_range=yes +else + glibcxx_cv_copy_file_range=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +else + if test x$gcc_no_link = xyes; then + as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5 +fi +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <unistd.h> +int +main () +{ +copy_file_range(1, nullptr, 2, nullptr, 1, 0); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + glibcxx_cv_copy_file_range=yes +else + glibcxx_cv_copy_file_range=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + ;; + *) + glibcxx_cv_copy_file_range=no + ;; + esac + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_copy_file_range" >&5 +$as_echo "$glibcxx_cv_copy_file_range" >&6; } + if test $glibcxx_cv_copy_file_range = yes; then + +$as_echo "#define _GLIBCXX_USE_COPY_FILE_RANGE 1" >>confdefs.h + + fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sendfile that can copy files" >&5 $as_echo_n "checking for sendfile that can copy files... " >&6; } if ${glibcxx_cv_sendfile+:} false; then : |