From nobody Tue Nov 28 17:16:08 2023 X-Original-To: dev-commits-src-main@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 4SfpyJ5wFxz52FtW; Tue, 28 Nov 2023 17:16:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (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-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SfpyJ57hjz3csd; Tue, 28 Nov 2023 17:16:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1701191768; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Go5/drCY459uzafBMgbQCpjs3bhV1472OS67ijxj57A=; b=Htq/Ry7cQK+dnmmITzJfzCl2ZSuTWMuHLzuXHKEyxwtqnH19RBqjDD6S473ZaQwSAN0Qvs BFAm2gb1hiIRH/5MsPEt2VkerNdhzexC85sECVUl3nC5A3GOHJR5NcSamFIxpO2yCuGGCL PPaDhgfcd1voeHCCscCShevWcPebQiUfP66BjVAB/gHdAQTHv7Kh5KS7ndLHua9MRwRDbt No7McZh3wa0vpRnRNCBIAm6ZGAicRq7NjEHSTNqyVxQaUR3zxCTxr9LCLSyWUCQqHt7SEG MTq5hKmWMp/jPnEssPvTvik11HmNORAzADBmie0KOO6inEPq0QEBfXtOuNBCqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1701191768; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Go5/drCY459uzafBMgbQCpjs3bhV1472OS67ijxj57A=; b=VJow6Mkh1oX4MpZfIYTemN+JMLeZd/aEZTYou9l+hWnkkJP2bkIrwyULVQjxrobwzU/L25 Ng7aL8oFFnLg6PzLJEBFelrEq9lVMeZa6GTngEfhMqKEMOyirGdeQ1nsF1DWT0GvJXsIUx 3iQVmiPZDy5NFkYtbzqPiuceB7dQF7b/JZQCCu+nrFke1i1HKldVCWCvgpIhESVr3TksJL vLgIRv5yGVOj7uBbqtWr5jQhZCYQF8d6KKtfeox1aQxJmyWSBDuU2mUEjQsiwNkBWoKztV mH12FEnC9lIiNlSpNzC1+hTu4yjcpvcgtN5f2rWKHrvRV55Pv1AXZZ1wfPW5BQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1701191768; a=rsa-sha256; cv=none; b=SwmWYfUWcC8fkhXP8yp+VkLL1ukOdPKLO4q+ALo4n0M4dNrp65BM4jNjJ1g58xKgzcxulG A+S2eZAHoNum20RlqlNd7nX6mNGHn53o3ehzjYkz2h5k80P0DbZHvq08r72LstezqvS/SA evS3AQJNUXMHFnCOSEh/JaFjcVfEN5S90ZVsnHZNByPUsMyPFSijfwWX92xdiOJwni5UD8 qzS0U/XKmLQ1KvAdPv9TlcHpZWf4/xbLLMBJpEZDm7NPrhhDsVhRRAtdpj1G/NX873SeLg Ta81NikVFP+zBxQRlfyndYj1cDU6fAQ+WOgCoWAq9XarQYnstYoMU7Qv6vva9g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4SfpyJ46klzWG4; Tue, 28 Nov 2023 17:16:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3ASHG8Fb095279; Tue, 28 Nov 2023 17:16:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3ASHG8eR095276; Tue, 28 Nov 2023 17:16:08 GMT (envelope-from git) Date: Tue, 28 Nov 2023 17:16:08 GMT Message-Id: <202311281716.3ASHG8eR095276@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Brooks Davis Subject: git: df65c89375e2 - main - getpagesizes(3): drop support for kernels before 9.0 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: brooks X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: df65c89375e242bf53e6c5b7614ab898104f71b7 Auto-Submitted: auto-generated The branch main has been updated by brooks: URL: https://cgit.FreeBSD.org/src/commit/?id=df65c89375e242bf53e6c5b7614ab898104f71b7 commit df65c89375e242bf53e6c5b7614ab898104f71b7 Author: Brooks Davis AuthorDate: 2023-11-27 17:06:01 +0000 Commit: Brooks Davis CommitDate: 2023-11-28 17:09:26 +0000 getpagesizes(3): drop support for kernels before 9.0 AT_PAGESIZES and elf_aux_info where added prior to FreeBSD 9.0 in commit ee235befcb8253fab9beea27b916f1bc46b33147. It's safe to say that a FreeBSD 15 libc won't work on a 8.x kernel so drop sysctl fallback. Reviewed by: kevans, imp, emaste Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D42707 --- lib/libc/gen/getpagesizes.c | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/lib/libc/gen/getpagesizes.c b/lib/libc/gen/getpagesizes.c index c9f7f2f29e16..7f481f84177a 100644 --- a/lib/libc/gen/getpagesizes.c +++ b/lib/libc/gen/getpagesizes.c @@ -27,11 +27,8 @@ */ #include -#include -#include - -#include -#include +#include +#include #include "libc_private.h" @@ -52,24 +49,18 @@ getpagesizes(size_t pagesize[], int nelem) { static u_long ps[MAXPAGESIZES]; static int nops; - size_t size; - int error, i; + int i; if (nelem < 0 || (nelem > 0 && pagesize == NULL)) { errno = EINVAL; return (-1); } - /* Cache the result of the sysctl(2). */ + /* Cache the result */ if (nops == 0) { - error = _elf_aux_info(AT_PAGESIZES, ps, sizeof(ps)); - size = sizeof(ps); - if (error != 0 || ps[0] == 0) { - if (sysctlbyname("hw.pagesizes", ps, &size, NULL, 0) - == -1) - return (-1); - } + if (_elf_aux_info(AT_PAGESIZES, ps, sizeof(ps)) != 0) + ps[0] = PAGE_SIZE; /* Count the number of page sizes that are supported. */ - nops = size / sizeof(ps[0]); + nops = nitems(ps); while (nops > 0 && ps[nops - 1] == 0) nops--; }