From owner-freebsd-hackers@FreeBSD.ORG Tue Jan 15 10:41:05 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CD58716A494; Tue, 15 Jan 2008 10:41:05 +0000 (UTC) (envelope-from stas@ht-systems.ru) Received: from smtp.ht-systems.ru (mr0.ht-systems.ru [78.110.50.55]) by mx1.freebsd.org (Postfix) with ESMTP id 983B913C447; Tue, 15 Jan 2008 10:41:05 +0000 (UTC) (envelope-from stas@ht-systems.ru) Received: from [78.110.49.49] (helo=quasar.ht-systems.ru) by smtp.ht-systems.ru with esmtpa (Exim 4.62) (envelope-from ) id 1JEiu2-00019S-4E; Tue, 15 Jan 2008 13:20:18 +0300 Received: by quasar.ht-systems.ru (Postfix, from userid 1024) id F0FA27D32ED; Tue, 15 Jan 2008 13:20:16 +0300 (MSK) Date: Tue, 15 Jan 2008 13:20:16 +0300 From: Stanislav Sedov To: Jeremy Chadwick Message-ID: <20080115102016.GJ22695@dracon.ht-systems.ru> References: <20080114132440.GA71321@eos.sc1.parodius.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20080114132440.GA71321@eos.sc1.parodius.com> Organization: The FreeBSD Project X-Voice: +7 916 849 20 23 X-XMPP: ssedov@jabber.ru X-Yahoo: stanislav_sedov X-PGP-Fingerprint: F21E D6CC 5626 9609 6CE2 A385 2BF5 5993 EB26 9581 X-University: MEPhI X-Mailer: carrier-pigeon X-Operating-System: FreeBSD quasar.ht-systems.ru 7.0-BETA2 FreeBSD 7.0-BETA2 Cc: freebsd-hackers@freebsd.org Subject: Re: Examples of sysctl/sysctlbyname/sysctlnametomib? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Jan 2008 10:41:05 -0000 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