Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 May 2005 19:02:30 +0200
From:      Fredrik Lindberg <fli+freebsd-current@shapeshifter.se>
To:        freebsd-current@freebsd.org
Subject:   Patch to make powerd(8) devd(8)-aware
Message-ID:  <20050516170230.GB90847@shapeshifter.se>

next in thread | raw e-mail | index | archive | help
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



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