From owner-freebsd-arch@FreeBSD.ORG Thu Dec 27 23:21:50 2007 Return-Path: Delivered-To: arch@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1149F16A419 for ; Thu, 27 Dec 2007 23:21:50 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from speedfactory.net (mail6.speedfactory.net [66.23.216.219]) by mx1.freebsd.org (Postfix) with ESMTP id C183113C43E for ; Thu, 27 Dec 2007 23:21:49 +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 226289009-1834499 for ; Thu, 27 Dec 2007 18:24:01 -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 lBRNLf8G054109 for ; Thu, 27 Dec 2007 18:21:43 -0500 (EST) (envelope-from jhb@FreeBSD.org) From: John Baldwin To: arch@FreeBSD.org Date: Thu, 27 Dec 2007 17:04:44 -0500 User-Agent: KMail/1.9.6 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200712271704.44796.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]); Thu, 27 Dec 2007 18:21:43 -0500 (EST) X-Virus-Scanned: ClamAV 0.91.2/5270/Thu Dec 27 12:48:18 2007 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 Cc: Subject: 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: Thu, 27 Dec 2007 23:21:50 -0000 One of the things we have at work is a kern.features sysctl MIB that contains nodes to indicate if a named feature is present. For example, on i386 we have kern.features.pae and we auto enable -DPAE for kernel modules if the currently running kernel is using PAE using that sysctl. One of the patches I want to commit soon is support for handling shm_open/shm_unlink directly in the kernel via swap-backed VM objects (the long-heralded memfd stuff). I would like to have the sysctl MIB so that libc's for older releases (e.g. libc.so.6) could use the syscalls if they are available so that shm segments are shared between compat apps (e.g. 4.x or 6.x) and up-to-date apps. 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? -- John Baldwin