Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Jun 2020 22:57:51 +0200
From:      "Kristof Provost" <kp@FreeBSD.org>
To:        freebsd-testing@freebsd.org
Subject:   Querying kernel features
Message-ID:  <6C6C4F2B-CD11-4777-A97C-D249C514DEEA@FreeBSD.org>

next in thread | raw e-mail | index | archive | help
Say that I have a test for an optional kernel feature (say ALTQ, or 
TMPFS) is there an elegant way of figuring out at runtime if it’s 
available?

Doing `sysctl kern.conftxt | grep ALTQ` feels a little inelegant, and is 
begging for issues with incorrect matches.

I’m tempted to add a sysctl node for ALTQ, but perhaps there’s a 
better way. Or perhaps this should be a general feature (so we’d have 
nodes like kernel.feature.tmpfs=1).

Regards,
Kristof
From owner-freebsd-testing@freebsd.org  Thu Jun 18 23:19:54 2020
Return-Path: <owner-freebsd-testing@freebsd.org>
Delivered-To: freebsd-testing@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id BED99337A5A
 for <freebsd-testing@mailman.nyi.freebsd.org>;
 Thu, 18 Jun 2020 23:19:54 +0000 (UTC)
 (envelope-from jmg@gold.funkthat.com)
Received: from gold.funkthat.com (gate2.funkthat.com [208.87.223.18])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client CN "gate2.funkthat.com",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 49nyZd729Jz4Djq;
 Thu, 18 Jun 2020 23:19:53 +0000 (UTC)
 (envelope-from jmg@gold.funkthat.com)
Received: from gold.funkthat.com (localhost [127.0.0.1])
 by gold.funkthat.com (8.15.2/8.15.2) with ESMTPS id 05INJiLZ022569
 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO);
 Thu, 18 Jun 2020 16:19:45 -0700 (PDT)
 (envelope-from jmg@gold.funkthat.com)
Received: (from jmg@localhost)
 by gold.funkthat.com (8.15.2/8.15.2/Submit) id 05INJi1Z022568;
 Thu, 18 Jun 2020 16:19:44 -0700 (PDT) (envelope-from jmg)
Date: Thu, 18 Jun 2020 16:19:44 -0700
From: John-Mark Gurney <jmg@funkthat.com>
To: Kristof Provost <kp@FreeBSD.org>
Cc: freebsd-testing@freebsd.org
Subject: Re: Querying kernel features
Message-ID: <20200618231944.GB4213@funkthat.com>
References: <6C6C4F2B-CD11-4777-A97C-D249C514DEEA@FreeBSD.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <6C6C4F2B-CD11-4777-A97C-D249C514DEEA@FreeBSD.org>
X-Operating-System: FreeBSD 11.3-STABLE amd64
X-PGP-Fingerprint: D87A 235F FB71 1F3F 55B7  ED9B D5FF 5A51 C0AC 3D65
X-Files: The truth is out there
X-URL: https://www.funkthat.com/
X-Resume: https://www.funkthat.com/~jmg/resume.html
X-TipJar: bitcoin:13Qmb6AeTgQecazTWph4XasEsP7nGRbAPE
X-to-the-FBI-CIA-and-NSA: HI! HOW YA DOIN? can i haz chizburger?
User-Agent: Mutt/1.6.1 (2016-04-27)
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3
 (gold.funkthat.com [127.0.0.1]); Thu, 18 Jun 2020 16:19:45 -0700 (PDT)
X-Rspamd-Queue-Id: 49nyZd729Jz4Djq
X-Spamd-Bar: ----
Authentication-Results: mx1.freebsd.org;
	none
X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[];
 ASN(0.00)[asn:32354, ipnet:208.87.216.0/21, country:US]
X-BeenThere: freebsd-testing@freebsd.org
X-Mailman-Version: 2.1.33
Precedence: list
List-Id: Testing on FreeBSD <freebsd-testing.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/freebsd-testing>, 
 <mailto:freebsd-testing-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-testing/>;
List-Post: <mailto:freebsd-testing@freebsd.org>
List-Help: <mailto:freebsd-testing-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/freebsd-testing>, 
 <mailto:freebsd-testing-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 18 Jun 2020 23:19:54 -0000

Kristof Provost wrote this message on Thu, Jun 18, 2020 at 22:57 +0200:
> Say that I have a test for an optional kernel feature (say ALTQ, or 
> TMPFS) is there an elegant way of figuring out at runtime if it???s 
> available?
> 
> Doing `sysctl kern.conftxt | grep ALTQ` feels a little inelegant, and is 
> begging for issues with incorrect matches.
> 
> I???m tempted to add a sysctl node for ALTQ, but perhaps there???s a 
> better way. Or perhaps this should be a general feature (so we???d have 
> nodes like kernel.feature.tmpfs=1).

Look at kern.features...  There's a FEATURE macro to add entries to
that, but looks like there isn't any man page for it...

sys/geom/eli/g_eli.c:FEATURE(geom_eli, "GEOM crypto module");

-- 
  John-Mark Gurney				Voice: +1 415 225 5579

     "All that I will do, has been done, All that I have, has not."



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6C6C4F2B-CD11-4777-A97C-D249C514DEEA>