Re: Making powerd=YES default

On 25.07.2011 20:11, Emmanuel Dreyfus wrote:
> On Mon, Jul 25, 2011 at 03:12:40PM +0100, Jean-Yves Migeon wrote:
>> As said to Emmanuel, I have no problem enabling it on a per-arch
>> basis by patching etc.[i386,amd64]/Makefile.
>
> I think the sysctl telling that power management is avaiable, and
> having powerd start or not depending on it, is a good idea: the
> syscl could be usefull for other purposes.
In that case there's already some logic available in powerd(8). It's
trivial to make it exit(2) in situations where it doesn't find a power
management backend.
That's a bit different from the current code where it checks first that
/etc/powerd/scripts/<power_type> is present, then falls back to
/etc/powerd/scripts.
http://nxr.netbsd.org/xref/src/usr.sbin/powerd/powerd.c#141http://nxr.netbsd.org/source/xref/src/sys/dev/sysmon/sysmon_power.c#743
Exposing the power management backend as a read-only sysctl is also an
option.
IMHO, powerd(8) shall exit unless there is code that explicitly
registers a backend. It has no real meaning (to me, at least) to handle
power events where there is nothing expecting it to be so.
There, /etc/powerd/scripts would rather be:
/etc/powerd/scripts/default/*
/etc/powerd/scripts/acpi/*
/etc/powerd/scripts/xen/*
/etc/powerd/scripts/<power_type>/*
[...]
Or even move away "scripts" entirely. Nothing specifies that these
should be scripts.
--
Jean-Yves Migeon
jeanyves.migeon%free.fr@localhost