Subject: Re: dynamic sysctl
To: Andrew Brown <atatat@atatdot.net>
From: Greg A. Woods <woods@weird.com>
List: tech-kern
Date: 11/14/2003 18:37:14
[ On Wednesday, November 12, 2003 at 22:39:10 (-0500), Andrew Brown wrote: ]
> Subject: dynamic sysctl
>
> at one point, i groveled through all the archives, scribbled down all
> the requirements people had for such a system, and either filed them
> away as "no...not doing that" (a small number of them) or as "okay,
> that part's done" (most of them), but i don't have that list any more.

One related userland issue from my own ToDo list:

- /sbin/sysctl should use strvis(VIS_WHITE) or similar make sure any
  strings it prints are in a guaranteed canonical printable form.  Of
  course it should also use strunvis() to allow the printable form to be
  used as "input" for -w too.

Currently the major need for this is with hw.cnmagic.  The way
/etc/rc.d/sysctl reads /etc/sysctl.conf makes it impossible to use some
character sequences, and for those that do work having raw escape
sequences in /etc/sysctl.conf is rather in-elegant to say the least.

For example since the serial console on my AS4000 seems to ignore a
BREAK signal, at least for the purposes of telling the kernel to drop
into DDB, I decided to use a similar escape sequence for hw.cnmagic to
the one used to get the attention of its console monitor processor
("^]^]rcm").  Luckily this particular sequence works in /etc/sysctl.conf
without need for quoting magic or other fancy tricks, but it still looks
ugly (or is invisible) in any editor and the true value is hidden from
view when displayed (and luckily the console monitor processor is smart
enough to ignore output from the host console too else displaying the
value on the console would cause it to drop into DDB!  ;-):

# grep hw.cnmagic /etc/sysctl.conf | od -c 
0000000    h   w   .   c   n   m   a   g   i   c   = 035 035   d   d   b
0000020   \n                                                            
0000021
# sysctl hw.cnmagic         
hw.cnmagic = ddb
# sysctl hw.cnmagic | od -c 
0000000    h   w   .   c   n   m   a   g   i   c       =     035 035   d
0000020    d   b  \n                                                    
0000023


-- 
						Greg A. Woods

+1 416 218-0098                  VE3TCP            RoboHack <woods@robohack.ca>
Planix, Inc. <woods@planix.com>          Secrets of the Weird <woods@weird.com>