Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

config_intrhook_disestablish(9) [freebsd man page]

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

config_intrhook -- schedule a function to be run after interrupts have been enabled, but before root is mounted SYNOPSIS
#include <sys/kernel.h> int config_intrhook_establish(struct intr_config_hook *hook); void config_intrhook_disestablish(struct intr_config_hook *hook); DESCRIPTION
The config_intrhook_establish() function schedules a function to be run after interrupts have been enabled, but before root is mounted. If the system has already passed this point in its initialization, the function is called immediately. The config_intrhook_disestablish() function removes the entry from the hook queue. Before root is mounted, all the previously established hooks are run. The boot process is then stalled until all handlers remove their hook from the hook queue with config_intrhook_disestablish(). The boot process then proceeds to attempt to mount the root file system. Any driver that can potentially provide devices they wish to be mounted as root must use either this hook, or probe all these devices in the ini- tial probe. Since interrupts are disabled during the probe process, many drivers need a method to probe for devices with interrupts enabled. The requests are made with the intr_config_hook structure. This structure is defined as follows: struct intr_config_hook { TAILQ_ENTRY(intr_config_hook) ich_links;/* Private */ void (*ich_func)(void *arg); /* function to call */ void *ich_arg; /* Argument to call */ }; Storage for the intr_config_hook structure must be provided by the driver. It must be stable from just before the hook is established until after the hook is disestablished. Specifically, hooks are run at SI_SUB_INT_CONFIG_HOOKS(), which is immediately after the scheduler is started, and just before the root file system device is discovered. RETURN VALUES
A zero return value means the hook was successfully added to the queue (with either deferred or immediate execution). A non-zero return value means the hook could not be added to the queue because it was already on the queue. SEE ALSO
These functions were introduced in FreeBSD 3.0 with the CAM subsystem, but are available for any driver to use. AUTHORS
The functions were written by Justin Gibbs <>. This manual page was written by M. Warner Losh <>. BSD
September 24, 2006 BSD

Check Out this Related Man Page

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

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 environ- ment in which they are run, power 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
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
Man Page

Featured Tech Videos