From owner-freebsd-hackers Wed Jan 3 03:32:06 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id DAA01078 for hackers-outgoing; Wed, 3 Jan 1996 03:32:06 -0800 (PST) Received: from tfs.com (tfs.com [140.145.250.1]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id DAA01046 for ; Wed, 3 Jan 1996 03:32:02 -0800 (PST) Received: from critter.tfs.com by tfs.com (smail3.1.28.1) with SMTP id m0tXRQ6-0003vlC; Wed, 3 Jan 96 03:31 PST Received: from localhost.tfs.com (localhost.tfs.com [127.0.0.1]) by critter.tfs.com (8.6.12/8.6.12) with SMTP id MAA01130; Wed, 3 Jan 1996 12:31:49 +0100 X-Authentication-Warning: critter.tfs.com: Host localhost.tfs.com didn't use HELO protocol To: Michael Smith cc: nox@jelal.hb.north.de, bde@zeta.org.au, hackers@freebsd.org Subject: Re: boot from sd1? In-reply-to: Your message of "Wed, 03 Jan 1996 21:53:15 +1030." <199601031123.VAA07492@genesis.atrad.adelaide.edu.au> Date: Wed, 03 Jan 1996 12:31:48 +0100 Message-ID: <1128.820668708@critter.tfs.com> From: Poul-Henning Kamp Sender: owner-hackers@freebsd.org Precedence: bulk > 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.