*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->OpenBSD man pages -> powerhook_establish (9)              
Title
Content
Arch
Section
 

HOOK_ESTABLISH(9)

Contents


POWER

NAME    [Toc]    [Back]

     powerhook_establish, powerhook_disestablish - add or  remove
a power hook

SYNOPSIS    [Toc]    [Back]

     #include <sys/types.h>
     #include <sys/systm.h>

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

     void
     powerhook_disestablish(void *cookie);

DESCRIPTION    [Toc]    [Back]

     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.

RETURN VALUES    [Toc]    [Back]

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

EXAMPLES    [Toc]    [Back]

     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.

SEE ALSO    [Toc]    [Back]

      
      
     apm(4), dopowerhooks(9)

OpenBSD      3.6                           July      1,      2000
[ Back ]
 Similar pages
Name OS Title
powerhook_establish NetBSD add or remove a power change hook
powerhook_disestablish NetBSD add or remove a power change hook
shutdownhook_disestablish OpenBSD add or remove a shutdown hook
hook_establish OpenBSD add or remove a hook from a specified list
shutdownhook_establish OpenBSD add or remove a shutdown hook
shutdownhook_disestablish NetBSD add or remove a shutdown hook
shutdownhook_establish NetBSD add or remove a shutdown hook
hook_disestablish OpenBSD add or remove a hook from a specified list
startuphook_establish OpenBSD add or remove a startup hook
startuphook_disestablish OpenBSD add or remove a startup hook
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service