From nobody Sun Nov 21 21:28:47 2021 X-Original-To: freebsd-toolchain@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 1613618935D6 for ; Sun, 21 Nov 2021 21:28:57 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hy3S8359sz4W5k for ; Sun, 21 Nov 2021 21:28:56 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 1ALLSltI061382 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sun, 21 Nov 2021 23:28:50 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 1ALLSltI061382 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 1ALLSlPQ061381; Sun, 21 Nov 2021 23:28:47 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 21 Nov 2021 23:28:47 +0200 From: Konstantin Belousov To: Warner Losh Cc: "freebsd-toolchain@FreeBSD.org" Subject: Re: How to enable BSD defined names / functions Message-ID: References: List-Id: Maintenance of FreeBSD s integrated toolchain List-Archive: https://lists.freebsd.org/archives/freebsd-toolchain List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-toolchain@freebsd.org X-BeenThere: freebsd-toolchain@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.5 X-Spam-Checker-Version: SpamAssassin 3.4.5 (2021-03-20) on tom.home X-Rspamd-Queue-Id: 4Hy3S8359sz4W5k X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N On Sun, Nov 21, 2021 at 02:18:10PM -0700, Warner Losh wrote: > On Sun, Nov 21, 2021 at 1:58 PM Konstantin Belousov > 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