From patchwork Thu Jun 29 15:19:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 114337 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp9720021vqr; Thu, 29 Jun 2023 08:26:26 -0700 (PDT) X-Google-Smtp-Source: APBJJlHVKlawJvRDHuPfBX9VLSJV6MdchWJNORHa1qYLv8LAmQwfM75eQgzjPK9M/8mO5PL92qLY X-Received: by 2002:a17:906:10dc:b0:992:2f67:cd34 with SMTP id v28-20020a17090610dc00b009922f67cd34mr311752ejv.22.1688052386737; Thu, 29 Jun 2023 08:26:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688052386; cv=none; d=google.com; s=arc-20160816; b=c2VOijMR3ZkLOZv/flJqTb2wiiT46p4lZZ7r0Jlv3zzqN5WWXi9AsdWcPb7H0pa6Wr DLv52HltjHuKdACHrszrdjoKng7dM5Nirz/yAAjHPwz/SQiFioUxJ4eXptv8PIFHYqXX eoj3w69l+n9Ayk7G4RxiM4lPKhXQLwO1Ip5zVzbim2wrgfIWegkgoIfPNSn06NFJIDl6 js/ZmxhPgyj8raa50ri2uGKpXISA3Eng77flxcrAuueFM2QQcYagr974x5CfDnbUYg3M mKGlXoyFp4PcWEl07/oS9vdV/2Hm8QI+SvH+2eeJXkgKTzGu8t22k915woUuoXF6pELN 34Qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:to :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=OiBwvgxgsE72SQvY3O2AxuGd9XM6HKj2I7t9MMnUQts=; fh=sJ+2/4g29YdyXkoRrFZSpsL2zxijepB7X/1rB0LDDh8=; b=vD/z8YVWvQDikjd/WzGN9XMBfrdwck9YOnXmfX0MghILrmxQv74HJQrG1/bITOT8uD jX31hVGD49syzgYGFTez94OSGh6hxsgB56/g97XsxvNR3nUMXvYt3Hw566HdI7f718rZ snoV+2X4kySB1wn+Qa/uXGuRNt4dUuiLLQEojyNWPRvWU9CcHsaRG2NUGjYS6Ef+Sw6j WKYmeLCzQqvMPEFsIC6zrBGgoyFerdwsNb5OJJA3MZ9prJnK0SGLj3UK5xXdU/5FfwG9 eKzlXB8a7grqS3NsI9LfLsVfg1t7Sze+OJUTXriPKxRTZm+u0ZT1uJxKupZ4uCOQC18X qy+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="S6w/lbeO"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id h18-20020a17090634d200b0099027b40d84si5849127ejb.133.2023.06.29.08.26.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Jun 2023 08:26:26 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="S6w/lbeO"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 24663385414C for ; Thu, 29 Jun 2023 15:25:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 24663385414C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1688052341; bh=OiBwvgxgsE72SQvY3O2AxuGd9XM6HKj2I7t9MMnUQts=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=S6w/lbeOmPnPO2fXu7YceBYhprI360PgDlCoEFBHrgPEKVWM5VLu+u4tGY3MG1wZG zwW9ri+UmEFCIW4pAysxNpPTLKEI6eIHWCP0Uq+AMwC/Wkk+VXSxPElGbaBrMvpt/n 5QialuwGyh1iKhcKRREqu9TgbpCbkLE31PAsVWwI= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org 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 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) 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 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jonathan Wakely via Gcc-patches From: Jonathan Wakely Reply-To: Jonathan Wakely Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770051219333751021?= X-GMAIL-MSGID: =?utf-8?q?1770051219333751021?= 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 {