From owner-freebsd-arch@FreeBSD.ORG Wed Jan 9 22:00:43 2008 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E720C16A41A for ; Wed, 9 Jan 2008 22:00:43 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from speedfactory.net (mail.speedfactory.net [66.23.216.219]) by mx1.freebsd.org (Postfix) with ESMTP id 9A80613C459 for ; Wed, 9 Jan 2008 22:00:43 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (unverified [66.23.211.162]) by speedfactory.net (SurgeMail 3.8q) with ESMTP id 227932122-1834499 for ; Wed, 09 Jan 2008 17:01:56 -0500 Received: from localhost.corp.yahoo.com (john@localhost [127.0.0.1]) (authenticated bits=0) by server.baldwin.cx (8.13.8/8.13.8) with ESMTP id m09M0VS5095474 for ; Wed, 9 Jan 2008 17:00:31 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: freebsd-arch@freebsd.org Date: Wed, 9 Jan 2008 17:00:37 -0500 User-Agent: KMail/1.9.6 References: <200712271704.44796.jhb@FreeBSD.org> <200712281745.08144.jhb@freebsd.org> In-Reply-To: <200712281745.08144.jhb@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200801091700.37594.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [127.0.0.1]); Wed, 09 Jan 2008 17:00:31 -0500 (EST) X-Virus-Scanned: ClamAV 0.91.2/5459/Wed Jan 9 11:00:29 2008 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Subject: Re: kernel features MIB X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Jan 2008 22:00:44 -0000 On Friday 28 December 2007 05:45:07 pm John Baldwin wrote: > On Thursday 27 December 2007 05:04:44 pm John Baldwin wrote: > > At work we don't have a pretty API for this at all, but I'm thinking for > > FreeBSD we can do this: > > > > FEATURE(foo, "description of foo") > > > > which is a macro to create the 'kern.features.foo' node and set it to 1. Then > > we could have a routine in libc: > > > > int feature_present(const char *name); > > > > That returns a boolean to indicate if a given feature is present or not by > > invoking sysctlbyname(3), etc. > > > > Any objections to the idea? > > So here's a bikeshed question I have no idea for. Which header should > feature_present()'s prototype go in? I anticipate this routine being > used in libc itself, so I don't think it can go into libutil. I went with the _BSD_VISIBLE portion of since it is sort of similar to sysconf(3) which is also in that header and we already have several other prototypes in the _BSD_VISIBLE section. I think I still prefer feature_present(3) to adding new sysconf(3) constants as this is simpler to maintain (don't have to add a new constant that maps to a sysctl for each feature). Patch is at http://www.FreeBSD.org/~jhb/patches/feature_present.patch -- John Baldwin