>>>>> On Mon, 17 Jul 2000 13:14:24 -0600
>>>>> Warner Losh <[EMAIL PROTECTED]> said:
imp> In message <[EMAIL PROTECTED]> 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
[EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED]
http://www.imasy.org/~ume/
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message