From owner-freebsd-hackers Mon Jul 17 12:41:59 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from peace.mahoroba.org (peace.calm.imasy.or.jp [202.227.26.34]) by hub.freebsd.org (Postfix) with ESMTP id 93D2737BB12; Mon, 17 Jul 2000 12:41:52 -0700 (PDT) (envelope-from ume@mahoroba.org) Received: from localhost (IDENT:yGGjyRBkxt0YYve7e0DybgcB0u+UO/vaIZxZUrhlhSrLFeue8PMMjMa56NayND/J@localhost [::1]) (authenticated) by peace.mahoroba.org (8.10.2/3.7W-peace) with ESMTP id e6HJfOh17473; Tue, 18 Jul 2000 04:41:25 +0900 (JST) (envelope-from ume@mahoroba.org) Date: Tue, 18 Jul 2000 04:41:21 +0900 (JST) Message-Id: <20000718.044121.71098397.ume@mahoroba.org> To: imp@village.org Cc: nsayer@freebsd.org, nsayer@sftw.com, freebsd-hackers@freebsd.org Cc: ume@mahoroba.org Subject: Re: sysctl interface for apm? From: Hajimu UMEMOTO In-Reply-To: <200007171914.NAA63275@harmony.village.org> References: <200007171753.LAA62543@harmony.village.org> <39734D36.5FC7DDA@sftw.com> <200007171914.NAA63275@harmony.village.org> X-Mailer: xcite1.20> Mew version 1.95b38 on Emacs 20.6 / Mule 4.0 =?iso-2022-jp?B?KBskQjJWMWMbKEIp?= X-PGP-Public-Key: http://www.imasy.org/~ume/publickey.asc X-PGP-Fingerprint: 6B 0C 53 FC 5D D0 37 91 05 D0 B3 EF 36 9B 6A BC X-URL: http://www.imasy.org/~ume/ X-OS: FreeBSD 5.0-CURRENT Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG >>>>> On Mon, 17 Jul 2000 13:14:24 -0600 >>>>> Warner Losh 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