From nobody Mon Sep 05 15:07:49 2022 X-Original-To: freebsd-current@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 4MLsMl134sz4cb7g for ; Mon, 5 Sep 2022 15:08:03 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-qv1-f51.google.com (mail-qv1-f51.google.com [209.85.219.51]) (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 4MLsMk01yTz3wF2; Mon, 5 Sep 2022 15:08:02 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-qv1-f51.google.com with SMTP id s13so3369982qvq.10; Mon, 05 Sep 2022 08:08:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=aSemKmkJaRJgYfMCH3v4toQkWwyqWpdJSoCS+EiVst4=; b=nbkavKKvzLqlBIA+atHVa2Ft/zGpTHsgx0zj+3fhxN4fivLNDao9JLEW1echc0mlV/ qJo01r+H+o4ymA56LSaehzymLj1qhfbzW0JrhvHqlMbb17WJrRvFny4u1VStRF03w2nx OeYLas8yHlcs8BfZrpRDRPSPpLgZVNiIe1W0dLuEJ9yQeSCKdFImouCOnMZ0FYMr/Rar pG5qZYadbIUvTYl2RiaFyBeQINJC9iT0apTMSo9SU/S5d77dLR8nwALYMu/skyZIiUiG 5O/eljO9dEK/Tju9XeY33seGj6U+3iQQYGAhyAKLMPovrKx/bhg1z/h6U68FREzOEch6 zZMw== X-Gm-Message-State: ACgBeo1gXFIjo3lW9fZkCOgEYUn5IijS340zzNsw+uRDHne5vbqz2qH6 HmDujFZVXAv6myQQ0dd9+WW64ivg7t5o75TfhVgTSlQpdho= X-Google-Smtp-Source: AA6agR68kdKY6hbPqeXdEKSL62Ti5DOiXfwALkxkdiuv4hDGeApTHG0f1VLabZPdYNd017UC0SiewoWKTJGJ7A9AreI= X-Received: by 2002:a05:6214:598c:b0:4a6:570d:9d20 with SMTP id ll12-20020a056214598c00b004a6570d9d20mr4235241qvb.94.1662390480243; Mon, 05 Sep 2022 08:08:00 -0700 (PDT) List-Id: Discussions about the use of FreeBSD-current List-Archive: https://lists.freebsd.org/archives/freebsd-current List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-current@freebsd.org MIME-Version: 1.0 References: In-Reply-To: From: Alan Somers Date: Mon, 5 Sep 2022 09:07:49 -0600 Message-ID: Subject: Re: Header symbols that shouldn't be visible to ports? To: Mark Johnston Cc: Konstantin Belousov , FreeBSD CURRENT Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4MLsMk01yTz3wF2 X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of asomers@gmail.com designates 209.85.219.51 as permitted sender) smtp.mailfrom=asomers@gmail.com X-Spamd-Result: default: False [-1.99 / 15.00]; SUBJECT_ENDS_QUESTION(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-0.996]; NEURAL_HAM_MEDIUM(-0.99)[-0.995]; FORGED_SENDER(0.30)[asomers@freebsd.org,asomers@gmail.com]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17:c]; MIME_GOOD(-0.10)[text/plain]; MLMMJ_DEST(0.00)[freebsd-current@freebsd.org]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.219.51:from]; R_DKIM_NA(0.00)[]; FROM_NEQ_ENVFROM(0.00)[asomers@freebsd.org,asomers@gmail.com]; RCVD_IN_DNSWL_NONE(0.00)[209.85.219.51:from]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; FREEFALL_USER(0.00)[asomers]; RCVD_COUNT_TWO(0.00)[2]; TO_DN_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCVD_TLS_LAST(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; DMARC_NA(0.00)[freebsd.org]; FREEMAIL_CC(0.00)[gmail.com,freebsd.org] X-ThisMailContainsUnwantedMimeParts: N On Mon, Sep 5, 2022 at 8:53 AM Mark Johnston wrote: > > On Mon, Sep 05, 2022 at 08:41:58AM -0600, Alan Somers wrote: > > On Sat, Sep 3, 2022 at 11:10 PM Konstantin Belousov wrote: > > > > > > On Sat, Sep 03, 2022 at 10:19:12AM -0600, Alan Somers wrote: > > > > Our /usr/include headers define a lot of symbols that are used by > > > > critical utilities in the base system like ps and ifconfig, but aren't > > > > stable across major releases. Since they aren't stable, utilities > > > > built for older releases won't run correctly on newer ones. Would it > > > > make sense to guard these symbols so they can't be used by programs in > > > > the ports tree? There is some precedent for that, for example > > > > _WANT_SOCKET and _WANT_MNTOPTNAMES. > > > _WANT_SOCKET is clearly about exposing parts of the kernel definitions > > > for userspace code that wants to dig into kernel structures. Similarly > > > for _WANT_MNTOPTNAMES, but in fact this thing is quite stable. The > > > definitions are guarded by additional defines not due to their instability, > > > but because using them in userspace requires (much) more preparation from > > > userspace environment, which is either not trivial (_WANT_SOCKET) or > > > contradicts to standartized use of the header (_WANT_MNTOPTNAMES + > > > sys/mount.h). > > > > > > > > > > > I'm particular, I'm thinking about symbols like the following: > > > > MINCORE_SUPER > > > Why this symbol should be hidden? It is implementation-defined and > > > intended to be exposed to userspace. All MINCORE_* not only MINCORE_SUPER > > > are under BSD_VISIBLE braces, because POSIX does not define the symbols. > > > > Because it isn't stable. It changed for example in rev 847ab36bf22 > > for 13.0. Programs using the older value (including virtually every > > Rust program) won't work on 13.0 and later. > > Why won't they work? Code that tests (vec[i] & MINCORE_SUPER) using the > old value will still give the same result when running on a newer > kernel, since MINCORE_PSIND(1) is 0x20, the old MINCORE_SUPER value. > This isn't to say that the change was perfectly backwards compatible, > but I haven't seen an example of code which was broken by the change. Well, from mincore(2): In particular, applications compiled using the old value of MINCORE_SUPER will not identify large pages with size index 2 as being large pages.