Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Jul 2000 04:41:21 +0900 (JST)
From:      Hajimu UMEMOTO <ume@mahoroba.org>
To:        imp@village.org
Cc:        ume@mahoroba.org
Subject:   Re: sysctl interface for apm? 
Message-ID:  <20000718.044121.71098397.ume@mahoroba.org>
In-Reply-To: <200007171914.NAA63275@harmony.village.org>
References:  <200007171753.LAA62543@harmony.village.org> <39734D36.5FC7DDA@sftw.com> <200007171914.NAA63275@harmony.village.org>

next in thread | previous in thread | raw e-mail | index | archive | help
>>>>> On Mon, 17 Jul 2000 13:14:24 -0600
>>>>> Warner Losh <imp@village.org> said:

imp> In message <20000718.033514.59474907.ume@mahoroba.org> Hajimu UMEMOTO writes:
imp> : nsayer> The "why bother" is easy -- one should not have to belong to group
imp> : nsayer> operator to determine the current battery state. Too many things
imp> : nsayer> already have to be sgid (at least) without making this another reason.
imp> : I love this feature.

imp> Don't worry, he's not going to change this feature.  I use it and will
imp> fix it back if someone "breaks" it..

I means sysctl doesn't require extra privilege to obtain required
information.  Sorry for my ambiguity.

imp> : nsayer> I took a middle ground. I have two ints, machdep.apm_battlevel
imp> : nsayer> and machdep.apm_powerstate. The power state number is
imp> : nsayer> -1 to 5 for unknown, critical, low, medium, high (which four imply
imp> : nsayer> battery power), AC or charging (which two imply AC power).
imp> : 
imp> : Then, I cannot switch to use sysctl.  Actually, GKrellM requires
imp> : ai_batt_stat, ai_acline, ai_batt_life and ai_batt_time members of
imp> : struct apm_info.

imp> Yes.  The right answer isn't to kludge this through a sysctl, but
imp> instead it is to fix apm to that it is safe to make it world read
imp> only.  Is there a way inside a ioctl to see if you have something open
imp> for write access?

Indeed, I wish to have a method to obtain required information without
extra privilege.  We need safety way.
Currentry, GKrellM opens /dev/apm with O_RDWR.  I just tried to open
with O_RDONLY and see it is sufficient for APMIO_GETINFO.  I'll send
the change to the author of GKrellM.

--
Hajimu UMEMOTO @ Internet Mutual Aid Society Yokohama, Japan
ume@mahoroba.org  ume@bisd.hitachi.co.jp  ume@FreeBSD.org
http://www.imasy.org/~ume/


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




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