From owner-acpi-jp@jp.FreeBSD.org Sat Jan  3 03:27:34 2004
Received: (from daemon@localhost)
	by castle.jp.FreeBSD.org (8.11.6p2+3.4W/8.11.3) id i02IRYp48128;
	Sat, 3 Jan 2004 03:27:34 +0900 (JST)
	(envelope-from owner-acpi-jp@jp.FreeBSD.org)
Received: from mail6.speakeasy.net (mail6.speakeasy.net [216.254.0.206])
	by castle.jp.FreeBSD.org (8.11.6p2+3.4W/8.11.3) with ESMTP/inet id i02IRXC48123
	for <acpi-jp@jp.FreeBSD.org>; Sat, 3 Jan 2004 03:27:34 +0900 (JST)
	(envelope-from jhb@FreeBSD.org)
Received: (qmail 7729 invoked from network); 2 Jan 2004 18:27:32 -0000
Received: from dsl027-160-063.atl1.dsl.speakeasy.net (HELO server.baldwin.cx) ([216.27.160.63])
          (envelope-sender <jhb@FreeBSD.org>)
          by mail6.speakeasy.net (qmail-ldap-1.03) with AES256-SHA encrypted SMTP
          for <acpi-jp@jp.FreeBSD.org>; 2 Jan 2004 18:27:32 -0000
Received: from laptop.baldwin.cx (gw1.twc.weather.com [216.133.140.1])
	by server.baldwin.cx (8.12.10/8.12.10) with ESMTP id i02IRQM0002919
	for <acpi-jp@jp.FreeBSD.org>; Fri, 2 Jan 2004 13:27:26 -0500 (EST)
	(envelope-from jhb@FreeBSD.org)
Message-ID: <XFMail.20040102132727.jhb@FreeBSD.org>
X-Mailer: XFMail 1.5.4 on FreeBSD
X-Priority: 3 (Normal)
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 8bit
MIME-Version: 1.0
In-Reply-To: <20040101001308.GF784@hermes.home.paeps.cx>
From: John Baldwin <jhb@freebsd.org>
To: acpi-jp@jp.FreeBSD.org
X-Spam-Checker-Version: SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp)
Reply-To: acpi-jp@jp.FreeBSD.org
Precedence: list
Date: Fri, 02 Jan 2004 13:27:27 -0500
X-Sequence: acpi-jp 2965
Subject: [acpi-jp 2965] RE: [patch] Thermal ioctls?
Sender: owner-acpi-jp@jp.FreeBSD.org
X-Originator: jhb@FreeBSD.org
X-Distribute: distribute version 2.1 (Alpha) patchlevel 24e+031216


On 01-Jan-2004 Philip Paeps wrote:
> On 2003-12-31 14:55:43 (-0800), Nate Lawson <nate@root.org> wrote:
>> On Wed, 31 Dec 2003, Michael Smith wrote:
>> > On Dec 31, 2003, at 11:57 AM, Philip Paeps wrote:
>> > > > > [Aside: is there any reason for prefering sysctl over ioctl?  I have
>> > > > > nothing against either of them, but I notice sysctl getting very
>> > > > > popular...]
>> > > >
>> > > > My approach is: sysctls for user control, ioctls for program control.
>> > >
>> > > Sounds logical.
>> >
>> > Completely wrong, though.
>> >
>> > ioctls are appropriate as a control channel for file descriptors.  If you
>> > have something that's normally opened and treated like a file, you tend to
>> > use ioctl against the same file descriptor to control it.
>> >
>> > If there's no file descriptor involved, ioctl is not the right approach;
>> > sysctl is the catchall that you should use in that case.  The structured
>> > namespace is superior in most regards anyway.
>> 
>> So are you against adding the thermal ioctls?  It would be nice to simplify
>> the means of exporting temp data to user applications.  Isn't there already
>> an API for this that ACPI can provide information to?  I find it hard to
>> believe FreeBSD has had no thermal information API for the past 3 years.
> 
> A bit of creative googling tells me jhb@ has had some tools using thermal
> ioctls since 2001:
> 
>   http://people.freebsd.org/~jhb/acpi/
>   http://people.freebsd.org/~jhb/acpi/health.c
> 
> So it appears they used to exist at some point, but were removed?  Or has John
> also been using local patches?

I had a local patch.  But it doesn't work with multiple zones.  Also, given
the simplicity of sysctlbyname(), I'd rather just use sysctl's.  We would
possibly need a sysctl that listed the current zones though:

hw.acpi.thermal.zones: tz0 (for example)

> I just find it a bit strange that we have ioctls for some ACPI devices but not
> for others.  For the sake of consistency, we should either have them for
> everything (well, the things that could use them), or for nothing at all, and
> just use sysctl for everything.  That's just my opinion though...

The only thing I think that isn't already in a sysctl is detailed battery
information, i.e. the actual BST and BIF structure contents.  Everything
else is already exported via sysctl.

-- 

John Baldwin <jhb@FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/
