tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: sysctl question

On Thu, Jun 19, 2008 at 07:58:22AM -0700, Paul Goyette wrote:
> As I indicated yesterday, I'm writing a device driver for on-DIMM memory 
> temp sensors (such as those on DDR2 FB-DIMM, some DDR2 SORDIMM, and all 
> DDR3).  The sensors have hardware limit registers for lower, upper, and 
> critical temp limits.
> sysmon_envsys(9) doesn't seem to provide a mechanism for the limits to be 
> set from userland, so I need some other way to get values into the 
> registers.  I've thought of three ways to do this:
>       1. Hardcode the limits in the driver, and don't provide any way
>          to change them.
>       2. Modify sysmon_envsys to add a new mechanism
>       3. Add a sysctl to the driver for specifying the limits
> #1 seems rather restrictive and makes it difficult to adjust the limits for 
> testing the driver.
> #2 is a whole lot more work than I'm ready to sign up for at this time!

I really thought 2 was possible through the envsysd config.  But maybe
I'm wrong...

> So that leaves #3.
> Adding the sysctl itself is relatively straightforward.  But there's a 
> catch!
> I need to use a sysctl helper function to validate the user-specified 
> value, and then stuff it into the device's registers.  The helper itself is 
> once again relatively straightforward, except that it needs to find the 
> dev_t->softc in order to update the hardware.
> Any suggestions on an acceptable mechanism for associating the sysctl node 
> with the device's dev_t ?

See for instance the handler in sys/net/if_tap.c.

Quentin Garnier - -
"See the look on my face from staying too long in one place
[...] every time the morning breaks I know I'm closer to falling"
KT Tunstall, Saving My Face, Drastic Fantastic, 2007.

Attachment: pgp5f0jQJDql3.pgp
Description: PGP signature

Home | Main Index | Thread Index | Old Index