On Mon, Mar 28, 2011 at 02:54:55PM +0200, Martin Husemann wrote:On Mon, Mar 28, 2011 at 03:50:46PM +0300, Jukka Ruohonen wrote:> I would go for (3), perhaps with a "-s" flag to halt(8). This would also solve > the user interface issue that remains unresolved in options (1) and (2). > Extending halt(8) has been discussed also previously (cf. e.g. [1]).Don't mix it with the user interface or "halt", it is completely unrelated.I would go for (2), since there already is "gracefull shutdown" code in there,but it needs MD extensions for this case.
I am rather interested in a way to fix power management limitations found for the "sleep" case, where it is silently "ignored" (well, you only get a system message indicating that sleep button was pressed) when powerd(8) is not running. This is already done for shutdown and reboot. The "sleep" case is missing. We have to choose between error reporting, or add a hook to sysmon wrapper so we can call MD suspend code.
Regarding user interface, although it's somewhat related to my issue, it's secondary: I can always hack around the MD stuff, and fix the interface later when we'll have a sane API (like the one Jukka mentions [1]).
IMHO, the RB_SLEEP flag for cpu_reboot(9) is the more logical, as shutdown, reboot or sleep events share things (at least from a system perspective). Although current MD cpu_reboot(9) for x86 does not look that much flexible :)
[1] http://www.netbsd.org/contrib/projects.html#shutdowntime -- Jean-Yves Migeon jeanyves.migeon%free.fr@localhost