mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: John Scott <jscott@posteo.net>
Cc: musl@lists.openwall.com
Subject: Re: [musl] [PATCH] Expose the fopencookie() data types more generally
Date: Fri, 7 Apr 2023 20:49:55 -0400	[thread overview]
Message-ID: <20230408004954.GH4163@brightrain.aerifal.cx> (raw)
In-Reply-To: <0e96cffef26b0a5b689e6d316211829f6ed1a1cf.camel@posteo.net>

On Fri, Mar 31, 2023 at 12:35:36AM +0000, John Scott wrote:
> Hi,
> 
> We're allowed to expose these data types in POSIX-conforming
> applications since they're implementation-reserved, and I think it's
> a good idea. My use case is that I want to check for fopencookie()
> via dlsym() without defining _GNU_SOURCE, and having the definition
> of cookie_io_functions_t would be helpful for its usage.
> 
> You may pull the signed commit from https://git.sr.ht/~jscott/musl-libc or use the following patch
> 
> From f5f6db0d02db40dde067a3ad0a7fbd74f6019dd4 Mon Sep 17 00:00:00 2001
> From: John Scott <jscott@posteo.net>
> Date: Thu, 30 Mar 2023 20:26:13 -0400
> Subject: [PATCH] Expose the fopencookie() data types more generally
> 
> These data types end in _t and so can be exposed even when strict
> POSIX conformance is sought. This might be useful for an application
> that doesn't want other side effects of defining _GNU_SOURCE, but
> which still wants to use fopencookie().

While strictly speaking this is true, the "*_t is reserved" rule is
rather controversial, and probably not good to rely on without really
good reason. Even if you are dynamically binding to a symbol for
nonstandard functionality like this, you still should be explicitly
requesting that you want declarations for its
types/constants/whatever, or, in this case since the types are not
even opaque but explictly defined (and have to be, because you have to
be able to define functions with matching signatures), you can just
ignore the typedefs and write out the type to avoid depending on
declarations in the header.

Rich

      reply	other threads:[~2023-04-08  0:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-31  0:35 John Scott
2023-04-08  0:49 ` Rich Felker [this message]

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=20230408004954.GH4163@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=jscott@posteo.net \
    --cc=musl@lists.openwall.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).