Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

callback_unregister(9) [netbsd man page]

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

NAME
callback -- generic callback interface SYNOPSIS
#include <sys/callback.h> void callback_head_init(struct callback_head *ch, int ipl); void callback_head_destroy(struct callback_head *ch); void callback_register(struct callback_head *ch, struct callback_entry *ce, void *obj, int (*fn)(struct callback_entry *, void *, void *)); void callback_unregister(struct callback_head *ch, struct callback_entry *ce); int callback_run_roundrobin(struct callback_head *ch, void *arg); DESCRIPTION
The generic callback interface allows lower-level layer code to execute a registered function, or set of functions, from the higher-level layer. Registered functions must return one of these constants: CALLBACK_CHAIN_CONTINUE Indicates that the function call was successful. The following functions in the chain will be called. CALLBACK_CHAIN_ABORT Indicates a failure case in the function call. Any following functions in the chain will not be executed. FUNCTIONS
The callback structure callback_head should be initialized and destroyed using the functions described below. This structure contains the list of callback entries and other internal data. The callback_entry structure is an entry, normally associated with the higher-level object. It contains the internal data of the callback interface. callback_head_init(ch, ipl) Initialize the callback structure specified by ch. The highest IPL at which this callback can be used is specified by ipl. callback_head_destroy(ch) Destroy the callback structure specified by ch. The caller must unregister all functions before destroying the callback structure. callback_register(ch, ce, obj, fn) Register the callback function in the callback structure specified by ch. ce should point to the entry structure of the callback object. The callback object itself is specified by obj. The function pointer is specified by fn. callback_unregister(ch, ce) Unregister the callback function from the structure specified by ch. The entry should be passed as ce. This function may block. callback_run_roundrobin(ch, arg) Executes all functions registered in the callback structure, specified by ch. The functions are executed in round-robin fashion. The value of arg will be passed to the callback functions. CODE REFERENCES
The callback interface is implemented within the file sys/kern/subr_callback.c. SEE ALSO
intro(9) BSD
October 28, 2009 BSD

Check Out this Related Man Page

iv_signal(3)						    ivykis programmer's manual						      iv_signal(3)

NAME
IV_SIGNAL_INIT, iv_signal_register, iv_signal_unregister - ivykis signal handling SYNOPSIS
#include <iv_signal.h> struct iv_signal { int signum; unsigned int flags; void *cookie; void (*handler)(void *); }; void IV_SIGNAL_INIT(struct iv_signal *this); int iv_signal_register(struct iv_signal *this); void iv_signal_unregister(struct iv_signal *this); DESCRIPTION
iv_signal provides a way for ivykis(3) applications to handle POSIX signals, by integrating them with the ivykis event loop. An ivykis application desiring signal notification registers a struct iv_signal object by calling iv_signal_register, after having ini- tialised it with IV_SIGNAL_INIT and subsequently having filled in the ->signum, ->cookie and ->handler members. Once the signal indicated by ->signum is delivered to any thread in the current process, the callback specified by ->handler is scheduled to be called in the thread that the struct iv_signal object was registered in, with ->cookie as its sole argument. If the same signal arrives again while the callback function is still running, the callback function is guaranteed to be called again after it returns. It is permitted to register multiple struct iv_signal objects for the same signal number. If all such objects are registered with IV_SIG- NAL_FLAG_EXCLUSIVE in ->flags unset, then all objects will have their callback functions called upon arrival of the signal, in no guaran- teed order. Invoking callback functions stops at the first struct iv_signal object with IV_SIGNAL_FLAG_EXCLUSIVE in ->flags set, so that if all objects have IV_SIGNAL_FLAG_EXCLUSIVE set, only one callback function will be invoked. To deinitialize a struct iv_signal object, call iv_signal_unregister from the same thread that iv_signal_register was called from on that object. It is permitted to unregister a struct iv_signal object from any ivykis callback function in the thread it was registered in, including from a callback function triggered by this object, and it is permitted to free the memory corresponding to an unregistered object from its own callback function. It is guaranteed that signals delivered to child processes that were created by fork(2) but that have not yet called execve(2) will not cause iv_signal callbacks to be invoked in the parent process. Internally, iv_signal is implemented using iv_event_raw(3). SEE ALSO
ivykis(3), iv_event_raw(3), sigaction(2) ivykis 2010-09-03 iv_signal(3)
Man Page