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 879893854160 for ; Fri, 30 Jun 2023 08:15:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 879893854160 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=1688112901; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=U9SXZ41nWzXYQGojwHmeXRkIbNNW8TxZ3Dh//tfb044=; b=aWiQNN51xTbzI9KKMxf74Ltgc/BixY3oZq0dAMS2K+jP49UM0rNFGPdkok6c3bta+3LPdZ Jf7sDJm/7YNgAKcjMOdDS9GxVgk9tsthaQ8cLrmjT0jhia9l5qZojyz1HsmfVvHd9RfLQ+ VOb2pfKMboXuDGZD+179uyENC6NAbOE= 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-635-tqkj7cTrPq-pSdSS5z5hzA-1; Fri, 30 Jun 2023 04:14:57 -0400 X-MC-Unique: tqkj7cTrPq-pSdSS5z5hzA-1 Received: by mail-lj1-f198.google.com with SMTP id 38308e7fff4ca-2b69ab85db1so14673661fa.2 for ; Fri, 30 Jun 2023 01:14:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688112896; x=1690704896; h=content-transfer-encoding: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=U9SXZ41nWzXYQGojwHmeXRkIbNNW8TxZ3Dh//tfb044=; b=E8hrU8dIlMcQtCVf0sARBiD3e/p9PuzUYcN2ssFO1B7ESh7l/IvC0xG+zv/e+Tom6Z kLeZVGVbvQVJXxe6HBH9Tn3i8vxONhBdpUZL+1527NjCleKB25c1OGMPKJeZ3qrXgUve 3bOS32apLYKgS3bA4E9WCHwTAHhIW91GMLwBR0COfcmrbgIq3OPCiQGsC3XCwgRaFVIS K0j3cgkpbAzgkKS2NTLUE+WjQgiTQ9axA3csHgaBd2gOJX7CBAMkMbHAvhnV7KfZnM+L /q3M1d/ntAw83U6LUIP5OuIznozU8UMcdwFvrbhAapZOQBVoLl7LY5AVdtmlb1wlIxyp F3kg== X-Gm-Message-State: ABy/qLbXM0flbUYtS2jDa0ZklpwtIk+NQCIiL5DFsPjZfVQ6VNFhlTS8 rAmHbUoiY6UHWzmrUio2taQmJ4KQVxUZBSWYmULA8Ir561CzTTBTtOboepTxyuiAJ1KW98sUttm /AhGs6XaQl2zxTYuxy03Z/8oVq3oIE4ZdUyIF X-Received: by 2002:a2e:9608:0:b0:2b6:a22b:42dc with SMTP id v8-20020a2e9608000000b002b6a22b42dcmr1249801ljh.16.1688112896205; Fri, 30 Jun 2023 01:14:56 -0700 (PDT) X-Google-Smtp-Source: APBJJlEDgdh/wR+7egI8OCeduQFdzU1TEphmhAoRE8SbDBChcmTlRGUN4CveKs787CTf44mTXZB0Waeq69cF8XjF1p4= X-Received: by 2002:a2e:9608:0:b0:2b6:a22b:42dc with SMTP id v8-20020a2e9608000000b002b6a22b42dcmr1249792ljh.16.1688112895945; Fri, 30 Jun 2023 01:14:55 -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: From: Jonathan Wakely Date: Fri, 30 Jun 2023 09:14:44 +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: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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,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: On Fri, 30 Jun 2023 at 09:02, Jonathan Wakely wrote: > > 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=3D64 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 g= et 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 jus= t a warning). > > People miss footnotes. I would really prefer if the signature shown in th= e 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. Apologies for sending the mail above as HTML - replying as text/plain for those it didn't reach.