From owner-freebsd-hackers@FreeBSD.ORG Thu Oct 11 12:11:31 2007 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 723BE16A468 for ; Thu, 11 Oct 2007 12:11:31 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id 3B91913C4CA for ; Thu, 11 Oct 2007 12:11:30 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (localhost [127.0.0.1]) by spam.des.no (Postfix) with ESMTP id 9C90A20BF; Thu, 11 Oct 2007 14:11:21 +0200 (CEST) X-Spam-Tests: AWL X-Spam-Learn: disabled X-Spam-Score: -0.0/3.0 X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) on tim.des.no Received: from ds4.des.no (des.no [80.203.243.180]) by smtp.des.no (Postfix) with ESMTP id 8F4C920BB; Thu, 11 Oct 2007 14:11:21 +0200 (CEST) Received: by ds4.des.no (Postfix, from userid 1001) id 760A08448F; Thu, 11 Oct 2007 14:11:21 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: m.jakeman@lancaster.ac.uk References: <200710111156.38525.m.jakeman@lancaster.ac.uk> Date: Thu, 11 Oct 2007 14:11:21 +0200 In-Reply-To: <200710111156.38525.m.jakeman@lancaster.ac.uk> (Matthew Jakeman's message of "Thu\, 11 Oct 2007 11\:56\:38 +0100") Message-ID: <86ejg14zrq.fsf@ds4.des.no> User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.1 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: hackers@freebsd.org Subject: Re: Sysctl Naming 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: Thu, 11 Oct 2007 12:11:31 -0000 Matthew Jakeman writes: > I am wanting to create a number of sysctl variables at kernel boot > time, 1 for each network interface. I have the code set up to loop > through the interfaces using ifnet_byindex() already for other > purposes so wanted to create them in this loop. > > The problem I'm having is naming them, using the SYSCTL_INT() macro as > specified : > > SYSCTL_INT(parent, nbr, name, access, ptr, val, descr); > > The 'name' parameter is what I wish to manipulate in the loop to > append the interface name on to the sysctl variable created however I > can't think of a way to do this. If there is another way to accomplish > this I would be grateful to hear any suggestions. This is the wrong approach, simply create a node with a fixed name in each device's private sysctl tree. See for instance how the coretemp driver in CURRENT inserts a node into each CPU device's sysctl tree. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no