From owner-freebsd-arch Tue Feb 5 12:14:25 2002 Delivered-To: freebsd-arch@freebsd.org Received: from swan.prod.itd.earthlink.net (swan.mail.pas.earthlink.net [207.217.120.123]) by hub.freebsd.org (Postfix) with ESMTP id B663737B416; Tue, 5 Feb 2002 12:14:19 -0800 (PST) Received: from user-2ivfo5m.dialup.mindspring.com ([165.247.224.182] helo=gohan.cjclark.org) by swan.prod.itd.earthlink.net with esmtp (Exim 3.33 #1) id 16YByj-0001fn-00; Tue, 05 Feb 2002 12:14:11 -0800 Received: (from cjc@localhost) by gohan.cjclark.org (8.11.6/8.11.6) id g15KDlI01492; Tue, 5 Feb 2002 12:13:47 -0800 (PST) (envelope-from cjc) Date: Tue, 5 Feb 2002 12:13:45 -0800 From: "Crist J. Clark" To: "M. Warner Losh" Cc: mike@FreeBSD.ORG, freebsd-arch@FreeBSD.ORG Subject: Re: Setting sysctl(8)'s in rc.conf Message-ID: <20020205121345.B368@gohan.cjclark.org> Reply-To: cjclark@alum.mit.edu References: <20020204145021.B3722@gohan.cjclark.org> <20020205015412.H6496@espresso.q9media.com> <20020205.085412.88169750.imp@village.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20020205.085412.88169750.imp@village.org>; from imp@village.org on Tue, Feb 05, 2002 at 08:54:12AM -0700 X-URL: http://people.freebsd.org/~cjc/ Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Tue, Feb 05, 2002 at 08:54:12AM -0700, M. Warner Losh wrote: > We also need to fix setting sysctl variables late in the boot process, > maybe after modules have been loaded early in the process. I've > punted on doing this right becuase of the bikeshed around the name for > /etc/sysctl.conf's companion that would be done late in the process... Perhaps a better approach would be to put them all in /etc/sysctl.conf, but change /etc/sysctl.conf's format to support grouping different variables to be loaded at different times (maintaining back-compatibility of course). But deciding on a good way to do that might just be a bikeshed of another color. Here is just what comes to me as I write this. Each grouping in /etc/sysctl.conf is separated by a keyword followed by a token. Say, =Group Preload Where '=Group' is a keyword (start it with a non-alphanumeric so it is not likely to ever look like a real sysctl variable) and 'Preload' will be our token. Modify rc.sysctl to take an argument (you see it coming) which will be a token for a grouping. All of the sysctl variables from the specified group are loaded until we hit the next keyword-token line. Then one can just drop rc.sysctl calls into rc-scripts anywhere. After we kldload nfs (or whatever) we do, rc.sysctl nfs And the nfs sysctls, separated from the others by a '=Group nfs' in sysctl.conf, are loaded. Here's what rc.sysctl might look like to do this, if [ -f /etc/sysctl.conf ]; then if [ "$1" ]; then while read keyword token comments; do if [ "${keyword}" = '=Group' -a "${token}" = "$1" ] then break fi done fi while read var comments do case ${var} in \#*|'') ;; '=Group') exit 0 ;; *) sysctl ${var} ;; esac done fi < /etc/sysctl.conf -- Crist J. Clark | cjclark@alum.mit.edu | cjclark@jhu.edu http://people.freebsd.org/~cjc/ | cjc@freebsd.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message