From owner-freebsd-hackers@FreeBSD.ORG Tue Jul 13 13:52:09 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2D29616A4CE for ; Tue, 13 Jul 2004 13:52:09 +0000 (GMT) Received: from mail.gmx.net (mail.gmx.de [213.165.64.20]) by mx1.FreeBSD.org (Postfix) with SMTP id 29E7643D3F for ; Tue, 13 Jul 2004 13:52:08 +0000 (GMT) (envelope-from ph.schulz@gmx.de) Received: (qmail 9938 invoked by uid 65534); 13 Jul 2004 13:52:04 -0000 Received: from p5090C148.dip0.t-ipconnect.de (EHLO gmx.de) (80.144.193.72) by mail.gmx.net (mp022) with SMTP; 13 Jul 2004 15:52:04 +0200 X-Authenticated: #1954550 Message-ID: <40F3E8DE.3050005@gmx.de> Date: Tue, 13 Jul 2004 15:51:26 +0200 From: Phil Schulz User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.6) Gecko/20040520 X-Accept-Language: de, en-us, en MIME-Version: 1.0 To: freebsd-hackers@freebsd.org X-Enigmail-Version: 0.84.0.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Subject: Code review / Monitoring battery X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Jul 2004 13:52:09 -0000 Hello! I wrote a little daemon which monitors the value of sysctl hw.acpi.battery.life and issues me two warnings before shutting down the machine in case of low battery. Since this is one of my first steps in Unix-programming, I wonder if anyone might take a minute or two to look over the code and comment on it. I put a lot of comments all over the place, especially where I'm unsure about how things work. The source code can be found at [1]. Please note that this 'server' is connected over an ADSL line with only 128kbps upstream just in case you wonder why it's so slow. Also I'd like to know if anyone knows something similar to this little tool. I found wmbattery from ports, but it doesn't shut down the computer. If there isn't such a program, I'd be happy to make this little thing a port (provided that there is need for it). Thanks, Phil. [1] http://phil.homeunix.net:8000/battd.c