Porting OpenBSD's sysctl hw.sensors framework to FreeBSD (was: Re: PERFORCE change 123040 for review)

Alexander Leidinger Alexander at Leidinger.net
Sun Jul 8 08:05:13 UTC 2007


Quoting "Constantine A. Murenin" <cnst at FreeBSD.org> (Sat, 07 Jul 2007 21:43:47 -0400):

> On 07/07/2007 04:40, Andre Oppermann wrote:
> 
> > Rui Paulo wrote:
> > 
> >> Constantine A. Murenin wrote:
> >>
> >>> http://perforce.freebsd.org/chv.cgi?CH=123040
> >>>
> >>> Change 123040 by cnst at dale on 2007/07/06 23:45:36
> >>>
> >>>     add new node to sysctl.h:         HW_SENSORS / "hw.sensors"
> >>
> >>
> >> Hmm. I thought new sysctl nodes or leafs were dynamic and you needn't to
> >> add any entry to sysctl.h.
> > 
> > 
> > Yes, all new sysctl nodes and leaves should be entirely dynamic.
> > The (old) static ones should go away with 8.0 or so.  IIRC there
> > hasn't been any new static sysctl node since a loooong time.
> 
> I don't exactly consider April 2007 being a loooong time ago. ;)
> 
> So even first- and second-level nodes must be generated dynamically by 8.0?
> 
> Hardware sensors tree is going to be pretty deep down. Under sysctl(8) 
> the variable names will look like this:
> 
> 	hw.sensors.lm0.temp0
> 
> whereas in reality, the tree has five levels:
> 
> 	hw.sensors.lm0.temp.0
> 
> but as an exception to sysctl rule -- specifically for hw.sensors -- in 
> OpenBSD the last dot is ommitted from sysctl(8) presentation to the 
> user, to improve readability and preserve some sanity. :) I want to keep 

Have a look at the dev tree, we don't have this rule in FreeBSD:
---snip---
dev.xl.0.%desc: 3Com 3c905C-TX Fast Etherlink XL
dev.xl.0.%driver: xl
dev.xl.0.%location: slot=11 function=0
dev.xl.0.%pnpinfo: vendor=0x10b7 device=0x9200 subvendor=0x10b7
subdevice=0x1000 class=0x020000
dev.xl.0.%parent: pci0
dev.xl.1.%desc: 3Com 3c905C-TX Fast Etherlink XL
dev.xl.1.%driver: xl
dev.xl.1.%location: slot=12 function=0
dev.xl.1.%pnpinfo: vendor=0x10b7 device=0x9200 subvendor=0x10b7
subdevice=0x1000 class=0x020000
dev.xl.1.%parent: pci0
---snip---

> FreeBSD's sysctl hw.sensors tree compatible with the one in OpenBSD, so 
> that both sysctl(8) shell scripts and sysctl(3) C utilities will be 
> portable between the systems.

I let other people comment if the hw.sensors tree should be consistent
with the rest of the sysctl tree (personally I lean towards this, but
I'm not interested in a bikeshed discussion, I just want to point out
the current facts in FreeBSD) or compatible with OpenBSD (I don't moan
if this is the final result).

Bye,
Alexander.

-- 
Want to see how much virtual memory you're using? Just type "swapinfo" to
be shown information about the usage of your swap partitions.
http://www.Leidinger.net  Alexander @ Leidinger.net: PGP ID = B0063FE7
http://www.FreeBSD.org     netchild @ FreeBSD.org  : PGP ID = 72077137


More information about the freebsd-arch mailing list