mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Markus Wichmann <nullplan@gmx.net>
To: musl@lists.openwall.com
Cc: "Alex Bennée" <alex.bennee@linaro.org>,
	"Brian Cain" <quic_bcain@quicinc.com>
Subject: Re: [musl] _GNU_SOURCE and _LARGEFILE_SOURCE
Date: Wed, 18 Sep 2024 04:57:19 +0200	[thread overview]
Message-ID: <ZupBj3MNVGXWXZpV@voyager> (raw)
In-Reply-To: <5179cce6-b63b-4687-8f25-f02a5fd93679@quicinc.com>

Am Tue, Sep 17, 2024 at 07:29:17PM -0500 schrieb Brian Cain:
> In the "WHATSNEW" text, there's an item from 0.9.2 that states "- make
> _GNU_SOURCE imply _LARGEFILE64_SOURCE".  Is that intended to be the case
> generally?  I ask because in 25e6fee2 (remove LFS64 programming interfaces
> (macro-only) from _GNU_SOURCE, 2022-09-27) it stated "portable software
> should be prepared for them not to exist" and "the intent is that this be a
> very short-term measure and that the macros be removed entirely in the next
> release cycle."
>
> This comes up because in the QEMU project, there's a linux multiarch test
> case that uses readdir64 and it does define _GNU_SOURCE but does not define
> _LARGEFILE64_SOURCE and as such the cross compiler complains that there's no
> declaration of readdir64 before the call site.  I suppose that the test case
> would be more portable if it defined _LARGEFILE64_SOURCE.  But I'd also be
> happy to send a patch to musl that could have _GNU_SOURCE imply
> _LARGEFILE64_SOURCE (again?) if that's desired.  But - I gather that
> defining the macros is not what we want.  Instead of macros I should add
> declarations for readdir64() and its LFS64 friends, but only when
> _LARGEFILE64_SOURCE is defined?
>
> -Brian
>

The LFS64 interfaces are not in POSIX, so you cannot assume they exist.
Rather, you can test for their existance with a configure test, and if
it fails fall back to the portable interface. Or just use the portable
interface in the first place.

If you want to compile portable code on glibc, then define
_FILE_OFFSET_BITS to 64 and you get the exact same interface!

Ciao,
Markus

  reply	other threads:[~2024-09-18  2:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-18  0:29 Brian Cain
2024-09-18  2:57 ` Markus Wichmann [this message]
2024-09-18  5:06   ` Brian Cain
2024-09-18 14:24     ` Markus Wichmann
2024-09-19 18:30       ` Markus Wichmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZupBj3MNVGXWXZpV@voyager \
    --to=nullplan@gmx.net \
    --cc=alex.bennee@linaro.org \
    --cc=musl@lists.openwall.com \
    --cc=quic_bcain@quicinc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).