Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Jan 2008 23:38:25 -0500
From:      Nathan Lay <nslay@comcast.net>
To:        Igor Mozolevsky <igor@hybrid-lab.co.uk>
Cc:        current <current@freebsd.org>, freebsd-current@freebsd.org, Joe Marcus Clarke <marcus@freebsd.org>, Peter Jeremy <peterjeremy@optushome.com.au>, Kostik Belousov <kostikbel@gmail.com>
Subject:   Re: RFC: Adding a hw.features[2] sysctl
Message-ID:  <478AE741.1000105@comcast.net>
In-Reply-To: <a2b6592c0801131838jcde3634le6087d2f784adcbc@mail.gmail.com>
References:  <1200197787.67286.13.camel@shumai.marcuscom.com>	<20080113182457.GN929@server.vk2pj.dyndns.org>	<a2b6592c0801131721w25afae5bg3dcf6a90c1a3d2b7@mail.gmail.com>	<200801141254.20400.doconnor@gsoft.com.au> <a2b6592c0801131838jcde3634le6087d2f784adcbc@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Igor Mozolevsky wrote:
> On 14/01/2008, Daniel O'Connor <doconnor@gsoft.com.au> wrote:
>   
>> On Mon, 14 Jan 2008, Igor Mozolevsky wrote:
>>     
>>> On 13/01/2008, Peter Jeremy <peterjeremy@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?
>>>       
>> A single handy counter example to the many many that are sysctls :)
>>
>>     
>>> 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.
>>>       
>> Except you can't do that from a shell script.
>> (eg wrapper script to run optimised binaries)
>>     
>
> cat /dev/cpuinfo and parse away!
>
>
> Igor
> _______________________________________________
> freebsd-current@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-current
> To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
>
>   
I have to agree with Daniel here.  ioctl is probably inappropriate.  
sysctl is already intended for gathering or setting system information 
by both programs and/or people.  cat'ing /dev/cpuinfo sounds reminiscent 
to Linux /proc.

sysctl() could fill a cpu features bitmask for programs.
sysctl dev.cpu.features (or something like that) could output those 
features in human readable format.

Best Regards,
Nathan Lay




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