From owner-freebsd-hackers@FreeBSD.ORG Tue Jun 26 00:03:59 2012 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6536A106566C; Tue, 26 Jun 2012 00:03:59 +0000 (UTC) (envelope-from lacombar@gmail.com) Received: from mail-wi0-f178.google.com (mail-wi0-f178.google.com [209.85.212.178]) by mx1.freebsd.org (Postfix) with ESMTP id 5BBFE8FC15; Tue, 26 Jun 2012 00:03:55 +0000 (UTC) Received: by wibhr14 with SMTP id hr14so1348554wib.13 for ; Mon, 25 Jun 2012 17:03:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:cc:content-type; bh=nsPADtjgVm4Fw31DHzhjPLpVSGWGUh6cMauzgwvGaak=; b=ZDOnXtVUzBKOtkSR/+2250cXvpR/TdL6OtZ3G0XoJc+9Y56g5mcI5sQbZbM+3gVxgu Nlz24O9zx8GL7Qy7pZggXlBz5vK+StgRg9f5xyGdGlpboA8Zw/Rm7Y687J5OR0FBVgRK 31O/NVVtq/f8ivhOwvon5+Zis6M2yCvSS8NUuFPg2kDm9aAvvVlJbyhCD9WY7VSxaBdb l5hpPmC2pa2e9nc7dtH6agxXpXYFn/gQsexiWQ4hdd7aTSgh2d2jMaKJ4HdGzl6sIaS+ KSGV5wteWgpS7x6CuJpUFpcDz3OX0z00O29zAmdvv009E7jVJRX3fynSTfmBGB4h6zAx PtTA== MIME-Version: 1.0 Received: by 10.216.196.166 with SMTP id r38mr6526517wen.161.1340669034277; Mon, 25 Jun 2012 17:03:54 -0700 (PDT) Received: by 10.216.214.101 with HTTP; Mon, 25 Jun 2012 17:03:54 -0700 (PDT) Date: Mon, 25 Jun 2012 20:03:54 -0400 Message-ID: From: Arnaud Lacombe To: FreeBSD Current , FreeBSD Hackers Content-Type: text/plain; charset=ISO-8859-1 Cc: bp@FreeBSD.org, kby@FreeBSD.org Subject: sysctl filesystem ? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jun 2012 00:03:59 -0000 Hi folks, I find myself in a situation where I need to directly explore the sysctl(8) tree from my program. The tricky part is this: from `src/sbin/sysctl.c': /* * These functions uses a presently undocumented interface to the kernel * to walk the tree and get the type so it can print the value. * This interface is under work and consideration, and should probably * be killed with a big axe by the first person who can find the time. * (be aware though, that the proper interface isn't as obvious as it * may seem, there are various conflicting requirements. */ AFAIT, the whole interface used by sysctl(8) to explore the sysctl tree (ie. list, name, get description) is undocumented. This comment has been there for about, well... 17 years. No matter to say that it is highly unlikely anyone is ever gonna design that perfect interface. Right now, I am left with no choice but to figure out how that stuff work, which I foresee will be a real PITA. No choice ? Well, not so much. About 12 years ago a filesystem interface was written for sysctl, namely scfs(4). It was authored by Kelly Yancey and (?) Boris Popov. Unfortunately, time passed and no code is any longer publicly available. URLs are either no longer valid or password-protected. This interface would just be perfect for my use-case. No need to spend time decoding a prehistoric interface, no need to craft custom accessors. I would just have to use standard POSIX file interface... if the code was available. I was hoping some of the people on this list would either, have the scfs(4) code on their drives/tapes, or have a way to contact the original author(s) and thus have a chance to get that code ? Thanks in advance, - Arnaud ps: I know the code will certainly have to be fixed, but that is still the best option I've got so far.