From nobody Sun Nov 21 21:18:10 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 94289188A7BC for ; Sun, 21 Nov 2021 21:18:27 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-ua1-x933.google.com (mail-ua1-x933.google.com [IPv6:2607:f8b0:4864:20::933]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hy3D33T73z3qHf for ; Sun, 21 Nov 2021 21:18:27 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-ua1-x933.google.com with SMTP id w23so32569334uao.5 for ; Sun, 21 Nov 2021 13:18:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=DrxUJkIhfTBB104zWLsliJ0rxHSw2XeTeSpZhgb8LK0=; b=CxnjpEKqBt+V6QmZdrXrkgkQV8vJqMVOQW0OeQNOsR2Uoc64jf+Wwj2bKcPS/SO0HB DnldT2psb5NlFMXWVzRucvi7DXmWO4zGenu397VGZP/5phXKWU8lomrqHFTyCNzbhMHB LlSyx8uLoucrJjTFF5n3z5Nh+AIZk2J/ms0bQCU0t+SR8100FAAnSI3bUpTnUQjgbGHR CduLQPM3cnyZ6k8XGEiB/GdQ7zgEN49coZLEylm+2DxdrGIEqKaLnsIpKRR89Mwy69rX SDCX7POMfFj5WxgKx+p8rp/nsPw/Q/t1oLN1OYDYB1tQIHq5d9L0H+klVtsGCOUWwlnj YuYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=DrxUJkIhfTBB104zWLsliJ0rxHSw2XeTeSpZhgb8LK0=; b=ttNSwuwfYLOmAducNCbN0MnKuQI8SBDAR3s3vvJCBlcshUhDwLRKYN/8tbHeI4wMKI FcZpBxni66Gm+xGnMPoi9/kfkfJboTI0UP3pUzIf1718fk4bnARoawVkYFuJWC9N5WQr bdXSA0pLpLz1HcLkHLHf+qJ0BWSXk2pA1DhmSg1LSTYjAasn0II8ok5jpbiXwFDaGEGT +Bxwu1HhFrNEGuuH4z4YLmLfebondfqOTK25u/oqAVl6l2JYFwF/IjEcb9/ztbcTO5je hNotiZEnlNpdpC7vOGTurA1ZxBqf4uNlWlwPQzYLzoameGDyO1R1qfPQNz6fNYkDrZf+ g9Uw== X-Gm-Message-State: AOAM5338soNllcoINh3MIunrjSd7CCvUiuU3BHTicd7IkeakmfDBRts5 5R1Al0yN9wjvRf1UhG8jKzEBll+k42AxSZpPx84LaeXg8cGfew== X-Google-Smtp-Source: ABdhPJyllIwodFzq9yrmSfE68NE+drJNR++pPToT3JhVP5ggzhpSeqWUjn6G7U/H98Gj74sxrbBHjkmSHhVnewv3a7g= X-Received: by 2002:a05:6102:d94:: with SMTP id d20mr125315079vst.12.1637529501509; Sun, 21 Nov 2021 13:18:21 -0800 (PST) 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 References: In-Reply-To: From: Warner Losh Date: Sun, 21 Nov 2021 14:18:10 -0700 Message-ID: Subject: Re: How to enable BSD defined names / functions To: Konstantin Belousov Cc: "freebsd-toolchain@FreeBSD.org" Content-Type: multipart/alternative; boundary="0000000000003f3d4105d1530c83" X-Rspamd-Queue-Id: 4Hy3D33T73z3qHf X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N --0000000000003f3d4105d1530c83 Content-Type: text/plain; charset="UTF-8" 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? > 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 --0000000000003f3d4105d1530c83--