Patch to make powerd(8) devd(8)-aware

Fredrik Lindberg fli+freebsd-current at shapeshifter.se
Mon May 16 10:02:37 PDT 2005


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


More information about the freebsd-current mailing list