POWERHOOK_ESTABLISH(9) BSD Kernel Manual POWERHOOK_ESTABLISH(9)
powerhook_establish, powerhook_disestablish - add or remove a power hook
#include <sys/types.h> #include <sys/systm.h> void * powerhook_establish(void (*fn)(int, void *), void *arg); void powerhook_disestablish(void *cookie);
The powerhook_establish() function adds fn to the list of hooks invoked by dopowerhooks(9) during any change in apm(4) power state (i.e., during a "suspend", "standby", or "resume"). When invoked, the hook function fn will be passed an int why and arg as its arguments. The int value why will be one of PWR_RESUME, PWR_SUSPEND, and PWR_STANDBY. The powerhook_disestablish() function removes the hook described by the opaque pointer cookie from the list of power hooks. If cookie is invalid, the result of powerhook_disestablish() is undefined.
If successful, powerhook_establish() returns an opaque pointer describing the newly established power hook. Otherwise, it returns NULL.
It may be appropriate to use a power hook to disestablish interrupts and disable PCMCIA functions on PC Cards that are present when the system is put into suspend mode. The reverse should happen on resume. It may be appropriate to use a power hook to halt audio output in a sound driver at suspend-time. On resume, it may not be possible to recover au- dio output, but at least the device can be put into a known, working state.
apm(4), dopowerhooks(9) MirOS BSD #10-current July 1, 2000 1
Generated on 2016-04-09 18:24:16 by $MirOS: src/scripts/roff2htm,v 1.83 2016/03/26 23:38:28 tg Exp $
These manual pages and other documentation are copyrighted by their respective writers;
their source is available at our CVSweb,
AnonCVS, and other mirrors. The rest is Copyright © 2002–2016 The MirOS Project, Germany.
This product includes material provided by mirabilos.
This manual page’s HTML representation is supposed to be valid XHTML/1.1; if not, please send a bug report – diffs preferred.