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.129.124]) by sourceware.org (Postfix) with ESMTPS id 5C0B33856DE7 for ; Fri, 30 Jun 2023 08:02:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5C0B33856DE7 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=1688112151; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=rNSnjrIDbm6AOV3jeiylUVOUdmdeHjIY8XS75UaagZc=; b=YyNV1M2eBO+eHYi3mCr0EM9naobst7m+9806yln/F4/K4JVV6ab8WLSi5I5CfCFddk/uuC Q/NRFNPtiWWRUvjrZgcmyLAU57Cmjnrbe4W5K1tiqNYFASTXwsZYgKSglXEsfmmTK5GntM E1NVPj4S5y+HYgBahEiCb0SOzo2ih+A= Received: from mail-lj1-f198.google.com (mail-lj1-f198.google.com [209.85.208.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-101-lPgta4CVO4GmNMHEIesl7g-1; Fri, 30 Jun 2023 04:02:30 -0400 X-MC-Unique: lPgta4CVO4GmNMHEIesl7g-1 Received: by mail-lj1-f198.google.com with SMTP id 38308e7fff4ca-2b6af6868baso14439581fa.2 for ; Fri, 30 Jun 2023 01:02:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688112148; x=1690704148; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=rNSnjrIDbm6AOV3jeiylUVOUdmdeHjIY8XS75UaagZc=; b=WliyovAdeWdgItdXAJ1xOk9yu6pNquRROA/Lljvtd1y4SgISOiDwnkgIF4iUWPIZpu o908liz4nAllqgMxzRD7mNGrmWDYqXcxDwzt1RUBDIjI2wHmzft9DCKxJYopNvDITcxT bfWONmOvTuJPZLFmOO7wUerYsrdGa74c8XU1Of2sHzjs6Fsu4O9HsQk1t7CNQLhNqmmF 6n+NQHYs9RGctzPqiYatLCmLfwE2Ht+Ad1bq4WlzouH3IEW66U6fgOD4SGJSD8NkrWHq ZV35KBPE9NKtFdD0aGs0LP5WgQbHI8cKHrfHCS0aE/fel9uXmXNIGA/08OCUXPIdLjIk tuiw== X-Gm-Message-State: ABy/qLZ6idYr/Jm0dlK9Y2oUVTLkOCXqi1kUGoXYwzfQD0lB5giLp+eu 7+WPLeSW7AzqLm3v4EZwsZ00kQim+RQDi0h8DHUwukt25ISAKtSpHKxHrOVwoO2ABTempyX95J6 9a5Lavsr2zmPvcCyjkxGl/OUSQcXlXolSihOT X-Received: by 2002:a2e:9599:0:b0:2b6:a841:e686 with SMTP id w25-20020a2e9599000000b002b6a841e686mr1543298ljh.6.1688112148717; Fri, 30 Jun 2023 01:02:28 -0700 (PDT) X-Google-Smtp-Source: APBJJlHhVm34v0fu3sGbA5ZiiKxqDjRFpPP7/SRf0tnasF/NJHkPscrID8MolJJW9Rv68Y69ZwyYpvw0h1rFBBSUDKk= X-Received: by 2002:a2e:9599:0:b0:2b6:a841:e686 with SMTP id w25-20020a2e9599000000b002b6a841e686mr1543287ljh.6.1688112148436; Fri, 30 Jun 2023 01:02:28 -0700 (PDT) MIME-Version: 1.0 References: <20230628175329.GA16113@brightrain.aerifal.cx> <20230628191525.GS20050@brightrain.aerifal.cx> <8e65a459-a933-38b4-5f82-f7016c107d91@cs.ucla.edu> In-Reply-To: <8e65a459-a933-38b4-5f82-f7016c107d91@cs.ucla.edu> From: Jonathan Wakely Date: Fri, 30 Jun 2023 09:02:17 +0100 Message-ID: Subject: Re: [libc-coord] Re: regression in man pages for interfaces using loff_t To: libc-coord@lists.openwall.com Cc: Rich Felker , linux-man@vger.kernel.org, musl@lists.openwall.com, libc-alpha@sourceware.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/alternative; boundary="000000000000f2efdf05ff543cf3" X-Spam-Status: No, score=-6.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,HTML_MESSAGE,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: --000000000000f2efdf05ff543cf3 Content-Type: text/plain; charset="UTF-8" On Fri, 30 Jun 2023 at 08:11, Paul Eggert wrote: > On 2023-06-28 12:15, Rich Felker wrote: > > > There's also the problem that off64_t is "exactly 64-bit" which makes > > it unsuitable as an interface type for cross-platform functions where > > one could imagine the native type being larger (rather horrifying but > > possible). > > Although we won't have files with 2**63 bytes any time soon, this is the > best argument for preferring "loff_t" to "off64_t". > > But come to think of it, it'd be better to document the type simply as > "off_t", with a footnote saying the equivalent of "this assumes that on > 32-bit glibc platforms you compile with -DFILE_OFFSET_BITS=64 like any > sane person would." The intent really is off_t here, and that will > remain true even if off_t ever widens past 64 bits. > > All the apps I know that use the syscalls in question simply pass > values that fit in off_t to these functions, and this will work > regardless of whether these apps are compiled with 64- or (horrors!) > 32-bit off_t. Admittedly the footnote solution would not be perfect, but > it's good enough, and it would sidestep the loff_t vs off64_t confusion. > For APIs like copy_file_range(2) and splice(2) the arguments are loff_t* so you can't just "pass arguments that fit in off_t" to them. You have to get the pointer type correct, because writing 64-bits through a 32-bit off_t would be bad. And in C++ it won't even compile unless you get the pointer types exactly right (C compilers will typically allow the mismatch with just a warning). People miss footnotes. I would really prefer if the signature shown in the man page used a type that will actually compile. If it shows off_t, that won't compile for 32-bit systems without LFS support enabled. --000000000000f2efdf05ff543cf3--