Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 03 Jan 1996 12:31:48 +0100
From:      Poul-Henning Kamp <phk@critter.tfs.com>
To:        Michael Smith <msmith@atrad.adelaide.edu.au>
Cc:        nox@jelal.hb.north.de, bde@zeta.org.au, hackers@freebsd.org
Subject:   Re: boot from sd1? 
Message-ID:  <1128.820668708@critter.tfs.com>
In-Reply-To: Your message of "Wed, 03 Jan 1996 21:53:15 %2B1030." <199601031123.VAA07492@genesis.atrad.adelaide.edu.au> 

next in thread | previous in thread | raw e-mail | index | archive | help
> Poul-Henning Kamp stands accused of saying:
> > 
> > > Heyy...  maybe this is a silly idea :)  but what about adding the
> > > root device to the list of things configurable with -c?  default (-1?)
> > > is whatever the boot code (bios) guessed like its now, if thats wrong
> > > (`cannot mount root') simply reboot with -c and tell the kernel where
> > > it really is.  then write this back in dset -q...
> > 
> > My plan was to get somebody to make a sysctl editor to go along with the
> > userconfig editor, and make it a sysctl variable :-)
> 
> Ok, so I should know better than to open my big mouth, but Poul, if you 
> can answer the following questions, I'll add sysctl variable support
> to userconfig() and visuserconfig() AQAP.
Gottcha!  :-)

> My -current system at work just got turned into a wordprocessor, so I
> be a week or so in doing it 8(
> 
> All of these are in the context of the userconfig() function:
> 
> 1) How do I obtain a list of all of the sysctl variables?

There are two ways you can do this:
	a) use the undocumented interface that sysctl(8) uses, which
	   is a special sysctl variable tree you read and it will
	   return "the next" variable.  I suggest you do this.
	   look at the sysctl(8) source for info.

	b) parse the actual data-structure.

> 2) How do I read the value of a sysctl variable?
Most of it is there, and I saw that peter fixed a bcopy botch in one
of the support functions so it should be workable.  Basically you
set up a data-structure and call a function.  Check sys/kern/kern_sysctl.c

> 3) How do I determine what is a safe value for a given sysctl variable?
Presently there is no way for this.  The idea was to add it to the 
"format" string in the description of the variables.  Presently we have
things like "I" for integer, but I expect to go to "I[0{10,20}1000]"
which would mean legal is [0..1000] sensible is [10..20].  Or something
like it.

> 4) How do I write the value of a sysctl variable?
As for reading.

> In the context of dset:
> 
> 1) How do I write the default value of a sysctl variable?
The default will be lost if you set it.  We don't store the default
as such, it's simply the value the variable have when we start.

Consider this for dset & friends:

	make a char foo[4096];
	fill it with command-line commands for userconfig/sysctledit
	instead of the groping around in data-structures we do now.
	dset would then only deal with this array.

	The advantage would be that you could pass a file to dset
	and tell it to stick that in the kernel, thus making the
	setup of many identical machines easier.  And even remote
	use of userconfig possible:
		dset -a "sysctl kern.foo.bar=1"
		reboot

> As far as answers are concerned, it's fair enough for you to say 
> "XXX does it in the same context, go look at that".

Well, if the above wasn't enough, send me more emails :-)

--
Poul-Henning Kamp           | phk@FreeBSD.ORG       FreeBSD Core-team.
http://www.freebsd.org/~phk | phk@login.dknet.dk    Private mailbox.
whois: [PHK]                | phk@ref.tfs.com       TRW Financial Systems, Inc.
Future will arrive by its own means, progress not so.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1128.820668708>