The OpenNET Project / Index page

[ новости /+++ | форум | теги | ]

Интерактивная система просмотра системных руководств (man-ов)

 ТемаНаборКатегория 
 
 [Cписок руководств | Печать]

EVENTHANDLER_DECLARE (9)
  • >> EVENTHANDLER_DECLARE (9) ( FreeBSD man: Ядро )

  • BSD mandoc
     

    NAME

    
    
    EVENTHANDLER
    
     - kernel event handling functions
    
     
    

    SYNOPSIS

       #include <sys/eventhandler.h>
    EVENTHANDLER_DECLARE (name type);
    EVENTHANDLER_INVOKE (name ...);
    eventhandler_tag EVENTHANDLER_REGISTER (name func arg priority);
    EVENTHANDLER_DEREGISTER (name tag);
    eventhandler_tag Fo eventhandler_register Fa struct eventhandler_list *list Fa const char *name Fa void *func Fa void *arg Fa int priority Fc Ft void Fo eventhandler_deregister Fa struct eventhandler_list *list Fa eventhandler_tag tag Fc Ft struct eventhandler_list * eventhandler_find_list (const char *name);
    void eventhandler_prune_list (struct eventhandler_list *list);
     

    DESCRIPTION

    The mechanism provides a way for kernel subsystems to register interest in kernel events and have their callback functions invoked when these events occur.

    The normal way to use this subsystem is via the macro interface. The macros that can be used for working with event handlers and callback function lists are:

    Fn EVENTHANDLER_DECLARE
    This macro declares an event handler named by argument Fa name with callback functions of type Fa type .
    Fn EVENTHANDLER_REGISTER
    This macro registers a callback function Fa func with event handler Fa name . When invoked, function Fa func will be invoked with argument Fa arg as its first parameter along with any additional parameters passed in via macro EVENTHANDLER_INVOKE ();
    (see below). 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 Fa priority , which is an integer ranging from EVENTHANDLER_PRI_FIRST (highest priority), to EVENTHANDLER_PRI_LAST (lowest priority). The symbol EVENTHANDLER_PRI_ANY may be used if the handler does not have a specific priority associated with it. If registration is successful, EVENTHANDLER_REGISTER ();
    returns a cookie of type Vt eventhandler_tag .
    Fn EVENTHANDLER_DEREGISTER
    This macro removes a previously registered callback associated with tag Fa tag from the event handler named by argument Fa name .
    Fn EVENTHANDLER_INVOKE
    This macro is used to invoke all the callbacks associated with event handler Fa name . This macro is a variadic one. Additional arguments to the macro after the Fa name parameter are passed as the second and subsequent arguments to each registered callback function.

    The macros are implemented using the following functions:

    Fn eventhandler_register
    The eventhandler_register ();
    function is used to register a callback with a given event. The arguments expected by this function are:

    Fa list
    A pointer to an existing event handler list, or NULL If Fa list is NULL the event handler list corresponding to argument Fa name is used.
    Fa name
    The name of the event handler list.
    Fa func
    A pointer to a callback function. Argument Fa arg is passed to the callback function Fa func as its first argument when it is invoked.
    Fa priority
    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 Fa tag that can later be used with eventhandler_deregister ();
    to remove the particular callback function.

    Fn eventhandler_deregister
    The eventhandler_deregister ();
    function removes the callback associated with tag Fa tag from the event handler list pointed to by Fa list . This function is safe to call from inside an event handler callback.
    Fn eventhandler_find_list
    The eventhandler_find_list ();
    function returns a pointer to event handler list structure corresponding to event Fa name .
    Fn eventhandler_prune_list
    The eventhandler_prune_list ();
    function removes all deregistered callbacks from the event list Fa list .

     

    Kernel Event Handlers

    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 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.

     

    RETURN VALUES

    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 Fa name , or NULL if no such list was found.  

    HISTORY

    The facility first appeared in Fx 4.0 .  

    AUTHORS

    This manual page was written by An Joseph Koshy Aq jkoshy@FreeBSD.org .


     

    Index

    NAME
    SYNOPSIS
    DESCRIPTION
    Kernel Event Handlers
    RETURN VALUES
    HISTORY
    AUTHORS


    Поиск по тексту MAN-ов: 




    Партнёры:
    PostgresPro
    Inferno Solutions
    Hosting by Hoster.ru
    Хостинг:

    Закладки на сайте
    Проследить за страницей
    Created 1996-2024 by Maxim Chirkov
    Добавить, Поддержать, Вебмастеру