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

  man pages->NetBSD man pages -> powerhook_disestablish (9)              
Title
Content
Arch
Section
 

POWERHOOK_ESTABLISH(9)

Contents


NAME    [Toc]    [Back]

     powerhook_establish, powerhook_disestablish - add or remove a power
     change hook

SYNOPSIS    [Toc]    [Back]

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

     void
     powerhook_disestablish(void *cookie);

DESCRIPTION    [Toc]    [Back]

     The powerhook_establish() function adds fn of the list of hooks invoked
     by dopowerhooks(9) at power change.  When invoked, the hook function fn
     will be passed the new power state as the first argument and arg as its
     second argument.

     The powerhook_disestablish() function removes the hook described by the
     opaque pointer cookie from the list of hooks to be invoked at power
     change.  If cookie is invalid, the result of powerhook_disestablish() is
     undefined.

     Power hooks should be used to perform activities that must happen when
     the power situation to the computer changes.  Because of the environment
     in which they are run, shutdown hooks cannot rely on many system services
     (including file systems, and timeouts and other interrupt-driven services).
  The power hooks are typically executed from an interrupt context.


     The different reasons for calling the power hooks are: suspend, standby,
     and resume.  The reason is reflected in the why argument and the values
     PWR_SOFTSUSPEND, PWR_SUSPEND, PWR_SOFTSTANDBY, PWR_STANDBY,
     PWR_SOFTRESUME, and PWR_RESUME.  It calls with PWR_SOFTxxx in the normal
     priority level while the other callings are protected with splhigh(9).
     At suspend the system is going to lose (almost) all power, standby
     retains some power (e.g., minimal power to USB devices), and at resume
     power is back to normal.

RETURN VALUES    [Toc]    [Back]

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

SEE ALSO    [Toc]    [Back]

      
      
     dopowerhooks(9)

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