|This macro declares an event handler named by argument name with callback functions of type type.|
This macro registers a callback function
with event handler
When invoked, function
will be invoked with argument
as its first parameter along with any additional parameters passed in
Callback functions are invoked in order of priority.
The relative priority of each callback among other callbacks
associated with an event is given by argument
which is an integer ranging from
(highest priority), to
may be used if the handler does not have a specific priority
associated with it.
If registration is successful,
returns a cookie of type
.Vt eventhandler_tag .
|This macro removes a previously registered callback associated with tag tag from the event handler named by argument name.|
|This macro is used to invoke all the callbacks associated with event handler name. This macro is a variadic one. Additional arguments to the macro after the name parameter are passed as the second and subsequent arguments to each registered callback function.|
The macros are implemented using the following functions:
|The eventhandler_register function is used to register a callback with a given event. The arguments expected by this function are:|
|list||A pointer to an existing event handler list, or NULL. If list is NULL, the event handler list corresponding to argument name is used.|
|name||The name of the event handler list.|
|func||A pointer to a callback function. Argument arg is passed to the callback function func as its first argument when it is invoked.|
|The relative priority of this callback among all the callbacks registered for this event. Valid values are those in the range EVENTHANDLER_PRI_FIRST to EVENTHANDLER_PRI_LAST.|
The eventhandler_register function returns a tag that can later be used with eventhandler_deregister to remove the particular callback function.
|The eventhandler_deregister function removes the callback associated with tag tag from the event handler list pointed to by list. This function is safe to call from inside an event handler callback.|
|The eventhandler_find_list function returns a pointer to event handler list structure corresponding to event name.|
|The eventhandler_prune_list function removes all deregistered callbacks from the event list list.|
The following event handlers are present in the kernel:
Vt acpi_sleep_event Callbacks invoked when the system is being sent to sleep. Vt acpi_wakeup_event Callbacks invoked when the system is being woken up. Vt dev_clone Callbacks invoked when a new entry is created under /dev. Vt ifaddr_event Callbacks invoked when an address is set up on a network interface. Vt if_clone_event Callbacks invoked when an interface is cloned. Vt ifnet_arrival_event Callbacks invoked when a new network interface appears. Vt ifnet_departure_event Callbacks invoked when a network interface is taken down. Vt bpf_track Callbacks invoked when a BPF listener attaches to/detaches from network interface. Vt kld_load Callbacks invoked after a linker file has been loaded. Vt kld_unload Callbacks invoked after a linker file has been successfully unloaded. Vt kld_unload_try Callbacks invoked before a linker file is about to be unloaded. These callbacks may be used to return an error and prevent the unload from proceeding. Vt power_profile_change Callbacks invoked when the power profile of the system changes. Vt process_exec Callbacks invoked when a process performs an exec operation. Vt process_exit Callbacks invoked when a process exits. Vt process_fork Callbacks invoked when a process forks a child. Vt shutdown_pre_sync Callbacks invoked at shutdown time, before file systems are synchronized. Vt shutdown_post_sync Callbacks invoked at shutdown time, after all file systems are synchronized. Vt shutdown_final Callbacks invoked just before halting the system. Vt vm_lowmem Callbacks invoked when virtual memory is low. Vt watchdog_list Callbacks invoked when the system watchdog timer is reinitialized.
The macro EVENTHANDLER_REGISTER and function eventhandler_register return a cookie of type
.Vt eventhandler_tag , which may be used in a subsequent call to EVENTHANDLER_DEREGISTER or eventhandler_deregister.
The eventhandler_find_list function returns a pointer to an event handler list corresponding to parameter name, or NULL if no such list was found.
The EVENTHANDLER facility first appeared in
.Fx 4.0 .
This manual page was written by
.An Joseph Koshy Aq jkoshy@FreeBSD.org .