Date: Sun, 16 Jan 2011 18:17:09 +0100 From: Harald Servat <redcrash@gmail.com> To: Oliver Pinter <oliver.pntr@gmail.com> Cc: freebsd-hackers@freebsd.org Subject: Re: Question about sysctl-ing coretemp module values Message-ID: <AANLkTikwfu=hazadW=qMgCCbxLrMAkuaXmv3CpbD7nZ_@mail.gmail.com> In-Reply-To: <AANLkTi=yXqGm%2BkgKuap-nFOmaNdL0_J5qeW3ww5wPjH%2B@mail.gmail.com> References: <AANLkTi=eTpy%2BTkbXJy_sCgtPHAV8qd%2BgB=FabWc=d6vu@mail.gmail.com> <AANLkTi=yXqGm%2BkgKuap-nFOmaNdL0_J5qeW3ww5wPjH%2B@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
2011/1/15 Oliver Pinter <oliver.pntr@gmail.com> > > http://oliverp.teteny.bme.hu/git/?p=base/AiBoost-sensord.git;a=blob;f=aiboost-sensord.c;h=349b612066eb0514a2d5c3035908e7418ca71500;hb=HEAD > > On 1/15/11, Harald Servat <redcrash@gmail.com> wrote: > > Hello, > > > > First of all, forgive if this is not the appropiate list to ask this. > > Could you point me the correct list if so? > > > > I'm writing a small program to capture the temperature reported by the > > coretemp kernel module. I'm doing this by using the sysctl API. However, > I'm > > facing a problem when reading that value (dev.cpu.0.temperature, for > > example). > > > > man 3 sysctl has an example (labeled as "To retrieve the standard > search > > path for the system utilities:") which seems great to me to know the > length > > of the OID it wants to read before running the "real" sysctl. I wrote a > > similar example (attached) based on that, but it does not work > appropiately. > > The 1st call tells me that len = 4 (whereas the value for > > dev.cpu.0.temperature is "37.0C" which should be 5 if \0 is not counted). > > > > Can anyone shed some light on what I'm doing wrong? > > > > Thank you very much! > > -- > Matthew, Oliver, thank you very much! When I use an int variable instead of a char[4] it works fine. As you stated, the module returns a value in 10ths of K. Now, I've been able to fix the issue. Regards. -- _________________________________________________________________ Fry: You can see how I lived before I met you. Bender: You lived before you met me?! Fry: Yeah, lots of people did. Bender: Really?!
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTikwfu=hazadW=qMgCCbxLrMAkuaXmv3CpbD7nZ_>