RFC: Adding a hw.features[2] sysctl

Igor Mozolevsky igor at hybrid-lab.co.uk
Sun Jan 13 18:14:25 PST 2008


On 14/01/2008, Nathan Lay <nslay at comcast.net> wrote:
> Igor Mozolevsky wrote:
> > On 13/01/2008, Peter Jeremy <peterjeremy at optushome.com.au> wrote:
> >
> >
> >> IMHO, no.  Virtually all similar FreeBSD information is exported via
> >> sysctl and this sort of information fits neatly into the existing
> >> MIB tree as either dev.cpu.N.features or hw.cpu.features
> >>
> >
> > /dev/sndstat?
> >
> > If it's in /dev you can do neat tricks like ioctl-ing queries (like
> > ioctl(/dev/cpuinfo, CINFOCTL_HAS_FEATURES, CINFO_SSE3|CINFO_SSSE3))
> > instead of having *every* app parse the result of a sysctl; most of
> > the time you'd only want to check for specific feature , it's much
> > easier to do an ioctl that returns a boolean.
>
> Or perhaps, create an ioctl that returns a bitmask of all available CPU
> features.  This way, only one ioctl() call is necessary and allows
> programs to query any and all features in an inexpensive way.  Calling
> ioctl() for each feature query is comparably more expensive.

You won't you'd OR all of the features you want to check; but yes,
having a param that returns the whole lot would also be great, as well
as the driver returning human-readable representation if it was open
for writing... The idea is to allow the flexibility, so that the
programmers/users are free to choose what suits them, and not being
forced into having to do only one thing. :-)


Igor


More information about the freebsd-current mailing list