mirror of
https://github.com/troglobit/finit.git
synced 2026-10-18 10:59:34 +00:00
Add HOOK_SVC_LOST to detect lost processes
This patch adds support for the runtime `HOOK_SVC_LOST` and the (very noisy) *example* plugin `lost.so`. Customer request. Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
e54c7eef65
commit
3f3220e806
7 files changed
+90
-7
No files matched your search
@@ -166,18 +166,26 @@ plugin_t *plugin_find(char *name)
|
||||
}
|
||||
|
||||
/* Private daemon API *******************************************************/
|
||||
void plugin_run_hooks(hook_point_t no)
|
||||
|
||||
/* Some hooks are called with a fixed argument, like HOOK_SVC_LOST */
|
||||
void plugin_run_hook(hook_point_t no, void *arg)
|
||||
{
|
||||
plugin_t *p, *tmp;
|
||||
|
||||
PLUGIN_ITERATOR(p, tmp) {
|
||||
if (p->hook[no].cb) {
|
||||
_d("Calling %s hook n:o %d from runloop...", basename(p->name), no);
|
||||
p->hook[no].cb(p->hook[no].arg);
|
||||
_d("Calling %s hook n:o %d (arg: %p) ...", basename(p->name), no, arg);
|
||||
p->hook[no].cb(arg ? arg : p->hook[no].arg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Regular hooks are called with the registered plugin's argument */
|
||||
void plugin_run_hooks(hook_point_t no)
|
||||
{
|
||||
plugin_run_hook(no, NULL);
|
||||
}
|
||||
|
||||
/* Generic libev I/O callback, looks up correct plugin and calls its callback */
|
||||
static void generic_io_cb(uev_t *w, void *arg, int events)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user