From owner-freebsd-current@FreeBSD.ORG Mon May 16 17:02:37 2005 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5A41C16A4CE for ; Mon, 16 May 2005 17:02:37 +0000 (GMT) Received: from mail.hamnpolare.net (manticore.shapeshifter.se [212.37.5.30]) by mx1.FreeBSD.org (Postfix) with ESMTP id ED22F43D66 for ; Mon, 16 May 2005 17:02:36 +0000 (GMT) (envelope-from fli+freebsd-current@shapeshifter.se) Received: from localhost (localhost [127.0.0.1]) by mail.hamnpolare.net (Postfix) with ESMTP id 7CBD81A6F0 for ; Mon, 16 May 2005 19:02:31 +0200 (CEST) Received: from mail.hamnpolare.net ([127.0.0.1])port 10024) with ESMTP id 77705-13 for ; Mon, 16 May 2005 19:02:31 +0200 (CEST) Received: from biocandy.shapeshifter.se (h99n2fls32o270.telia.com [217.210.25.99]) by mail.hamnpolare.net (Postfix) with ESMTP id 344251A6D5 for ; Mon, 16 May 2005 19:02:31 +0200 (CEST) Received: by biocandy.shapeshifter.se (Postfix, from userid 1001) id 0C0D44386; Mon, 16 May 2005 19:02:31 +0200 (CEST) Date: Mon, 16 May 2005 19:02:30 +0200 From: Fredrik Lindberg To: freebsd-current@freebsd.org Message-ID: <20050516170230.GB90847@shapeshifter.se> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2.1i X-Virus-Scanned: at example.com Subject: Patch to make powerd(8) devd(8)-aware X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 May 2005 17:02:37 -0000 Hi I wrote a small patch to make powerd(8) aware of devd(8), thus making the AC line state change event driven. Instead of one sysctl call per iteration it just requires reading one variable to determine the AC line state. This should yield faster execution, and hence, lower power consumption. Events are read from /var/run/devd.pipe, therefore requires devd to be running. If devd is not running it will use the old polling method to determinate AC state. devd was choosen over devctl(4) because the current implementation of devctl only allow one reader and that's usually devd(8). Patch avaiable at, apply with patch < -p0 in usr.sbin http://shapeshifter.se/~fli/freebsd/powerd-devd.patch During the same time I also discovered a bug(?) in devd which causes it to terminate with a broken pipe if a client reading /var/run/devd.pipe disappears. Blocking SIGPIPE fixes this. Patch at http://shapeshifter.se/~fli/freebsd/devd.cc-sigpipe.patch You'll need the devd patch if you want to run the devd patch without problems. Fredrik Lindberg