powerhook_establish man page on NetBSD

Man page or keyword search:  
man Server   9087 pages
apropos Keyword Search (all sections)
Output format
NetBSD logo
[printable version]

POWERHOOK_ESTABLISH(9)	 BSD Kernel Developer's Manual	POWERHOOK_ESTABLISH(9)

NAME
     powerhook_establish, powerhook_disestablish — add or remove a power
     change hook

SYNOPSIS
     void *
     powerhook_establish(const char *name, void (*fn)(int why, void *a),
	 void *arg);

     void
     powerhook_disestablish(void *cookie);

DESCRIPTION
     The powerhook_establish API is deprecated.

     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, power hooks cannot rely on many system services
     (including file systems, and timeouts and other interrupt-driven ser‐
     vices).  The power hooks are typically executed from an interrupt con‐
     text.

     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
     If successful, powerhook_establish() returns an opaque pointer describing
     the newly-established power hook.	Otherwise, it returns NULL.

SEE ALSO
     dopowerhooks(9)

BSD				 May 14, 2009				   BSD
[top]
                             _         _         _ 
                            | |       | |       | |     
                            | |       | |       | |     
                         __ | | __ __ | | __ __ | | __  
                         \ \| |/ / \ \| |/ / \ \| |/ /  
                          \ \ / /   \ \ / /   \ \ / /   
                           \   /     \   /     \   /    
                            \_/       \_/       \_/ 
More information is available in HTML format for server NetBSD

List of man pages available for NetBSD

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net