Date: Tue, 15 Jan 2008 13:20:16 +0300 From: Stanislav Sedov <stas@FreeBSD.org> To: Jeremy Chadwick <koitsu@FreeBSD.org> Cc: freebsd-hackers@freebsd.org Subject: Re: Examples of sysctl/sysctlbyname/sysctlnametomib? Message-ID: <20080115102016.GJ22695@dracon.ht-systems.ru> In-Reply-To: <20080114132440.GA71321@eos.sc1.parodius.com> References: <20080114132440.GA71321@eos.sc1.parodius.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Jan 14, 2008 at 05:24:40AM -0800 Jeremy Chadwick mentioned:
>
> I'm attempting to retrieve the integer values for dev.cpu.X.temperature.
> For example, using sysctlbyname("dev.cpu.X.temperature") does work, but
> the results returned in *oldp don't match that of what sysctl(8) shows.
> This lead me to consider using sysctlnametomib("dev.cpu.X"), which also
> returns success, but from there I'm confused...
>
sysctl converts temperature values to Celsius or Farenheit according to
locale, e.g.:
printf("%.1fC", (mv - 2732.0) / 10);
When you retrive value using sysctlbyname, it's raw number, and it'll
differ from what sysctl displays.
--
Stanislav Sedov
ST4096-RIPE
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080115102016.GJ22695>
