patch: acpi usermode suspend API change

Nate Lawson nate at
Sun Jun 17 20:43:32 UTC 2007

This patch updates the user API for acpi suspend in a number of ways.

* /etc/rc.suspend,rc.resume are always run, no matter the source of the
suspend event
* suspend now requires positive user acknowledgement.  If a user program
wants to cancel the suspend, they can.  If one of the user programs
hangs or doesn't respond within 10 seconds, the system suspends anyway.
* /dev/apm is clonable, allowing multiple listeners for suspend events.
 In the future, xorg-server can use this to be informed about suspend
even if there are other listeners (i.e. apmd).

The API changes are intended to be MFCd and hence are minimal.

* Two new ACPI ioctls:  REQSLPSTATE and ACKSLPSTATE.  Request begins the
process of suspending by notifying all listeners.  acpi is monitored by
devd(8) and /dev/apm listener(s) are also counted.  Users register their
approval or disapproval via Ack.  If anyone disapproves, suspend is vetoed.

* Binary compat is preserved in that old user programs or kernel modules
(yeah, right) that called the API can still do so.  A message is printed
once that this interface is deprecated.

* acpiconf gains the -k flag to ack the suspend request.  This flag is
undocumented on purpose since it's only used by /etc/rc.suspend.  It is
not intended to be a permanent change and will be removed once a better
power API is implemented.

These patches have been successfully tested for about a week through
suspend/resumes and various usermode programs, including patches to

The eventual goal is to improve subr_power to be a more generic central
power management interface to user and kernel providers.  powerd(8)
might start managing profiles similar to apmd(8).  I don't know yet and
there isn't time to do that.  This patch provides a reasonable interface
for now and eliminates some serious weaknesses, especially in that
pressing a sleep button did not guarantee rc.suspend would run before

Comments welcome, patches are for 6.x and 7.x.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: acpi6_wakeapi.diff
Type: text/x-patch
Size: 25712 bytes
Desc: not available
Url :
-------------- next part --------------
A non-text attachment was scrubbed...
Name: acpi7_wakeapi.diff
Type: text/x-patch
Size: 25595 bytes
Desc: not available
Url :

More information about the freebsd-current mailing list