From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id C41D13858D39 for ; Thu, 29 Jun 2023 15:24:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C41D13858D39 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1688052298; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OiBwvgxgsE72SQvY3O2AxuGd9XM6HKj2I7t9MMnUQts=; b=jFQ9eVvdUnwNT6cjK/mQvRFaPDRlXVN2ZE3JBAOE3rXRowEoXpWf6qsXC3cuZ/qhsnP1+P jMpypXesv22qICY9AVC5eXBWgJKueRyo7c5QXm9FYtlSnAfUHq9f4irg/y3EXH08PklcII 44k5yvfxDieVUHdd/FieTaZsu+sz108= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-460-h2OtR0hbN5-DmVdMgcZB_w-1; Thu, 29 Jun 2023 11:20:21 -0400 X-MC-Unique: h2OtR0hbN5-DmVdMgcZB_w-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7C74C801CF3; Thu, 29 Jun 2023 15:20:10 +0000 (UTC) Received: from localhost (unknown [10.42.28.110]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4651448FB01; Thu, 29 Jun 2023 15:20:10 +0000 (UTC) From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Do not use off64_t in calls to copy_file_range [PR110462] Date: Thu, 29 Jun 2023 16:19:15 +0100 Message-ID: <20230629152009.607619-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-13.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Tested x86_64-linux. Pushed to trunk. -- >8 -- 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. --- 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/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 { -- 2.41.0