From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id A1E0C3858D35; Thu, 29 Jun 2023 15:19:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A1E0C3858D35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1688051954; bh=jhjdm2xH+5qRtECdSy8tddWxY72FO0JPgzsyxRyKsTo=; h=From:To:Subject:Date:From; b=O8ZW7KR9w+LyWebm//wjTQ4FVQiliyTO5Yu7BQNWAiYBF/1OVfYMaHtWOkYpfRZ/f 6B35DuLlB9+4hiU6J/DSRroEy1E06syXxv9PTDZ43LCvWXnubTMi5ZJ/7j5evsy3vq P6X4YABeTLmK9tu5moOLSLKYqC/rnsx0jg7LsPNI= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jonathan Wakely To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r14-2191] libstdc++: Do not use off64_t in calls to copy_file_range [PR110462] X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/master X-Git-Oldrev: e972bdce61cc5213a4b0309ef88fb611617843dc X-Git-Newrev: ff29ee6af88f709e08ee467869d8c1b13889a724 Message-Id: <20230629151914.A1E0C3858D35@sourceware.org> Date: Thu, 29 Jun 2023 15:19:14 +0000 (GMT) List-Id: https://gcc.gnu.org/g:ff29ee6af88f709e08ee467869d8c1b13889a724 commit r14-2191-gff29ee6af88f709e08ee467869d8c1b13889a724 Author: Jonathan Wakely Date: Wed Jun 28 19:10:29 2023 +0100 libstdc++: Do not use off64_t in calls to copy_file_range [PR110462] Although the copy_file_range(2) man page shows the arguments as off64_t* that is not portable. For musl there is no off64_t type, as off_t is always 64-bit. Use the loff_t type which is always 64-bit even if off_t isn't. We could just use off_t because the filesystem library is compiled with _FILE_OFFSET_BITS=64, but loff_t is the more correct type for this interface. libstdc++-v3/ChangeLog: PR libstdc++/110462 * acinclude.m4 (GLIBCXX_CHECK_FILESYSTEM_DEPS): Check that copy_file_range can be called with loff_t* arguments. * configure: Regenerate. * src/filesystem/ops-common.h (copy_file_copy_file_range): Use loff_t for offsets. Diff: --- libstdc++-v3/acinclude.m4 | 2 +- libstdc++-v3/configure | 4 ++-- libstdc++-v3/src/filesystem/ops-common.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 index efc27aa493e..277ae10e031 100644 --- a/libstdc++-v3/acinclude.m4 +++ b/libstdc++-v3/acinclude.m4 @@ -5160,7 +5160,7 @@ dnl linux*) GCC_TRY_COMPILE_OR_LINK( [#include ], - [copy_file_range(1, nullptr, 2, nullptr, 1, 0);], + [copy_file_range(1, (loff_t*)nullptr, 2, (loff_t*)nullptr, 1, 0);], [glibcxx_cv_copy_file_range=yes], [glibcxx_cv_copy_file_range=no]) ;; diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure index bda8053ecc2..98568ae0c30 100755 --- a/libstdc++-v3/configure +++ b/libstdc++-v3/configure @@ -72473,7 +72473,7 @@ else int main () { -copy_file_range(1, nullptr, 2, nullptr, 1, 0); +copy_file_range(1, (loff_t*)nullptr, 2, (loff_t*)nullptr, 1, 0); ; return 0; } @@ -72494,7 +72494,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext int main () { -copy_file_range(1, nullptr, 2, nullptr, 1, 0); +copy_file_range(1, (loff_t*)nullptr, 2, (loff_t*)nullptr, 1, 0); ; return 0; } diff --git a/libstdc++-v3/src/filesystem/ops-common.h b/libstdc++-v3/src/filesystem/ops-common.h index f04bbc66d7d..2e4331bb682 100644 --- a/libstdc++-v3/src/filesystem/ops-common.h +++ b/libstdc++-v3/src/filesystem/ops-common.h @@ -374,7 +374,7 @@ _GLIBCXX_BEGIN_NAMESPACE_FILESYSTEM return false; } size_t bytes_left = length; - off64_t off_in = 0, off_out = 0; + loff_t off_in = 0, off_out = 0; ssize_t bytes_copied; do {