From owner-freebsd-arch Tue Jan 16 17:29:20 2001 Delivered-To: freebsd-arch@freebsd.org Received: from fw.wintelcom.net (ns1.wintelcom.net [209.1.153.20]) by hub.freebsd.org (Postfix) with ESMTP id 3A6BF37B69F for ; Tue, 16 Jan 2001 17:29:01 -0800 (PST) Received: (from bright@localhost) by fw.wintelcom.net (8.10.0/8.10.0) id f0H1Sxx00994; Tue, 16 Jan 2001 17:28:59 -0800 (PST) Date: Tue, 16 Jan 2001 17:28:59 -0800 From: Alfred Perlstein To: Terry Lambert Cc: Kirk McKusick , arch@FreeBSD.ORG Subject: Re: dynamic vs static sysctls? Message-ID: <20010116172859.B7240@fw.wintelcom.net> References: <20010115223342.L7240@fw.wintelcom.net> <200101170125.SAA19549@usr08.primenet.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <200101170125.SAA19549@usr08.primenet.com>; from tlambert@primenet.com on Wed, Jan 17, 2001 at 01:25:43AM +0000 Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG * Terry Lambert [010116 17:25] wrote: > > I like this optimization, the only problem is that there's a chance > > that a dynamic sysctl may disapear out from under you, and even > > worse, replaced by an unrelated writeable one. > > > > Perhaps you should include a generation count within the sysctl to > > prevent this sort of potential problem? So besideds passing the > > sysctl number, you would include a generation count and error out > > if both numbers didn't match? > > Dynamically created OIDs should: > > 1) Monotonically increase They don't seem to, this is the main problem with doing any translation, it looks like: /* * If this oid has a number OID_AUTO, give it a number which * is greater than any current oid. Make sure it is at least * 100 to leave space for pre-assigned oid numbers. */ if (oidp->oid_number == OID_AUTO) { /* First, find the highest oid in the parent list >99 */ n = 99; SLIST_FOREACH(p, parent, oid_link) { if (p->oid_number > n) n = p->oid_number; } oidp->oid_number = n + 1; } Could cause some issues because it seems that if a sysctl were to "go away" the next one to apear under the same level will replace its number. > > 2) Be illegal to cache over reboots of course! > > 3) Reset on reboots ditto. -- -Alfred Perlstein - [bright@wintelcom.net|alfred@freebsd.org] "I have the heart of a child; I keep it in a jar on my desk." To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message