Date: Tue, 5 Feb 2002 12:13:45 -0800 From: "Crist J. Clark" <cristjc@earthlink.net> To: "M. Warner Losh" <imp@village.org> Cc: mike@FreeBSD.ORG, freebsd-arch@FreeBSD.ORG Subject: Re: Setting sysctl(8)'s in rc.conf Message-ID: <20020205121345.B368@gohan.cjclark.org> In-Reply-To: <20020205.085412.88169750.imp@village.org>; from imp@village.org on Tue, Feb 05, 2002 at 08:54:12AM -0700 References: <20020204145021.B3722@gohan.cjclark.org> <20020205015412.H6496@espresso.q9media.com> <20020205.085412.88169750.imp@village.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020205121345.B368>