POWERHOOK_ESTABLISH(9)       OpenBSD Kernel Manual      POWERHOOK_ESTABLISH(9)

NAME
     powerhook_establish, powerhook_disestablish - add or remove a power hook

SYNOPSIS
     void *
     powerhook_establish(void (*fn)(void *), void *arg);

     void
     powerhook_disestablish(void *cookie);

DESCRIPTION
     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 func-
     tion fn will be passed arg as its only argument.

     The powerhook_disestablish() function removes the hook described by the
     opaque pointer cookie from the list of power hooks.  If cookie is in-
     valid, the result of powerhook_disestablish() is undefined.

RETURN VALUES
     If successful, powerhook_establish() returns an opaque pointer describing
     the newly established power hook.  Otherwise, it returns NULL.

EXAMPLES
     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.

SEE ALSO
     apm(4), dopowerhooks(9)

OpenBSD 2.8                      July 1, 2000                                1
