|
HOOK_ESTABLISH(9)
Contents
|
POWER 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 audio
output, but at least the device can be put into a known,
working
state.
apm(4), dopowerhooks(9)
OpenBSD 3.6 July 1, 2000
[ Back ] |