ekg2
GIT master
|
Idź do kodu źródłowego tego pliku.
Funkcje | |
int | ekg2_register_abort_handler (abort_handler handler, plugin_t *plugin) |
void | ekg2_run_all_abort_handlers (void) |
int | ekg2_unregister_abort_handlers_for_plugin (plugin_t *plugin) |
Zmienne | |
G_BEGIN_DECLS typedef void(* | abort_handler )(void) |
int ekg2_register_abort_handler | ( | abort_handler | handler, |
plugin_t * | plugin | ||
) |
Statically register the abort handler function for the plugin.
The handler MUST be async-signal-safe (see signal(7)).
void ekg2_run_all_abort_handlers | ( | void | ) |
Run all registered abort handlers (possibly none).
No particular order of invocation is guaranteed.
int ekg2_unregister_abort_handlers_for_plugin | ( | plugin_t * | plugin | ) |
Unregister all abort handlers for plugin.
G_BEGIN_DECLS typedef void(* abort_handler) (void) |
Statically allocated handlers for fatal signal handling.
The reason for all this is to avoid heap references in fatal signal handlers (which are a big no-no), but still allow plugins to do some rudimentary cleanup. See
Plugins, during initialization, register their abort handlers using ekg2_register_abort_handler().
The registered abort handlers will be called by core in cases such as receiving a SIGSEGV or SIGABRT.
Core will also unregister all handlers for a given plugin right before unregistering the plugin itself, but there is no harm in the plugin unregistering its own abort handlers if it knows of a more appropriate time.