Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 21 Nov 2021 23:28:47 +0200
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Warner Losh <imp@bsdimp.com>
Cc:        "freebsd-toolchain@FreeBSD.org" <freebsd-toolchain@freebsd.org>
Subject:   Re: How to enable BSD defined names / functions
Message-ID:  <YZq6D/S4uXP0R9zl@kib.kiev.ua>
In-Reply-To: <CANCZdfr=cW47BQQD6nwVkr8F7ZiEuDgA27t5fwOkjbNFz_4BsA@mail.gmail.com>
References:  <CANCZdfoLO6=A%2B1nm-eQvJCX4age2r0VU7CeiCL99mg6YvReEsQ@mail.gmail.com> <YZqy4A4CYYwOcmb1@kib.kiev.ua> <CANCZdfr=cW47BQQD6nwVkr8F7ZiEuDgA27t5fwOkjbNFz_4BsA@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Nov 21, 2021 at 02:18:10PM -0700, Warner Losh wrote:
> On Sun, Nov 21, 2021 at 1:58 PM Konstantin Belousov <kostikbel@gmail.com>
> wrote:
> 
> > On Sun, Nov 21, 2021 at 01:51:00PM -0700, Warner Losh wrote:
> > > There's rather a lot of software that defines _POSIX_C_SOURCE to some
> > value
> > > (usually 200809L for POSIX-1.2008), but also wants to use other things.
> > >
> > > One can generally work around this issue by defining __BSD_VISIBLE=1, but
> > > most other systems have something more specific. NetBSD has
> > _NETBSD_SOURCE.
> > > OpenBSD has _OPENBSD_SOURCE as well. There's also some expectation that
> > > _BSD_SOURCE can be defined, but none of the currently active BSDs has
> > that.
> > >
> > > It appears from casual inspection that _NETBSD_SOURCE=1 means
> > approximately
> > > the same as __BSD_VISIBLE=1 in FreeBSD.
> > >
> > > Would it make sense to add a _FREEBSD_SOURCE=1 case and have it include
> > > __BSD_VISIBLE=1 regardless  of what other macros (especially
> > > _POSIX_C_SOURCE) are defined to be a more regimented and defined way to
> > > expand the namespace when multiple namespaces are defined?
> >
> > Please note that _BSD_VISIBLE works by presence, and not by value.
> > Same as things like _GNU_SOURCE.
> >
> 
> This stuff is complicated, so I may have overlooked something. _GNU_SOURCE
> is indeed by presence. But I couldn't find any instances of _BSD_VISIBLE in
> the
> tree, just __BSD_VISIBLE where it's tested as simply '#if __BSD_VISIBLE'
> since it
> seems to be defined always. Have I overlooked something?
I mean __BSD_VISIBLE of course, sorry.  It is not user variable anyway.

> 
> 
> > Yes, it makes sense to have _FREEBSD_SOURCE symbol that would imply total
> > visibility and override any _POSIX_C_SOURCE.
> >
> 
> Great. I'll work up a patch.
> 
> Warner



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?YZq6D/S4uXP0R9zl>